

#include "BUILTIN.h"
extern OBJ _ABSTree_46(OBJ,OBJ);extern OBJ __ABSTree_46;
extern OBJ _ABSTree_49(OBJ,OBJ);extern OBJ __ABSTree_49;

#include "Nat.h"
extern OBJ _ATreeFilter_2(OBJ,OBJ);extern OBJ __ATreeFilter_2;
extern OBJ _ATreeFilter_3(OBJ,OBJ);extern OBJ __ATreeFilter_3;
extern OBJ _ATreeFilter_4(OBJ,OBJ);extern OBJ __ATreeFilter_4;

#include "Denotation.h"

#include "Char.h"

#include "Int.h"
extern OBJ _ABSTreeFilter_3(OBJ,OBJ,OBJ);OBJ __ABSTreeFilter_3; /* take */
extern OBJ _ABSTreeFilter_4(OBJ,OBJ,OBJ);OBJ __ABSTreeFilter_4; /* drop */
extern OBJ _ABSTreeFilter_5(OBJ,OBJ,OBJ);OBJ __ABSTreeFilter_5; /* dropall */
extern OBJ _ABSTreeFilter_6(OBJ,OBJ,OBJ);OBJ __ABSTreeFilter_6; /* lift */
extern OBJ _ABSTreeFilter_7(OBJ,OBJ,OBJ);OBJ __ABSTreeFilter_7; /* check */
OBJ __ABSTreeFilter_8; /* check'8 */
OBJ __ABSTreeFilter_9; /* check'9 */
OBJ __ABSTreeFilter_10; /* take'10 */
OBJ __ABSTreeFilter_11; /* drop'11 */
OBJ __ABSTreeFilter_12; /* dropall'12 */

extern OBJ _ABSTreeFilter_3(OBJ x1,OBJ x2,OBJ x3) /* take */
{OBJ r;
 CPCLS(__ABSTreeFilter_6,1);
 CPPRD(__ABSTreeFilter_10,1);
 CPCLS(x1,1);
 {OBJ x4;OBJ x5;
  x4=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ABSTreeFilter_6,2))(__ABSTreeFilter_6,x1,x2);
  x5=_ATreeFilter_2(x4,x3);
  r=_ABSTreeFilter_7(x1,__ABSTreeFilter_10,x5);}
 return r;}

extern OBJ _ABSTreeFilter_4(OBJ x1,OBJ x2,OBJ x3) /* drop */
{OBJ r;
 CPCLS(__ABSTreeFilter_6,1);
 CPPRD(__ABSTreeFilter_11,1);
 CPCLS(x1,1);
 {OBJ x4;OBJ x5;
  x4=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ABSTreeFilter_6,2))(__ABSTreeFilter_6,x1,x2);
  x5=_ATreeFilter_3(x4,x3);
  r=_ABSTreeFilter_7(x1,__ABSTreeFilter_11,x5);}
 return r;}

extern OBJ _ABSTreeFilter_5(OBJ x1,OBJ x2,OBJ x3) /* dropall */
{OBJ r;
 CPCLS(__ABSTreeFilter_6,1);
 CPPRD(__ABSTreeFilter_12,1);
 CPCLS(x1,1);
 {OBJ x4;OBJ x5;
  x4=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ABSTreeFilter_6,2))(__ABSTreeFilter_6,x1,x2);
  x5=_ATreeFilter_4(x4,x3);
  r=_ABSTreeFilter_7(x1,__ABSTreeFilter_12,x5);}
 return r;}

extern OBJ _ABSTreeFilter_6(OBJ x1,OBJ x2,OBJ x3) /* lift */
{OBJ r;
 FRCLS(x1,1);
 {OBJ x10=FLD1(x3,1);
  if(EXPRD(x3,1)){
   DSPRDF(x3);
  }else{
   COPY(x10,1);
   FRPRD(x3,1);}
  r=(*(OBJ(*)(OBJ,OBJ))METHOD(x2,1))(x2,x10);}
 return r;}

extern OBJ _ABSTreeFilter_7(OBJ x1,OBJ x2,OBJ x3) /* check */
{OBJ r;
 CPCLS(x1,1);
 COPY(x3,1);
 {OBJ x4;
  x4=_ABSTree_46(x1,x3);
  if(ISTGPRM(x4,1)){
   COPY(x3,1);
   {OBJ x5;
    x5=_ABSTree_49(x1,x3);
    if(ISTGPRM(x5,1)){
     FRPRD(x2,1);
     r=x3;
    }else{
     FREE(x3,1);
     CPPRD(__ABSTreeFilter_8,1);
     {OBJ x6;
      ADenotation_4(x2,__ABSTreeFilter_8,x6);
      ABUILTIN_12(x6,r);}}}
  }else{
   FRCLS(x1,1);
   FREE(x3,1);
   CPPRD(__ABSTreeFilter_9,1);
   {OBJ x7;
    ADenotation_4(x2,__ABSTreeFilter_9,x7);
    ABUILTIN_12(x7,r);}}}
 return r;}

static OBJ _mt_3_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_3_1_1(OBJ t,OBJ t1) 
{OBJ r;
 if(EXCLS(t)){
  r=t;
 }else{
  DPCLS(t,r);
  FLDCLS(r,1)=FLDCLS(t,1);
  COPY(FLDCLS(r,1),1);}
 INCCLS(r,1,1);
 FLDCLS(r,2)=t1;
 return r;}

static OBJ _mt_3_2_1(OBJ t,OBJ t1) 
{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))ENTRY(t))(FLDCLS(t,1),FLDCLS(t,2),t1);
 return r;}
static OBJ _mt_3_2_1_l(OBJ t,OBJ t1) 
{OBJ r;
 r=(*(OBJ(*)(OBJ,OBJ,OBJ))ENTRY(t))(FLDCLS(t,1),FLDCLS(t,2),t1);
 if(EXCLS(t)){
  DSCLSF(t);
 }else{
  DCCLS(t,1);
  FLDCLS(t,1)=NIL;FLDCLS(t,2)=NIL;
  COPY(r,1);LZYCLS(t,r);}
 return r;}

init_ABSTreeFilter()
{
 static int visited=0; if(visited) return; visited=1;
 init_ABSTree();
 init_ANat();
 init_AOption();
 init_ASeq();
 init_ATree();
 init_APair();
 init_ATreeFilter();
 init_ADenotation();
 init_AChar();
 init_ARelCmp();
 init_AInt();
 DEN("dropall",__ABSTreeFilter_12);
 DEN("drop",__ABSTreeFilter_11);
 DEN("take",__ABSTreeFilter_10);
 DEN("\'BSTreeFilter: tree would violate bs condition",__ABSTreeFilter_9);
 DEN("\'BSTreeFilter: tree would be unbalanced",__ABSTreeFilter_8);
 CLS(3,_ABSTreeFilter_7,__ABSTreeFilter_7);
 CLS(3,_ABSTreeFilter_6,__ABSTreeFilter_6);
 CLS(3,_ABSTreeFilter_5,__ABSTreeFilter_5);
 CLS(3,_ABSTreeFilter_4,__ABSTreeFilter_4);
 CLS(3,_ABSTreeFilter_3,__ABSTreeFilter_3);
 MTH(3,0,2,_mt_3_0_2);LZYMTH(3,0,2,_mt_3_0_2);
 MTH(3,1,1,_mt_3_1_1);LZYMTH(3,1,1,_mt_3_1_1);
 MTH(3,2,1,_mt_3_2_1);LZYMTH(3,2,1,_mt_3_2_1_l);}

