

#include "BUILTIN.h"

#include "Nat.h"
extern OBJ _AMap_31(OBJ,OBJ,OBJ,OBJ);extern OBJ __AMap_31;
extern OBJ _AMapFilter_4(OBJ,OBJ,OBJ);extern OBJ __AMapFilter_4;
extern TUP2 _AMapFilter_5(OBJ,OBJ,OBJ);extern OBJ __AMapFilter_5;
extern OBJ _AMapReduce_6(OBJ,OBJ,OBJ,OBJ);extern OBJ __AMapReduce_6;
extern OBJ __ATree_7;
extern OBJ _ACAST_3(OBJ);extern OBJ __ACAST_3;
extern OBJ _ARelFilter_6(OBJ,OBJ,OBJ,OBJ);OBJ __ARelFilter_6; /* | */
extern TUP2 _ARelFilter_7(OBJ,OBJ,OBJ,OBJ);OBJ __ARelFilter_7; /* partition */
extern OBJ _ARelFilter_8(OBJ,OBJ,OBJ);OBJ __ARelFilter_8; /* clean */
extern OBJ _ARelFilter_9(OBJ,OBJ);OBJ __ARelFilter_9; /* clean'9 */
extern OBJ _ARelFilter_10(OBJ,OBJ,OBJ,OBJ);OBJ __ARelFilter_10; /* |'10 */
extern OBJ _ARelFilter_11(OBJ,OBJ,OBJ,OBJ,OBJ,OBJ);OBJ __ARelFilter_11; /* |'11 */
OBJ __ARelFilter_12; /* partition'12 */
extern OBJ _ARelFilter_13(OBJ,OBJ,OBJ,OBJ);OBJ __ARelFilter_13; /* partition'13 */
extern OBJ _ARelFilter_14(OBJ,OBJ,OBJ,OBJ,OBJ,OBJ);OBJ __ARelFilter_14; /* partition'14 */

extern OBJ _ARelFilter_6(OBJ x1,OBJ x2,OBJ x3,OBJ x4) /* | */
{OBJ r;
 CPCLS(__ARelFilter_9,1);
 CPCLS(__ARelFilter_11,1);
 CPCLS(x1,2);
 {OBJ x5;OBJ x6;OBJ x7;OBJ x8;
  x5=_ACAST_3(x4);
  x6=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ))METHOD(__ARelFilter_11,3))(__ARelFilter_11,x1,x2,x3);
  x7=_AMapReduce_6(x1,x6,__ATree_7,x5);
  x8=_AMapFilter_4(x1,__ARelFilter_9,x7);
  r=_ACAST_3(x8);}
 return r;}

extern TUP2 _ARelFilter_7(OBJ x1,OBJ x2,OBJ x3,OBJ x4) /* partition */
{TUP2 r;
 CPPRD(__ARelFilter_12,1);
 CPCLS(__ARelFilter_14,1);
 CPCLS(x1,2);
 {OBJ x5;OBJ x6;OBJ x7;
  x5=_ACAST_3(x4);
  x6=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ))METHOD(__ARelFilter_14,3))(__ARelFilter_14,x1,x2,x3);
  x7=_AMapReduce_6(x1,x6,__ARelFilter_12,x5);
  {OBJ x18=FLD1(x7,1);OBJ x19=FLD1(x7,2);
   if(EXPRD(x7,1)){
    DSPRDF(x7);
   }else{
    COPY(x18,1);COPY(x19,1);
    FRPRD(x7,1);}
   CPCLS(x1,1);
   CPCLS(__ARelFilter_9,2);
   {OBJ x20;OBJ x21;
    x20=_AMapFilter_4(x1,__ARelFilter_9,x19);
    x21=_AMapFilter_4(x1,__ARelFilter_9,x18);
    r.c2=_ACAST_3(x20);
    r.c1=_ACAST_3(x21);}}}
 return r;}
extern OBJ _ARelFilter_7_c(OBJ x1,OBJ x2,OBJ x3,OBJ x4) /* partition */
{OBJ r;
 {TUP2 t=_ARelFilter_7(x1,x2,x3,x4);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern OBJ _ARelFilter_8(OBJ x1,OBJ x2,OBJ x3) /* clean */
{OBJ r;
 CPCLS(__ARelFilter_9,1);
 FRCLS(x2,1);
 r=_AMapFilter_4(x1,__ARelFilter_9,x3);
 return r;}

extern OBJ _ARelFilter_9(OBJ x1,OBJ x2) /* clean'9 */
{OBJ r;
 FREE(x1,1);
 if(ISPRM(x2)){
  r=__ABUILTIN_3;
 }else{
  if(EXPRD(x2,1)){
   DSPRD(x2);
  }else{
   DCPRD(x2,1);}
  r=__ABUILTIN_5;}
 return r;}

extern OBJ _ARelFilter_10(OBJ x1,OBJ x2,OBJ x3,OBJ x4) /* |'10 */
{OBJ r;
 r=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ))METHOD(x1,3))(x1,x2,x3,x4);
 return r;}

extern OBJ _ARelFilter_11(OBJ x1,OBJ x2,OBJ x3,OBJ x4,OBJ x5,OBJ x6) /* |'11 */
{OBJ r;
 CPCLS(__ARelFilter_10,1);
 COPY(x4,1);
 {OBJ x7;OBJ x8;
  x7=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ARelFilter_10,2))(__ARelFilter_10,x3,x4);
  x8=_AMapFilter_4(x2,x7,x5);
  r=_AMap_31(x1,x4,x8,x6);}
 return r;}

extern OBJ _ARelFilter_13(OBJ x1,OBJ x2,OBJ x3,OBJ x4) /* partition'13 */
{OBJ r;
 r=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ))METHOD(x1,3))(x1,x2,x3,x4);
 return r;}

extern OBJ _ARelFilter_14(OBJ x1,OBJ x2,OBJ x3,OBJ x4,OBJ x5,OBJ x6) /* partition'14 */
{OBJ r;
 {OBJ x19=FLD1(x6,1);OBJ x20=FLD1(x6,2);
  if(EXPRD(x6,1)){
   CPCLS(x1,1);
   COPY(x4,2);
   CPCLS(__ARelFilter_13,1);
   {OBJ x21;TUP2 x23;OBJ x25;
    x21=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ARelFilter_13,2))(__ARelFilter_13,x3,x4);
    x23=_AMapFilter_5(x2,x21,x5);
    x25=_AMap_31(x1,x4,x23.c2,x20);
    RSOME(x6,r);FLD1(r,2)=x25;
    FLD1(r,1)=_AMap_31(x1,x4,x23.c1,x19);}
  }else{
   COPY(x19,1);COPY(x20,1);
   CPCLS(x1,1);
   COPY(x4,2);
   CPCLS(__ARelFilter_13,1);
   {OBJ x21;TUP2 x23;OBJ x25;
    x21=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ARelFilter_13,2))(__ARelFilter_13,x3,x4);
    x23=_AMapFilter_5(x2,x21,x5);
    x25=_AMap_31(x1,x4,x23.c2,x20);
    FRPRD(x6,1);PRD1(2,r);FLD1(r,2)=x25;
    FLD1(r,1)=_AMap_31(x1,x4,x23.c1,x19);}}}
 return r;}


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

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

init_ARelFilter()
{
 static int visited=0; if(visited) return; visited=1;
 init_ARel();
 init_ASet();
 init_APair();
 init_ATriple();
 init_AOption();
 init_ASeq();
 init_ANat();
 init_ARelNotForUserPurpose();
 init_AMap();
 init_AMapFilter();
 init_AMapReduce();
 init_ASetByBST();
 init_ABSTree();
 init_ATree();
 init_ACAST();
 CLS(6,_ARelFilter_14,__ARelFilter_14);
 CLS(4,_ARelFilter_13,__ARelFilter_13);
 CLS(6,_ARelFilter_11,__ARelFilter_11);
 CLS(4,_ARelFilter_10,__ARelFilter_10);
 CLS(2,_ARelFilter_9,__ARelFilter_9);
 CLS(3,_ARelFilter_8,__ARelFilter_8);
 CLS(4,_ARelFilter_7_c,__ARelFilter_7);
 CLS(4,_ARelFilter_6,__ARelFilter_6);
 MTH(6,0,3,_mt_6_0_3);LZYMTH(6,0,3,_mt_6_0_3);
 MTH(6,3,3,_mt_6_3_3);LZYMTH(6,3,3,_mt_6_3_3);
 PRD1F(2,__ARelFilter_12);FLD1(__ARelFilter_12,1)=__ATree_7;FLD1(__ARelFilter_12,2)=__ATree_7;}

