

#include "BUILTIN.h"

#include "Nat.h"

#include "Denotation.h"
extern OBJ _ASeqReduce_3(OBJ,OBJ,OBJ);extern OBJ __ASeqReduce_3;
extern OBJ _ASeqMap_3(OBJ,OBJ);extern OBJ __ASeqMap_3;

#include "Char.h"

#include "Int.h"
OBJ __APatterns_2; /* irrel */
extern OBJ _APatterns_3(OBJ);OBJ __APatterns_3; /* irrel? */
extern OBJ _APatterns_4(OBJ,OBJ);OBJ __APatterns_4; /* patt */
extern OBJ _APatterns_5(OBJ);OBJ __APatterns_5; /* patt? */
extern OBJ _APatterns_6(OBJ);OBJ __APatterns_6; /* subPatts */
extern OBJ _APatterns_7(OBJ);OBJ __APatterns_7; /* constr */
extern OBJ _APatterns_8(OBJ,OBJ);OBJ __APatterns_8; /* target */
extern OBJ _APatterns_9(OBJ);OBJ __APatterns_9; /* target? */
extern OBJ _APatterns_10(OBJ);OBJ __APatterns_10; /* args */
extern OBJ _APatterns_11(OBJ);OBJ __APatterns_11; /* fun */
extern OBJ _APatterns_13(OBJ,OBJ);OBJ __APatterns_13; /* ` */
extern OBJ _APatterns_25(OBJ,OBJ);OBJ __APatterns_25; /* `,1 */
extern OBJ _APatterns_26(OBJ,OBJ);OBJ __APatterns_26; /* `,2 */
OBJ __APatterns_27; /* `'27 */
OBJ __APatterns_28; /* `,1'28 */
extern OBJ _APatterns_29(OBJ);OBJ __APatterns_29; /* `,1'29 */
OBJ __APatterns_30; /* `,1'30 */
OBJ __APatterns_31; /* `,1'31 */
OBJ __APatterns_32; /* `,2'32 */

extern OBJ _APatterns_3(OBJ x1) /* irrel? */
{OBJ r;
 if(ISPRM(x1)){
  r=__ABUILTIN_5;
 }else{
  FREE(x1,1);
  r=__ABUILTIN_3;}
 return r;}

extern OBJ _APatterns_4(OBJ x1,OBJ x2) /* patt */
{OBJ r;
 PRD(2,1,r);FLD(r,1)=x1;FLD(r,2)=x2;
 return r;}

extern OBJ _APatterns_5(OBJ x1) /* patt? */
{OBJ r;
 if(ISPRD(x1)&&(ISTGPRD(x1,1))){
  if(EXPRD(x1,1)){
   DSPRD(x1);
  }else{
   DCPRD(x1,1);}
  r=__ABUILTIN_5;
 }else{
  FREE(x1,1);
  r=__ABUILTIN_3;}
 return r;}

extern OBJ _APatterns_6(OBJ x1) /* subPatts */
{OBJ r;
 if(ISPRD(x1)&&(ISTGPRD(x1,1))){
  {OBJ x3=FLD(x1,2);
   if(EXPRD(x1,1)){
    r=x3;
    FREE(FLD(x1,1),1);DSPRDF(x1);
   }else{
    COPY(x3,1);
    r=x3;
    FRPRD(x1,1);}}
 }else{
  HLT("Patterns at <unknown> : undefined selection subPatts\'Patterns:pattDescr->seq");}
 return r;}

extern OBJ _APatterns_7(OBJ x1) /* constr */
{OBJ r;
 if(ISPRD(x1)&&(ISTGPRD(x1,1))){
  {OBJ x2=FLD(x1,1);
   if(EXPRD(x1,1)){
    r=x2;
    FREE(FLD(x1,2),1);DSPRDF(x1);
   }else{
    COPY(x2,1);
    r=x2;
    FRPRD(x1,1);}}
 }else{
  HLT("Patterns at <unknown> : undefined selection constr\'Patterns:pattDescr->obj");}
 return r;}

extern OBJ _APatterns_8(OBJ x1,OBJ x2) /* target */
{OBJ r;
 PRD(2,0,r);FLD(r,1)=x1;FLD(r,2)=x2;
 return r;}

extern OBJ _APatterns_9(OBJ x1) /* target? */
{OBJ r;
 if(ISPRD(x1)&&(ISTGPRD(x1,0))){
  if(EXPRD(x1,1)){
   DSPRD(x1);
  }else{
   DCPRD(x1,1);}
  r=__ABUILTIN_5;
 }else{
  FREE(x1,1);
  r=__ABUILTIN_3;}
 return r;}

extern OBJ _APatterns_10(OBJ x1) /* args */
{OBJ r;
 if(ISPRD(x1)&&(ISTGPRD(x1,0))){
  {OBJ x3=FLD(x1,2);
   if(EXPRD(x1,1)){
    r=x3;
    FREE(FLD(x1,1),1);DSPRDF(x1);
   }else{
    COPY(x3,1);
    r=x3;
    FRPRD(x1,1);}}
 }else{
  HLT("Patterns at <unknown> : undefined selection args\'Patterns:pattDescr->seq");}
 return r;}

extern OBJ _APatterns_11(OBJ x1) /* fun */
{OBJ r;
 if(ISPRD(x1)&&(ISTGPRD(x1,0))){
  {OBJ x2=FLD(x1,1);
   if(EXPRD(x1,1)){
    r=x2;
    FREE(FLD(x1,2),1);DSPRDF(x1);
   }else{
    COPY(x2,1);
    r=x2;
    FRPRD(x1,1);}}
 }else{
  HLT("Patterns at <unknown> : undefined selection fun\'Patterns:pattDescr->obj");}
 return r;}

extern OBJ _APatterns_13(OBJ x1,OBJ x2) /* ` */
{OBJ r;
 if(ISPRM(x2)){
  FRCLS(x1,1);
  CPPRD(__APatterns_27,1);
  r=__APatterns_27;
 }else{
  if(ISTGPRD(x2,0)){
   {OBJ x37=FLD(x2,1);OBJ x38=FLD(x2,2);
    if(EXPRD(x2,1)){
     DSPRDF(x2);
    }else{
     COPY(x37,1);COPY(x38,1);
     FRPRD(x2,1);}
    CPCLS(x1,1);
    {OBJ x39;OBJ x40;
     x39=(*(OBJ(*)(OBJ,OBJ))METHOD(x1,1))(x1,x37);
     x40=_APatterns_26(x1,x38);
     ADenotation_4(x39,x40,r);}}
  }else{
   {OBJ x41=FLD(x2,1);OBJ x42=FLD(x2,2);
    if(EXPRD(x2,1)){
     DSPRDF(x2);
    }else{
     COPY(x41,1);COPY(x42,1);
     FRPRD(x2,1);}
    CPCLS(x1,1);
    {OBJ x43;OBJ x44;
     x43=_APatterns_25(x1,x42);
     x44=(*(OBJ(*)(OBJ,OBJ))METHOD(x1,1))(x1,x41);
     ADenotation_4(x44,x43,r);}}}}
 return r;}

extern OBJ _APatterns_25(OBJ x1,OBJ x2) /* `,1 */
{OBJ r;
 if(ISPRM(x2)){
  FRCLS(x1,1);
  CPPRD(__ADenotation_3,1);
  r=__ADenotation_3;
 }else{
  CPCLS(__APatterns_13,1);
  CPCLS(__APatterns_29,1);
  CPPRD(__APatterns_30,1);
  CPPRD(__APatterns_31,1);
  CPPRD(__ADenotation_3,1);
  {OBJ x16;OBJ x17;OBJ x18;OBJ x19;OBJ x20;
   x16=(*(OBJ(*)(OBJ,OBJ))METHOD(__APatterns_13,1))(__APatterns_13,x1);
   x17=(*(OBJ(*)(OBJ,OBJ))METHOD(__APatterns_29,1))(__APatterns_29,__ABUILTIN_20);
   x18=_ASeqMap_3(x16,x2);
   x19=_ASeqReduce_3(x17,__ADenotation_3,x18);
   ADenotation_4(x19,__APatterns_30,x20);
   ADenotation_4(__APatterns_31,x20,r);}}
 return r;}

extern OBJ _APatterns_26(OBJ x1,OBJ x2) /* `,2 */
{OBJ r;
 if(ISPRM(x2)){
  FRCLS(x1,1);
  CPPRD(__ADenotation_3,1);
  r=__ADenotation_3;
 }else{
  {OBJ x31=FLD1(x2,1);OBJ x32=FLD1(x2,2);
   if(EXPRD(x2,1)){
    DSPRDF(x2);
   }else{
    COPY(x31,1);COPY(x32,1);
    FRPRD(x2,1);}
   if(ISPRM(x31)){
    CPPRD(__APatterns_32,1);
    {OBJ x34;
     x34=_APatterns_26(x1,x32);
     ADenotation_4(__APatterns_32,x34,r);}
   }else{
    CPCLS(x1,1);
    {OBJ x38;OBJ x37;
     x38=_APatterns_25(x1,x31);
     x37=_APatterns_26(x1,x32);
     ADenotation_4(x38,x37,r);}}}}
 return r;}

extern OBJ _APatterns_29(OBJ x1) /* `,1'29 */
{OBJ r;
 CPPRD(__APatterns_28,1);
 CPCLS(__ADenotation_6,1);
 r=(*(OBJ(*)(OBJ,OBJ))METHOD(__ADenotation_6,1))(__ADenotation_6,__APatterns_28);
 return r;}


static OBJ _mt_1_0_3(OBJ t,OBJ t1,OBJ t2,OBJ t3) 
{OBJ r;
 {OBJ t4;
  DCCLS(t,1);
  t4=(*(OBJ(*)(OBJ))ENTRY(t))(t1);
  r=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(t4,2))(t4,t2,t3);}
 return r;}

init_APatterns()
{
 static int visited=0; if(visited) return; visited=1;
 init_ASeq();
 init_ANat();
 init_AOption();
 init_ADenotation();
 init_ASeqReduce();
 init_ASeqMap();
 init_AChar();
 init_AInt();
 DEN("(",__APatterns_31);
 DEN(")",__APatterns_30);
 LCLS(1,_APatterns_29,__APatterns_29);
 DEN(",",__APatterns_28);
 DEN("_",__APatterns_27);
 CLS(2,_APatterns_26,__APatterns_26);
 CLS(2,_APatterns_25,__APatterns_25);
 CLS(2,_APatterns_13,__APatterns_13);
 CLS(1,_APatterns_11,__APatterns_11);
 CLS(1,_APatterns_10,__APatterns_10);
 CLS(1,_APatterns_9,__APatterns_9);
 CLS(2,_APatterns_8,__APatterns_8);
 CLS(1,_APatterns_7,__APatterns_7);
 CLS(1,_APatterns_6,__APatterns_6);
 CLS(1,_APatterns_5,__APatterns_5);
 CLS(2,_APatterns_4,__APatterns_4);
 CLS(1,_APatterns_3,__APatterns_3);
 DEN("()",__APatterns_32);
 MTH(1,0,3,_mt_1_0_3);LZYMTH(1,0,3,_mt_1_0_3);
 PRM1(__APatterns_2);}

