

#include "BUILTIN.h"
extern OBJ _ASetByBST_41(OBJ,OBJ,OBJ);extern OBJ __ASetByBST_41;

#include "Nat.h"
extern OBJ _ABSTree_22(OBJ,OBJ,OBJ,OBJ);extern OBJ __ABSTree_22;
extern OBJ __ATree_7;
extern OBJ _ABSTreeReduce_4(OBJ,OBJ,OBJ,OBJ);extern OBJ __ABSTreeReduce_4;
extern OBJ _ASetByBSTFilter_3(OBJ,OBJ,OBJ);OBJ __ASetByBSTFilter_3; /* | */
extern TUP2 _ASetByBSTFilter_4(OBJ,OBJ,OBJ);OBJ __ASetByBSTFilter_4; /* partition */
extern OBJ _ASetByBSTFilter_5(OBJ,OBJ,OBJ,OBJ,OBJ);OBJ __ASetByBSTFilter_5; /* |'5 */
OBJ __ASetByBSTFilter_6; /* partition'6 */
extern OBJ _ASetByBSTFilter_7(OBJ,OBJ,OBJ,OBJ,OBJ);OBJ __ASetByBSTFilter_7; /* partition'7 */

extern OBJ _ASetByBSTFilter_3(OBJ x1,OBJ x2,OBJ x3) /* | */
{OBJ r;
 if(ISPRM(x3)){
  FRCLS(x1,1);
  FRCLS(x2,1);
  r=__ATree_7;
 }else{
  CPCLS(x1,1);
  CPCLS(__ASetByBSTFilter_5,1);
  {OBJ x12;
   x12=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ASetByBSTFilter_5,2))(__ASetByBSTFilter_5,x1,x2);
   r=_ABSTreeReduce_4(x1,x12,__ATree_7,x3);}}
 return r;}

extern TUP2 _ASetByBSTFilter_4(OBJ x1,OBJ x2,OBJ x3) /* partition */
{TUP2 r;
 if(ISPRM(x3)){
  FRCLS(x1,1);
  FRCLS(x2,1);
  r.c1=__ATree_7;r.c2=__ATree_7;
 }else{
  CPCLS(x1,1);
  CPPRD(__ASetByBSTFilter_6,1);
  CPCLS(__ASetByBSTFilter_7,1);
  {OBJ x21;OBJ x22;
   x21=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ASetByBSTFilter_7,2))(__ASetByBSTFilter_7,x1,x2);
   x22=_ABSTreeReduce_4(x1,x21,__ASetByBSTFilter_6,x3);
   {OBJ x23=FLD1(x22,1);OBJ x24=FLD1(x22,2);
    if(EXPRD(x22,1)){
     r.c1=x23;r.c2=x24;
     DSPRDF(x22);
    }else{
     COPY(x23,1);COPY(x24,1);
     r.c1=x23;r.c2=x24;
     FRPRD(x22,1);}}}}
 return r;}
extern OBJ _ASetByBSTFilter_4_c(OBJ x1,OBJ x2,OBJ x3) /* partition */
{OBJ r;
 {TUP2 t=_ASetByBSTFilter_4(x1,x2,x3);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern OBJ _ASetByBSTFilter_5(OBJ x1,OBJ x2,OBJ x3,OBJ x4,OBJ x5) /* |'5 */
{OBJ r;
 COPY(x3,1);
 {OBJ x6;
  x6=(*(OBJ(*)(OBJ,OBJ))METHOD(x2,1))(x2,x3);
  if(ISTGPRM(x6,1)){
   r=_ABSTree_22(x1,x3,x4,x5);
  }else{
   FREE(x3,1);
   r=_ASetByBST_41(x1,x4,x5);}}
 return r;}

extern OBJ _ASetByBSTFilter_7(OBJ x1,OBJ x2,OBJ x3,OBJ x4,OBJ x5) /* partition'7 */
{OBJ r;
 COPY(x3,1);
 {OBJ x6;
  x6=(*(OBJ(*)(OBJ,OBJ))METHOD(x2,1))(x2,x3);
  {OBJ x23=FLD1(x4,1);OBJ x24=FLD1(x4,2);
   if(EXPRD(x4,1)){
    DSPRDF(x4);
   }else{
    COPY(x23,1);COPY(x24,1);
    FRPRD(x4,1);}
   {OBJ x35=FLD1(x5,1);OBJ x36=FLD1(x5,2);FLAG x_x5=EXPRD(x5,1);
    if(x_x5){
    }else{
     COPY(x35,1);COPY(x36,1);}
    if(ISTGPRM(x6,1)){
     CPCLS(x1,1);
     {OBJ x37;
      x37=_ABSTree_22(x1,x3,x23,x35);
      if(x_x5){
       RSOME(x5,r);FLD1(r,1)=x37;
      }else{
       FRPRD(x5,1);PRD1(2,r);FLD1(r,1)=x37;}
      FLD1(r,2)=_ASetByBST_41(x1,x24,x36);}
    }else{
     CPCLS(x1,1);
     {OBJ x39;
      x39=_ASetByBST_41(x1,x23,x35);
      if(x_x5){
       RSOME(x5,r);FLD1(r,1)=x39;
      }else{
       FRPRD(x5,1);PRD1(2,r);FLD1(r,1)=x39;}
      FLD1(r,2)=_ABSTree_22(x1,x3,x24,x36);}}}}}
 return r;}


init_ASetByBSTFilter()
{
 static int visited=0; if(visited) return; visited=1;
 init_ASetByBST();
 init_ANat();
 init_ASeq();
 init_AOption();
 init_ABSTree();
 init_ATree();
 init_APair();
 init_ABSTreeReduce();
 CLS(5,_ASetByBSTFilter_7,__ASetByBSTFilter_7);
 CLS(5,_ASetByBSTFilter_5,__ASetByBSTFilter_5);
 CLS(3,_ASetByBSTFilter_4_c,__ASetByBSTFilter_4);
 CLS(3,_ASetByBSTFilter_3,__ASetByBSTFilter_3);
 PRD1F(2,__ASetByBSTFilter_6);FLD1(__ASetByBSTFilter_6,1)=__ATree_7;FLD1(__ASetByBSTFilter_6,2)=__ATree_7;}

