

#include "BUILTIN.h"
extern OBJ _AString_2(OBJ,OBJ);extern OBJ __AString_2;
extern OBJ _AString_4(OBJ);extern OBJ __AString_4;
extern OBJ _AString_5(OBJ);extern OBJ __AString_5;
extern OBJ __AString_6;
extern OBJ _AString_12(OBJ);extern OBJ __AString_12;

#include "Char.h"
extern OBJ __ASeq_6;

#include "Nat.h"
extern OBJ _ACompose_4(OBJ,OBJ,OBJ);extern OBJ __ACompose_4;
extern OBJ _AStringFilter_1(OBJ,OBJ);OBJ __AStringFilter_1; /* | */
extern TUP2 _AStringFilter_2(OBJ,OBJ);OBJ __AStringFilter_2; /* partition */
extern OBJ _AStringFilter_3(OBJ,OBJ);OBJ __AStringFilter_3; /* take */
extern OBJ _AStringFilter_4(OBJ,OBJ);OBJ __AStringFilter_4; /* drop */
extern TUP2 _AStringFilter_5(OBJ,OBJ);OBJ __AStringFilter_5; /* split */
extern OBJ _AStringFilter_6(OBJ,OBJ);OBJ __AStringFilter_6; /* split,1 */
extern OBJ _AStringFilter_7(OBJ,OBJ);OBJ __AStringFilter_7; /* components */

extern OBJ _AStringFilter_1(register OBJ x1,register OBJ x2) /* | */
{OBJ r;
 for(;;){
  if(ISPRM(x2)){
   FRCLS(x1,1);
   r=__AString_6;
  }else{
   CPCLS(x1,1);
   CPPRD(x2,1);
   {OBJ x18;OBJ x19;OBJ x20;
    x18=_AString_4(x2);
    x19=_AString_5(x2);
    x20=(*(OBJ(*)(OBJ,OBJ))METHOD(x1,1))(x1,x19);
    if(ISTGPRM(x20,1)){
     {OBJ x21;
      x21=_AStringFilter_1(x1,x18);
      r=_AString_2(x19,x21);}
    }else{
     x2=x18;continue;}}}
  break;}
 return r;}

extern TUP2 _AStringFilter_2(OBJ x1,OBJ x2) /* partition */
{TUP2 r;
 if(ISPRM(x2)){
  FRCLS(x1,1);
  r.c1=__AString_6;r.c2=__AString_6;
 }else{
  CPCLS(x1,1);
  CPPRD(x2,1);
  {OBJ x22;OBJ x23;OBJ x24;TUP2 x26;
   x22=_AString_4(x2);
   x23=_AString_5(x2);
   x24=(*(OBJ(*)(OBJ,OBJ))METHOD(x1,1))(x1,x23);
   x26=_AStringFilter_2(x1,x22);
   if(ISTGPRM(x24,1)){
    r.c2=x26.c2;
    r.c1=_AString_2(x23,x26.c1);
   }else{
    r.c1=x26.c1;
    r.c2=_AString_2(x23,x26.c2);}}}
 return r;}
extern OBJ _AStringFilter_2_c(OBJ x1,OBJ x2) /* partition */
{OBJ r;
 {TUP2 t=_AStringFilter_2(x1,x2);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern OBJ _AStringFilter_3(OBJ x1,OBJ x2) /* take */
{OBJ r;
 if(ISPRM(x2)){
  FRCLS(x1,1);
  r=__AString_6;
 }else{
  CPCLS(x1,1);
  CPPRD(x2,1);
  {OBJ x18;OBJ x19;OBJ x20;
   x18=_AString_4(x2);
   x19=_AString_5(x2);
   x20=(*(OBJ(*)(OBJ,OBJ))METHOD(x1,1))(x1,x19);
   if(ISTGPRM(x20,1)){
    {OBJ x21;
     x21=_AStringFilter_3(x1,x18);
     r=_AString_2(x19,x21);}
   }else{
    FRCLS(x1,1);
    FREE(x18,1);
    r=__AString_6;}}}
 return r;}

extern OBJ _AStringFilter_4(register OBJ x1,register OBJ x2) /* drop */
{OBJ r;
 for(;;){
  if(ISPRM(x2)){
   FRCLS(x1,1);
   r=__AString_6;
  }else{
   CPCLS(x1,1);
   CPPRD(x2,2);
   {OBJ x17;OBJ x18;OBJ x19;
    x17=_AString_4(x2);
    x18=_AString_5(x2);
    x19=(*(OBJ(*)(OBJ,OBJ))METHOD(x1,1))(x1,x18);
    if(ISTGPRM(x19,1)){
     if(EXPRD(x2,1)){
      DSPRD(x2);
     }else{
      DCPRD(x2,1);}
     x2=x17;continue;
    }else{
     FRCLS(x1,1);
     FREE(x17,1);
     r=x2;}}}
  break;}
 return r;}

extern TUP2 _AStringFilter_5(OBJ x1,OBJ x2) /* split */
{TUP2 r;
 if(ISPRM(x2)){
  FRCLS(x1,1);
  r.c1=__AString_6;r.c2=__AString_6;
 }else{
  CPCLS(x1,1);
  CPPRD(x2,2);
  {OBJ x21;OBJ x22;OBJ x23;
   x21=_AString_4(x2);
   x22=_AString_5(x2);
   x23=(*(OBJ(*)(OBJ,OBJ))METHOD(x1,1))(x1,x22);
   if(ISTGPRM(x23,1)){
    if(EXPRD(x2,1)){
     DSPRD(x2);
    }else{
     DCPRD(x2,1);}
    {TUP2 x25;
     x25=_AStringFilter_5(x1,x21);r.c2=x25.c2;
     r.c1=_AString_2(x22,x25.c1);}
   }else{
    FRCLS(x1,1);
    FREE(x21,1);
    r.c1=__AString_6;r.c2=x2;}}}
 return r;}
extern OBJ _AStringFilter_5_c(OBJ x1,OBJ x2) /* split */
{OBJ r;
 {TUP2 t=_AStringFilter_5(x1,x2);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern OBJ _AStringFilter_6(register OBJ x1,register OBJ x2) /* split,1 */
{OBJ r;OBJ* p1=&r;
 for(;;){
  CPCLS(__ABUILTIN_7,1);
  CPCLS(__ACompose_4,1);
  CPCLS(x1,1);
  {OBJ x3;TUP2 x5;
   x3=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ACompose_4,2))(__ACompose_4,__ABUILTIN_7,x1);
   x5=_AStringFilter_5(x3,x2);
   if(ISPRM(x5.c2)){
    FRCLS(x1,1);
    PRD1(2,*p1);FLD1(*p1,1)=x5.c1;FLD1(*p1,2)=__ASeq_6;
   }else{
    {OBJ x20;
     x20=_AString_4(x5.c2);
     PRD1(2,*p1);FLD1(*p1,1)=x5.c1;
     x2=x20;p1=&FLD1(*p1,2);continue;}}}
  break;}
 return r;}

extern OBJ _AStringFilter_7(register OBJ x1,register OBJ x2) /* components */
{OBJ r;OBJ* p1=&r;
 for(;;){
  if(ISPRM(x2)){
   FRCLS(x1,1);
   *p1=__ASeq_6;
  }else{
   CPPRD(x2,1);
   {OBJ x60;
    x60=_AString_4(x2);
    if(ISPRM(x60)){
     FRCLS(x1,1);
     PRD1(2,*p1);FLD1(*p1,1)=x2;FLD1(*p1,2)=__ASeq_6;
    }else{
     CPCLS(x1,1);
     CPPRD(x60,1);
     {OBJ x64;OBJ x65;OBJ x66;
      x64=_AString_5(x2);
      x65=_AString_5(x60);
      x66=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(x1,2))(x1,x64,x65);
      if(ISTGPRM(x66,1)){
       {OBJ x67;
	x67=_AStringFilter_7(x1,x60);
	if(ISPRM(x67)){
	 HLT("Seq at <unknown> : undefined selection rt\'Seq:seq->seq");
	}else{
	 {OBJ x68=FLD1(x67,1);OBJ x69;
	  if(EXPRD(x67,1)){
	   {
	    RSOME(x67,*p1);
	    FLD1(*p1,1)=_AString_2(x64,x68);}
	  }else{
	   x69=FLD1(x67,2);COPY(x68,1);COPY(x69,1);
	   {
	    FRPRD(x67,1);PRD1(2,*p1);FLD1(*p1,2)=x69;
	    FLD1(*p1,1)=_AString_2(x64,x68);}}}}}
      }else{
       {OBJ x73;
	x73=_AString_12(x64);
	PRD1(2,*p1);FLD1(*p1,1)=x73;
	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_AStringFilter()
{
 static int visited=0; if(visited) return; visited=1;
 init_AString();
 init_AChar();
 init_ASeq();
 init_ANat();
 init_AOption();
 init_ACompose();
 CLS(2,_AStringFilter_7,__AStringFilter_7);
 CLS(2,_AStringFilter_6,__AStringFilter_6);
 CLS(2,_AStringFilter_5_c,__AStringFilter_5);
 CLS(2,_AStringFilter_4,__AStringFilter_4);
 CLS(2,_AStringFilter_3,__AStringFilter_3);
 CLS(2,_AStringFilter_2_c,__AStringFilter_2);
 CLS(2,_AStringFilter_1,__AStringFilter_1);
 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);}

