

#include "BUILTIN.h"
extern OBJ __ASeq_6;

#include "Nat.h"

#include "Char.h"
extern OBJ _APair_5(OBJ);extern OBJ __APair_5;
extern OBJ _ASeqReduce_3(OBJ,OBJ,OBJ);extern OBJ __ASeqReduce_3;
extern OBJ _ASeqMap_3(OBJ,OBJ);extern OBJ __ASeqMap_3;
extern OBJ __ANatMap_3;
extern OBJ _ANatMap_4(OBJ,OBJ,OBJ);extern OBJ __ANatMap_4;
extern OBJ _ANatMap_6(OBJ,OBJ);extern OBJ __ANatMap_6;
extern OBJ _ANatMap_12(OBJ,OBJ);extern OBJ __ANatMap_12;
extern OBJ _ANatMap_14(OBJ,OBJ);extern OBJ __ANatMap_14;
extern OBJ _ANatMap_16(OBJ);extern OBJ __ANatMap_16;
extern OBJ _ANatMap_17(OBJ,OBJ);extern OBJ __ANatMap_17;
extern OBJ _ANatMap_18(OBJ);extern OBJ __ANatMap_18;
extern OBJ _ANatMap_19(OBJ);extern OBJ __ANatMap_19;
extern OBJ _ANatMapConv_2(OBJ);extern OBJ __ANatMapConv_2;

#include "Array.h"
OBJ __ARepSet_2; /* {} */
extern OBJ _ARepSet_3(OBJ,OBJ);OBJ __ARepSet_3; /* % */
extern OBJ _ARepSet_4(OBJ,OBJ,OBJ);OBJ __ARepSet_4; /* incl */
extern OBJ _ARepSet_5(OBJ,OBJ);OBJ __ARepSet_5; /* + */
extern OBJ _ARepSet_6(OBJ,OBJ);OBJ __ARepSet_6; /* - */
extern OBJ _ARepSet_7(OBJ,OBJ);OBJ __ARepSet_7; /* disjoint */
extern OBJ _ARepSet_8(OBJ,OBJ);OBJ __ARepSet_8; /* in */
extern OBJ _ARepSet_9(OBJ,OBJ);OBJ __ARepSet_9; /* pos */
extern OBJ _ARepSet_10(OBJ,OBJ);OBJ __ARepSet_10; /* * */
extern OBJ _ARepSet_11(OBJ);OBJ __ARepSet_11; /* toSeq */
extern OBJ _ARepSet_12(OBJ);OBJ __ARepSet_12; /* repSet */
extern OBJ _ARepSet_13(OBJ);OBJ __ARepSet_13; /* repSet? */
extern OBJ _ARepSet_14(OBJ);OBJ __ARepSet_14; /* map */
extern OBJ _ARepSet_15(OBJ,OBJ);OBJ __ARepSet_15; /* *,1 */
extern OBJ _ARepSet_16(OBJ,OBJ);OBJ __ARepSet_16; /* -'16 */
extern OBJ _ARepSet_17(OBJ,OBJ,OBJ);OBJ __ARepSet_17; /* *,1'17 */
extern OBJ _ARepSet_18(OBJ,OBJ,OBJ,OBJ);OBJ __ARepSet_18; /* *'18 */

extern OBJ _ARepSet_3(OBJ x1,OBJ x2) /* % */
{OBJ r;
 CPPRD(x1,1);
 {OBJ x7;
  PRD1(2,x7);FLD1(x7,1)=x1;FLD1(x7,2)=x2;
  {OBJ x3=FLD1(x1,1);
   if(EXPRD(x1,1)){
    FRPRD(FLD1(x1,2),1);DSPRDF(x1);
   }else{
    FRPRD(x1,1);}
   CPPRD(__ANatMap_3,1);
   {OBJ x6;
    x6=x3;
    r=_ANatMap_4(x6,x7,__ANatMap_3);}}}
 return r;}

extern OBJ _ARepSet_4(OBJ x1,OBJ x2,OBJ x3) /* incl */
{OBJ r;
 CPPRD(x1,1);
 {OBJ x8;
  PRD1(2,x8);FLD1(x8,1)=x1;FLD1(x8,2)=x2;
  {OBJ x4=FLD1(x1,1);
   if(EXPRD(x1,1)){
    FRPRD(FLD1(x1,2),1);DSPRDF(x1);
   }else{
    FRPRD(x1,1);}
   {OBJ x7;
    x7=x4;
    r=_ANatMap_4(x7,x8,x3);}}}
 return r;}

extern OBJ _ARepSet_5(OBJ x1,OBJ x2) /* + */
{OBJ r;
 r=_ANatMap_12(x1,x2);
 return r;}

extern OBJ _ARepSet_6(OBJ x1,OBJ x2) /* - */
{OBJ r;
 CPCLS(__ARepSet_16,1);
 {OBJ x3;
  x3=_ANatMap_18(x2);
  r=_ASeqReduce_3(__ARepSet_16,x1,x3);}
 return r;}

extern OBJ _ARepSet_7(OBJ x1,OBJ x2) /* disjoint */
{OBJ r;
 {OBJ x3;
  x3=_ARepSet_15(x1,x2);
  r=_ANatMap_16(x3);}
 return r;}

extern OBJ _ARepSet_8(OBJ x1,OBJ x2) /* in */
{OBJ r;
 {OBJ x3=FLD1(x1,1);
  if(EXPRD(x1,1)){
   FRPRD(FLD1(x1,2),1);DSPRDF(x1);
  }else{
   FRPRD(x1,1);}
  {OBJ x6;
   x6=x3;
   r=_ANatMap_17(x6,x2);}}
 return r;}

extern OBJ _ARepSet_9(OBJ x1,OBJ x2) /* pos */
{OBJ r;
 {OBJ x3=FLD1(x1,1);
  if(EXPRD(x1,1)){
   FRPRD(FLD1(x1,2),1);DSPRDF(x1);
  }else{
   FRPRD(x1,1);}
  {OBJ x6;OBJ x7;
   x6=x3;
   x7=_ANatMap_14(x2,x6);
   {OBJ x9=FLD1(x7,2);
    if(EXPRD(x7,1)){
     r=x9;
     FRPRD(FLD1(x7,1),1);DSPRDF(x7);
    }else{
     COPY(x9,1);
     r=x9;
     FRPRD(x7,1);}}}}
 return r;}

extern OBJ _ARepSet_10(OBJ x1,OBJ x2) /* * */
{OBJ r;
 CPCLS(__ARepSet_18,1);
 CPPRD(x2,1);
 {OBJ x3;OBJ x4;
  x3=_ANatMapConv_2(x2);
  x4=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ARepSet_18,2))(__ARepSet_18,x1,x2);
  r=_ASeqReduce_3(x4,__ASeq_6,x3);}
 return r;}

extern OBJ _ARepSet_11(OBJ x1) /* toSeq */
{OBJ r;
 CPCLS(__APair_5,1);
 {OBJ x2;
  x2=_ANatMap_19(x1);
  r=_ASeqMap_3(__APair_5,x2);}
 return r;}

extern OBJ _ARepSet_12(OBJ x1) /* repSet */
{OBJ r;
 r=x1;
 return r;}

extern OBJ _ARepSet_13(OBJ x1) /* repSet? */
{OBJ r;
 FRPRD(x1,1);
 r=__ABUILTIN_5;
 return r;}

extern OBJ _ARepSet_14(OBJ x1) /* map */
{OBJ r;
 r=x1;
 return r;}

extern OBJ _ARepSet_15(OBJ x1,OBJ x2) /* *,1 */
{OBJ r;
 CPCLS(__ARepSet_17,1);
 CPPRD(x2,1);
 {OBJ x3;OBJ x4;
  x3=_ANatMap_18(x2);
  x4=(*(OBJ(*)(OBJ,OBJ))METHOD(__ARepSet_17,1))(__ARepSet_17,x1);
  r=_ASeqReduce_3(x4,x2,x3);}
 return r;}

extern OBJ _ARepSet_16(OBJ x1,OBJ x2) /* -'16 */
{OBJ r;
 r=_ANatMap_6(x1,x2);
 return r;}

extern OBJ _ARepSet_17(OBJ x1,OBJ x2,OBJ x3) /* *,1'17 */
{OBJ r;
 {OBJ x4;
  x4=_ANatMap_17(x2,x1);
  if(ISTGPRM(x4,1)){
   r=x3;
  }else{
   r=_ANatMap_6(x2,x3);}}
 return r;}

extern OBJ _ARepSet_18(OBJ x1,OBJ x2,OBJ x3,OBJ x4) /* *'18 */
{OBJ r;
 {OBJ x28=FLD1(x3,1);OBJ x29=FLD1(x3,2);
  if(EXPRD(x3,1)){
   DSPRDF(x3);
  }else{
   CPPRD(x29,1);
   FRPRD(x3,1);}
  {OBJ x30;
   x30=_ANatMap_17(x28,x1);
   if(ISTGPRM(x30,1)){
    {OBJ x31;
     x31=_ANatMap_14(x2,x28);
     {OBJ x32=FLD1(x29,1);OBJ x33=FLD1(x29,2);
      if(EXPRD(x29,1)){
       DSPRDF(x29);
      }else{
       CPPRD(x32,1);COPY(x33,1);
       FRPRD(x29,1);}
      {OBJ x35=FLD1(x31,2);
       if(EXPRD(x31,1)){
	{OBJ x36;
	 PRD1(3,x36);FLD1(x36,1)=x32;FLD1(x36,2)=x35;FLD1(x36,3)=x33;
	 RSOME(x31,r);FRPRD(FLD1(r,1),1);FLD1(r,1)=x36;FLD1(r,2)=x4;}
       }else{
	COPY(x35,1);
	{OBJ x36;
	 PRD1(3,x36);FLD1(x36,1)=x32;FLD1(x36,2)=x35;FLD1(x36,3)=x33;
	 FRPRD(x31,1);PRD1(2,r);FLD1(r,1)=x36;FLD1(r,2)=x4;}}}}}
   }else{
    FRPRD(x2,1);
    FRPRD(x29,1);
    r=x4;}}}
 return r;}


static OBJ _mt_4_0_2(OBJ t,OBJ t1,OBJ t2) 
{OBJ r;
 DPCLS(t,r);
 INCCLS(r,0,2);
 FLDCLS(r,1)=t1;
 FLDCLS(r,2)=t2;
 return r;}

static OBJ _mt_4_2_2(OBJ t,OBJ t1,OBJ t2) 
{OBJ r;
 if(EXCLS(t)){
  DSCLSF(t);
 }else{
  COPY(FLDCLS(t,1),1);
  COPY(FLDCLS(t,2),1);
  DCCLS(t,1);}
 r=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ))ENTRY(t))(FLDCLS(t,1),FLDCLS(t,2),t1,t2);
 return r;}

init_ARepSet()
{
 static int visited=0; if(visited) return; visited=1;
 init_ATriple();
 init_ASeq();
 init_ARep();
 init_AOcPos();
 init_ANat();
 init_AChar();
 init_AOption();
 init_APair();
 init_ASeqReduce();
 init_ASeqMap();
 init_ASetReduce();
 init_ANatMap();
 init_ANatMapConv();
 init_ACompose();
 init_AString();
 init_ASet();
 init_AArray();
 init_ALexem();
 init_AMap();
 init_ASetByBST();
 init_ABSTree();
 init_ATree();
 init_ASeqConv();
 init_AMapConv();
 CLS(4,_ARepSet_18,__ARepSet_18);
 CLS(3,_ARepSet_17,__ARepSet_17);
 CLS(2,_ARepSet_16,__ARepSet_16);
 CLS(2,_ARepSet_15,__ARepSet_15);
 CLS(1,_ARepSet_14,__ARepSet_14);
 CLS(1,_ARepSet_13,__ARepSet_13);
 CLS(1,_ARepSet_12,__ARepSet_12);
 CLS(1,_ARepSet_11,__ARepSet_11);
 CLS(2,_ARepSet_10,__ARepSet_10);
 CLS(2,_ARepSet_9,__ARepSet_9);
 CLS(2,_ARepSet_8,__ARepSet_8);
 CLS(2,_ARepSet_7,__ARepSet_7);
 CLS(2,_ARepSet_6,__ARepSet_6);
 CLS(2,_ARepSet_5,__ARepSet_5);
 CLS(3,_ARepSet_4,__ARepSet_4);
 CLS(2,_ARepSet_3,__ARepSet_3);
 MTH(4,0,2,_mt_4_0_2);LZYMTH(4,0,2,_mt_4_0_2);
 MTH(4,2,2,_mt_4_2_2);LZYMTH(4,2,2,_mt_4_2_2);
 CPPRD(__ANatMap_3,1);
 __ARepSet_2=__ANatMap_3;}

