

#include "BUILTIN.h"
extern OBJ __ATree_7;

#include "Nat.h"
extern OBJ _ATreeFilter_2(OBJ,OBJ);OBJ __ATreeFilter_2; /* take */
extern OBJ _ATreeFilter_3(OBJ,OBJ);OBJ __ATreeFilter_3; /* drop */
extern OBJ _ATreeFilter_4(OBJ,OBJ);OBJ __ATreeFilter_4; /* dropall */

extern OBJ _ATreeFilter_2(register OBJ x1,register OBJ x2) /* take */
{OBJ r;OBJ* p1=&r;
 for(;;){
  if(ISPRM(x2)){
   FRCLS(x1,1);
   *p1=__ATree_7;
  }else{
   {OBJ x33=FLD1(x2,1);OBJ x34=FLD1(x2,2);OBJ x35=FLD1(x2,3);FLAG x_x2=EXPRD(x2,1);
    if(x_x2){
     COPY(x33,1);
    }else{
     COPY(x33,2);COPY(x34,1);COPY(x35,1);}
    CPCLS(x1,1);
    {OBJ x37;
     x37=(*(OBJ(*)(OBJ,OBJ))METHOD(x1,1))(x1,x33);
     if(ISTGPRM(x37,1)){
      CPCLS(x1,1);
      {OBJ x39;
       x39=_ATreeFilter_2(x1,x34);
       if(x_x2){
	RSOME(x2,*p1);FLD1(*p1,2)=x39;
       }else{
	FRPRD(x2,1);PRD1(3,*p1);FLD1(*p1,1)=x33;FLD1(*p1,2)=x39;}
       x2=x35;p1=&FLD1(*p1,3);continue;}
     }else{
      if(x_x2){
       DSPRDF(x2);
      }else{
       FRPRD(x2,1);}
      FRCLS(x1,1);
      FREE(x33,1);
      FREE(x34,1);
      FREE(x35,1);
      *p1=__ATree_7;}}}}
  break;}
 return r;}

extern OBJ _ATreeFilter_3(register OBJ x1,register OBJ x2) /* drop */
{OBJ r;OBJ* p1=&r;
 for(;;){
  if(ISPRM(x2)){
   FRCLS(x1,1);
   *p1=__ATree_7;
  }else{
   {OBJ x60=FLD1(x2,1);OBJ x61=FLD1(x2,2);OBJ x62=FLD1(x2,3);
    COPY(x60,1);COPY(x61,1);COPY(x62,1);
    if(ISPRM(x61)){
     if(ISPRM(x62)){
      {OBJ x64;
       x64=(*(OBJ(*)(OBJ,OBJ))METHOD(x1,1))(x1,x60);
       if(ISTGPRM(x64,1)){
	if(EXPRD(x2,1)){
	 DSPRD(x2);
	}else{
	 DCPRD(x2,1);}
	*p1=__ATree_7;
       }else{
	*p1=x2;}}
     }else{
      if(EXPRD(x2,1)){
       DSPRD(x2);
      }else{
       DCPRD(x2,1);}
      CPCLS(x1,1);
      {OBJ x69;
       x69=_ATreeFilter_3(x1,x61);
       PRD1(3,*p1);FLD1(*p1,1)=x60;FLD1(*p1,2)=x69;
       x2=x62;p1=&FLD1(*p1,3);continue;}}
    }else{
     if(EXPRD(x2,1)){
      DSPRD(x2);
     }else{
      DCPRD(x2,1);}
     CPCLS(x1,1);
     {OBJ x74;
      x74=_ATreeFilter_3(x1,x62);
      PRD1(3,*p1);FLD1(*p1,1)=x60;FLD1(*p1,3)=x74;
      x2=x61;p1=&FLD1(*p1,2);continue;}}}}
  break;}
 return r;}

extern OBJ _ATreeFilter_4(register OBJ x1,register OBJ x2) /* dropall */
{OBJ r;OBJ* p1=&r;
 for(;;){
  if(ISPRM(x2)){
   FRCLS(x1,1);
   *p1=__ATree_7;
  }else{
   {OBJ x45=FLD1(x2,1);OBJ x46=FLD1(x2,2);OBJ x47=FLD1(x2,3);FLAG x_x2=EXPRD(x2,1);
    if(x_x2){
    }else{
     COPY(x45,1);COPY(x46,1);COPY(x47,1);}
    CPCLS(x1,1);
    {OBJ x49;OBJ x53;OBJ x58;
     x49=_ATreeFilter_4(x1,x46);
     if(ISPRM(x49)){
      x53=__ABUILTIN_5;
     }else{
      x53=__ABUILTIN_3;}
     if(ISTGPRM(x53,1)){
      CPCLS(x1,1);
      COPY(x47,1);
      {OBJ x54;
       x54=_ATreeFilter_4(x1,x47);
       if(ISPRM(x54)){
	CPCLS(x1,1);
	COPY(x45,1);
	x58=(*(OBJ(*)(OBJ,OBJ))METHOD(x1,1))(x1,x45);
       }else{
	if(EXPRD(x54,1)){
	 DSPRD(x54);
	}else{
	 DCPRD(x54,1);}
	x58=__ABUILTIN_3;}}
     }else{
      x58=__ABUILTIN_3;}
     if(ISTGPRM(x58,1)){
      if(x_x2){
       DSPRDF(x2);
      }else{
       FRPRD(x2,1);}
      FRCLS(x1,1);
      FREE(x45,1);
      FREE(x47,1);
      FREE(x49,1);
      *p1=__ATree_7;
     }else{
      {
       if(x_x2){
	RSOME(x2,*p1);FLD1(*p1,2)=x49;
       }else{
	FRPRD(x2,1);PRD1(3,*p1);FLD1(*p1,1)=x45;FLD1(*p1,2)=x49;}
       x2=x47;p1=&FLD1(*p1,3);continue;}}}}}
  break;}
 return r;}

init_ATreeFilter()
{
 static int visited=0; if(visited) return; visited=1;
 init_ATree();
 init_ANat();
 init_AOption();
 init_ASeq();
 init_ARelCmp();
 CLS(2,_ATreeFilter_4,__ATreeFilter_4);
 CLS(2,_ATreeFilter_3,__ATreeFilter_3);
 CLS(2,_ATreeFilter_2,__ATreeFilter_2);}

