

#include "BUILTIN.h"
extern OBJ __ASeq_6;

#include "Nat.h"
extern OBJ _ASeqFilter_2(OBJ,OBJ);OBJ __ASeqFilter_2; /* | */
extern OBJ _ASeqFilter_3(OBJ,OBJ);OBJ __ASeqFilter_3; /* filter */
extern OBJ _ASeqFilter_4(OBJ,OBJ);OBJ __ASeqFilter_4; /* filter,1 */
extern TUP2 _ASeqFilter_5(OBJ,OBJ);OBJ __ASeqFilter_5; /* partition */
extern OBJ _ASeqFilter_6(OBJ,OBJ);OBJ __ASeqFilter_6; /* take */
extern OBJ _ASeqFilter_7(OBJ,OBJ);OBJ __ASeqFilter_7; /* drop */
extern TUP2 _ASeqFilter_8(OBJ,OBJ);OBJ __ASeqFilter_8; /* split */
extern OBJ _ASeqFilter_9(OBJ,OBJ);OBJ __ASeqFilter_9; /* components */

extern OBJ _ASeqFilter_2(register OBJ x1,register OBJ x2) /* | */
{OBJ r;OBJ* p1=&r;
 for(;;){
  if(ISPRM(x2)){
   FRCLS(x1,1);
   *p1=__ASeq_6;
  }else{
   {OBJ x22=FLD1(x2,1);OBJ x23=FLD1(x2,2);FLAG x_x2=EXPRD(x2,1);
    if(x_x2){
     COPY(x22,1);
    }else{
     COPY(x22,2);COPY(x23,1);}
    CPCLS(x1,1);
    {OBJ x25;
     x25=(*(OBJ(*)(OBJ,OBJ))METHOD(x1,1))(x1,x22);
     if(ISTGPRM(x25,1)){
      {
       if(x_x2){
	RSOME(x2,*p1);
       }else{
	FRPRD(x2,1);PRD1(2,*p1);FLD1(*p1,1)=x22;}
       x2=x23;p1=&FLD1(*p1,2);continue;}
     }else{
      if(x_x2){
       DSPRDF(x2);
      }else{
       FRPRD(x2,1);}
      FREE(x22,1);
      x2=x23;continue;}}}}
  break;}
 return r;}

extern OBJ _ASeqFilter_3(OBJ x1,OBJ x2) /* filter */
{OBJ r;
 r=_ASeqFilter_2(x1,x2);
 return r;}

extern OBJ _ASeqFilter_4(OBJ x1,OBJ x2) /* filter,1 */
{OBJ r;
 r=_ASeqFilter_2(x1,x2);
 return r;}

extern TUP2 _ASeqFilter_5(register OBJ x1,register OBJ x2) /* partition */
{TUP2 r;OBJ* p1=&r.c1;OBJ* p2=&r.c2;
 for(;;){
  if(ISPRM(x2)){
   FRCLS(x1,1);
   *p1=__ASeq_6;*p2=__ASeq_6;
  }else{
   {OBJ x29=FLD1(x2,1);OBJ x30=FLD1(x2,2);FLAG x_x2=EXPRD(x2,1);
    if(x_x2){
     COPY(x29,1);
    }else{
     COPY(x29,2);COPY(x30,1);}
    CPCLS(x1,1);
    {OBJ x32;
     x32=(*(OBJ(*)(OBJ,OBJ))METHOD(x1,1))(x1,x29);
     if(ISTGPRM(x32,1)){
      {
       if(x_x2){
	RSOME(x2,*p1);
       }else{
	FRPRD(x2,1);PRD1(2,*p1);FLD1(*p1,1)=x29;}
       x2=x30;p1=&FLD1(*p1,2);continue;}
     }else{
      {
       if(x_x2){
	RSOME(x2,*p2);
       }else{
	FRPRD(x2,1);PRD1(2,*p2);FLD1(*p2,1)=x29;}
       x2=x30;p2=&FLD1(*p2,2);continue;}}}}}
  break;}
 return r;}
extern OBJ _ASeqFilter_5_c(OBJ x1,OBJ x2) /* partition */
{OBJ r;
 {TUP2 t=_ASeqFilter_5(x1,x2);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern OBJ _ASeqFilter_6(register OBJ x1,register OBJ x2) /* take */
{OBJ r;OBJ* p1=&r;
 for(;;){
  if(ISPRM(x2)){
   FRCLS(x1,1);
   *p1=__ASeq_6;
  }else{
   {OBJ x22=FLD1(x2,1);OBJ x23=FLD1(x2,2);FLAG x_x2=EXPRD(x2,1);
    if(x_x2){
     COPY(x22,1);
    }else{
     COPY(x22,2);COPY(x23,1);}
    CPCLS(x1,1);
    {OBJ x25;
     x25=(*(OBJ(*)(OBJ,OBJ))METHOD(x1,1))(x1,x22);
     if(ISTGPRM(x25,1)){
      {
       if(x_x2){
	RSOME(x2,*p1);
       }else{
	FRPRD(x2,1);PRD1(2,*p1);FLD1(*p1,1)=x22;}
       x2=x23;p1=&FLD1(*p1,2);continue;}
     }else{
      if(x_x2){
       DSPRDF(x2);
      }else{
       FRPRD(x2,1);}
      FRCLS(x1,1);
      FREE(x22,1);
      FREE(x23,1);
      *p1=__ASeq_6;}}}}
  break;}
 return r;}

extern OBJ _ASeqFilter_7(register OBJ x1,register OBJ x2) /* drop */
{OBJ r;
 for(;;){
  if(ISPRM(x2)){
   FRCLS(x1,1);
   r=__ASeq_6;
  }else{
   {OBJ x21=FLD1(x2,1);OBJ x22=FLD1(x2,2);
    COPY(x21,1);COPY(x22,1);
    CPCLS(x1,1);
    {OBJ x24;
     x24=(*(OBJ(*)(OBJ,OBJ))METHOD(x1,1))(x1,x21);
     if(ISTGPRM(x24,1)){
      if(EXPRD(x2,1)){
       DSPRD(x2);
      }else{
       DCPRD(x2,1);}
      x2=x22;continue;
     }else{
      FRCLS(x1,1);
      FREE(x22,1);
      r=x2;}}}}
  break;}
 return r;}

extern TUP2 _ASeqFilter_8(register OBJ x1,register OBJ x2) /* split */
{TUP2 r;OBJ* p1=&r.c1;OBJ* p2=&r.c2;
 for(;;){
  if(ISPRM(x2)){
   FRCLS(x1,1);
   *p1=__ASeq_6;*p2=__ASeq_6;
  }else{
   {OBJ x25=FLD1(x2,1);OBJ x26=FLD1(x2,2);
    COPY(x25,2);COPY(x26,1);
    CPCLS(x1,1);
    {OBJ x28;
     x28=(*(OBJ(*)(OBJ,OBJ))METHOD(x1,1))(x1,x25);
     if(ISTGPRM(x28,1)){
      if(EXPRD(x2,1)){
       DSPRD(x2);
      }else{
       DCPRD(x2,1);}
      {
       PRD1(2,*p1);FLD1(*p1,1)=x25;
       x2=x26;p1=&FLD1(*p1,2);continue;}
     }else{
      FRCLS(x1,1);
      FREE(x25,1);
      FREE(x26,1);
      *p1=__ASeq_6;*p2=x2;}}}}
  break;}
 return r;}
extern OBJ _ASeqFilter_8_c(OBJ x1,OBJ x2) /* split */
{OBJ r;
 {TUP2 t=_ASeqFilter_8(x1,x2);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern OBJ _ASeqFilter_9(register OBJ x1,register OBJ x2) /* components */
{OBJ r;OBJ* p1=&r;
 for(;;){
  if(ISPRM(x2)){
   FRCLS(x1,1);
   *p1=__ASeq_6;
  }else{
   {OBJ x59=FLD1(x2,1);OBJ x60=FLD1(x2,2);
    COPY(x59,1);COPY(x60,1);
    if(ISPRM(x60)){
     FRCLS(x1,1);
     FREE(x59,1);
     PRD1(2,*p1);FLD1(*p1,1)=x2;FLD1(*p1,2)=__ASeq_6;
    }else{
     {OBJ x61=FLD1(x60,1);
      COPY(x61,1);
      if(EXPRD(x2,1)){
       DSPRD(x2);
      }else{
       DCPRD(x2,1);}
      CPCLS(x1,1);
      COPY(x59,1);
      {OBJ x63;
       x63=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(x1,2))(x1,x59,x61);
       if(ISTGPRM(x63,1)){
	{OBJ x64;
	 x64=_ASeqFilter_9(x1,x60);
	 if(ISPRM(x64)){
	  HLT("Seq at <unknown> : undefined selection rt\'Seq:seq->seq");
	 }else{
	  {OBJ x65=FLD1(x64,1);OBJ x66=FLD1(x64,2);FLAG x_x64=EXPRD(x64,1);
	   if(x_x64){
	   }else{
	    COPY(x65,1);COPY(x66,1);}
	   {OBJ x68;
	    if(x_x64){
	     RSOME(x64,x68);FLD1(x68,1)=x59;FLD1(x68,2)=x65;
	    }else{
	     FRPRD(x64,1);PRD1(2,x68);FLD1(x68,1)=x59;FLD1(x68,2)=x65;}
	    PRD1(2,*p1);FLD1(*p1,1)=x68;FLD1(*p1,2)=x66;}}}}
       }else{
	{OBJ x70;
	 PRD1(2,x70);FLD1(x70,1)=x59;FLD1(x70,2)=__ASeq_6;
	 PRD1(2,*p1);FLD1(*p1,1)=x70;
	 x2=x60;p1=&FLD1(*p1,2);continue;}}}}}}}
  break;}
 return r;}

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

static OBJ _mt_2_1_1(OBJ t,OBJ t1) 
{OBJ r;
 if(EXCLS(t)){
  DSCLSF(t);
 }else{
  COPY(FLDCLS(t,1),1);
  DCCLS(t,1);}
 r=(*(OBJ(*)(OBJ,OBJ))ENTRY(t))(FLDCLS(t,1),t1);
 return r;}
static OBJ _mt_2_1_1_l(OBJ t,OBJ t1) 
{OBJ r;
 r=(*(OBJ(*)(OBJ,OBJ))ENTRY(t))(FLDCLS(t,1),t1);
 if(EXCLS(t)){
  DSCLSF(t);
 }else{
  DCCLS(t,1);
  FLDCLS(t,1)=NIL;
  COPY(r,1);LZYCLS(t,r);}
 return r;}

init_ASeqFilter()
{
 static int visited=0; if(visited) return; visited=1;
 init_ASeq();
 init_ANat();
 init_AOption();
 CLS(2,_ASeqFilter_9,__ASeqFilter_9);
 CLS(2,_ASeqFilter_8_c,__ASeqFilter_8);
 CLS(2,_ASeqFilter_7,__ASeqFilter_7);
 CLS(2,_ASeqFilter_6,__ASeqFilter_6);
 CLS(2,_ASeqFilter_5_c,__ASeqFilter_5);
 CLS(2,_ASeqFilter_4,__ASeqFilter_4);
 CLS(2,_ASeqFilter_3,__ASeqFilter_3);
 CLS(2,_ASeqFilter_2,__ASeqFilter_2);
 MTH(2,0,1,_mt_2_0_1);LZYMTH(2,0,1,_mt_2_0_1);
 MTH(2,1,1,_mt_2_1_1);LZYMTH(2,1,1,_mt_2_1_1_l);}

