

#include "BUILTIN.h"
extern OBJ _ASeq_4(OBJ);extern OBJ __ASeq_4;
extern OBJ _ASeq_5(OBJ);extern OBJ __ASeq_5;
extern OBJ __ASeq_6;
extern OBJ _ASeq_13(OBJ);extern OBJ __ASeq_13;
extern OBJ _ASeq_23(OBJ,OBJ);extern OBJ __ASeq_23;
extern OBJ _ASeq_26(OBJ,OBJ);extern OBJ __ASeq_26;

#include "Nat.h"
extern TUP2 _ASeqFilter_8(OBJ,OBJ);extern OBJ __ASeqFilter_8;
extern OBJ _ASeqMap_3(OBJ,OBJ);extern OBJ __ASeqMap_3;
extern OBJ _ASeqReduce_3(OBJ,OBJ,OBJ);extern OBJ __ASeqReduce_3;
extern OBJ _ASeqOfSeq_2(OBJ);OBJ __ASeqOfSeq_2; /* flat */
extern OBJ _ASeqOfSeq_3(OBJ,OBJ);OBJ __ASeqOfSeq_3; /* partition */
extern OBJ _ASeqOfSeq_4(OBJ);OBJ __ASeqOfSeq_4; /* inits */
extern OBJ _ASeqOfSeq_5(OBJ);OBJ __ASeqOfSeq_5; /* tails */
extern OBJ _ASeqOfSeq_6(OBJ);OBJ __ASeqOfSeq_6; /* permutations */
extern OBJ _ASeqOfSeq_7(OBJ);OBJ __ASeqOfSeq_7; /* transpose */
extern OBJ _ASeqOfSeq_8(OBJ);OBJ __ASeqOfSeq_8; /* combinations */
extern OBJ _ASeqOfSeq_9(OBJ,OBJ);OBJ __ASeqOfSeq_9; /* insertAll */
extern OBJ _ASeqOfSeq_10(OBJ,OBJ,OBJ,OBJ);OBJ __ASeqOfSeq_10; /* insertAll,1 */
extern OBJ _ASeqOfSeq_11(OBJ,OBJ,OBJ);OBJ __ASeqOfSeq_11; /* partition'11 */
OBJ __ASeqOfSeq_12; /* inits'12 */
extern OBJ _ASeqOfSeq_13(OBJ,OBJ);OBJ __ASeqOfSeq_13; /* inits'13 */
OBJ __ASeqOfSeq_14; /* tails'14 */
OBJ __ASeqOfSeq_15; /* permutations'15 */
extern OBJ _ASeqOfSeq_16(OBJ,OBJ,OBJ);OBJ __ASeqOfSeq_16; /* permutations'16 */
extern OBJ _ASeqOfSeq_17(OBJ,OBJ);OBJ __ASeqOfSeq_17; /* permutations'17 */
extern OBJ _ASeqOfSeq_18(OBJ,OBJ);OBJ __ASeqOfSeq_18; /* combinations'18 */
extern OBJ _ASeqOfSeq_19(OBJ,OBJ);OBJ __ASeqOfSeq_19; /* combinations'19 */

extern OBJ _ASeqOfSeq_2(OBJ x1) /* flat */
{OBJ r;
 if(ISPRM(x1)){
  r=__ASeq_6;
 }else{
  {OBJ x17=FLD1(x1,1);OBJ x18=FLD1(x1,2);
   if(EXPRD(x1,1)){
    DSPRDF(x1);
   }else{
    COPY(x17,1);COPY(x18,1);
    FRPRD(x1,1);}
   {OBJ x20;
    x20=_ASeqOfSeq_2(x18);
    r=_ASeq_26(x17,x20);}}}
 return r;}

extern OBJ _ASeqOfSeq_3(OBJ x1,OBJ x2) /* partition */
{OBJ r;
 if(ISPRM(x2)){
  FRCLS(x1,1);
  r=__ASeq_6;
 }else{
  {OBJ x48=FLD1(x2,1);OBJ x49=FLD1(x2,2);FLAG x_x2=EXPRD(x2,1);
   if(x_x2){
    COPY(x48,1);
   }else{
    COPY(x48,2);COPY(x49,1);}
   CPCLS(x1,1);
   CPCLS(__ASeqOfSeq_11,1);
   {OBJ x51;OBJ x52;TUP2 x54;
    x51=_ASeqOfSeq_3(x1,x49);
    x52=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ASeqOfSeq_11,2))(__ASeqOfSeq_11,x1,x48);
    x54=_ASeqFilter_8(x52,x51);
    if(ISPRM(x54.c2)){
     {OBJ x56;
      if(x_x2){
       RSOME(x2,x56);FLD1(x56,2)=__ASeq_6;
      }else{
       FRPRD(x2,1);PRD1(2,x56);FLD1(x56,1)=x48;FLD1(x56,2)=__ASeq_6;}
      PRD1(2,r);FLD1(r,1)=x56;FLD1(r,2)=x54.c1;}
    }else{
     {OBJ x57=FLD1(x54.c2,1);OBJ x58;FLAG x_x54_c2=EXPRD(x54.c2,1);
      if(x_x54_c2){
      }else{
       x58=FLD1(x54.c2,2);COPY(x57,1);COPY(x58,1);}
      {OBJ x60;OBJ x61;
       if(x_x2){
	RSOME(x2,x60);FLD1(x60,2)=x57;
       }else{
	FRPRD(x2,1);PRD1(2,x60);FLD1(x60,1)=x48;FLD1(x60,2)=x57;}
       if(x_x54_c2){
	RSOME(x54.c2,x61);FLD1(x61,1)=x60;
       }else{
	FRPRD(x54.c2,1);PRD1(2,x61);FLD1(x61,1)=x60;FLD1(x61,2)=x58;}
       r=_ASeq_26(x54.c1,x61);}}}}}}
 return r;}

extern OBJ _ASeqOfSeq_4(OBJ x1) /* inits */
{OBJ r;
 if(ISPRM(x1)){
  COPY(__ASeqOfSeq_12,1);
  r=__ASeqOfSeq_12;
 }else{
  {OBJ x12=FLD1(x1,2);
   COPY(x12,1);
   CPCLS(__ASeqOfSeq_13,1);
   {OBJ x13;OBJ x14;
    x13=_ASeqOfSeq_4(x12);
    x14=(*(OBJ(*)(OBJ,OBJ))METHOD(__ASeqOfSeq_13,1))(__ASeqOfSeq_13,x1);
    PRD1(2,r);FLD1(r,1)=__ASeq_6;
    FLD1(r,2)=_ASeqMap_3(x14,x13);}}}
 return r;}

extern OBJ _ASeqOfSeq_5(register OBJ x1) /* tails */
{OBJ r;OBJ* p1=&r;
 for(;;){
  if(ISPRM(x1)){
   COPY(__ASeqOfSeq_14,1);
   *p1=__ASeqOfSeq_14;
  }else{
   {OBJ x10=FLD1(x1,2);
    COPY(x10,1);
    {
     PRD1(2,*p1);FLD1(*p1,1)=x1;
     x1=x10;p1=&FLD1(*p1,2);continue;}}}
  break;}
 return r;}

extern OBJ _ASeqOfSeq_6(OBJ x1) /* permutations */
{OBJ r;
 if(ISPRM(x1)){
  r=__ASeq_6;
 }else{
  COPY(__ASeqOfSeq_15,1);
  CPCLS(__ASeqOfSeq_17,1);
  r=_ASeqReduce_3(__ASeqOfSeq_17,__ASeqOfSeq_15,x1);}
 return r;}

extern OBJ _ASeqOfSeq_7(register OBJ x1) /* transpose */
{OBJ r;OBJ* p1=&r;
 for(;;){
  if(ISPRM(x1)){
   *p1=__ASeq_6;
  }else{
   {OBJ x19=FLD1(x1,1);
    COPY(x19,1);
    if(ISPRM(x19)){
     if(EXPRD(x1,1)){
      DSPRD(x1);
     }else{
      DCPRD(x1,1);}
     *p1=__ASeq_6;
    }else{
     CPPRD(x1,1);
     CPCLS(__ASeq_4,1);
     CPCLS(__ASeq_5,1);
     {OBJ x23;OBJ x24;
      x23=_ASeqMap_3(__ASeq_5,x1);
      x24=_ASeqMap_3(__ASeq_4,x1);
      if(EXPRD(x19,1)){
       RSOME(x19,*p1);FREE(FLD1(*p1,1),1);FLD1(*p1,1)=x23;FREE(FLD1(*p1,2),1);
      }else{
       DCPRD(x19,1);PRD1(2,*p1);FLD1(*p1,1)=x23;}
      x1=x24;p1=&FLD1(*p1,2);continue;}}}}
  break;}
 return r;}

extern OBJ _ASeqOfSeq_8(OBJ x1) /* combinations */
{OBJ r;
 if(ISPRM(x1)){
  r=__ASeq_6;
 }else{
  {OBJ x28=FLD1(x1,1);OBJ x29=FLD1(x1,2);
   if(EXPRD(x1,1)){
    DSPRDF(x1);
   }else{
    COPY(x28,1);COPY(x29,1);
    FRPRD(x1,1);}
   if(ISPRM(x29)){
    CPCLS(__ASeq_13,1);
    r=_ASeqMap_3(__ASeq_13,x28);
   }else{
    CPCLS(__ASeqOfSeq_19,1);
    CPCLS(__ASeq_26,1);
    {OBJ x33;OBJ x34;
     x33=(*(OBJ(*)(OBJ,OBJ))METHOD(__ASeqOfSeq_19,1))(__ASeqOfSeq_19,x29);
     x34=_ASeqMap_3(x33,x28);
     r=_ASeqReduce_3(__ASeq_26,__ASeq_6,x34);}}}}
 return r;}

extern OBJ _ASeqOfSeq_9(OBJ x1,OBJ x2) /* insertAll */
{OBJ r;
 r=_ASeqOfSeq_10(x1,__ASeq_6,x2,__ASeq_6);
 return r;}

extern OBJ _ASeqOfSeq_10(register OBJ x1,register OBJ x2,register OBJ x3,register OBJ x4) /* insertAll,1 */
{OBJ r;
 for(;;){
  if(ISPRM(x3)){
   {
    PRD1(2,r);FLD1(r,2)=x4;
    FLD1(r,1)=_ASeq_23(x2,x1);}
  }else{
   {OBJ x25=FLD1(x3,1);OBJ x26=FLD1(x3,2);
    COPY(x25,1);COPY(x26,1);
    COPY(x1,1);
    COPY(x2,1);
    {OBJ x27;OBJ x29;OBJ x30;OBJ x31;
     PRD1(2,x27);FLD1(x27,1)=x1;FLD1(x27,2)=x3;
     x29=_ASeq_26(x2,x27);
     x30=_ASeq_23(x2,x25);
     PRD1(2,x31);FLD1(x31,1)=x29;FLD1(x31,2)=x4;
     x2=x30;x3=x26;x4=x31;continue;}}}
  break;}
 return r;}

extern OBJ _ASeqOfSeq_11(OBJ x1,OBJ x2,OBJ x3) /* partition'11 */
{OBJ r;
 {OBJ x6;OBJ x7;
  if(ISPRM(x3)){
   HLT("Seq at <unknown> : undefined selection ft\'Seq:seq->data");
  }else{
   {OBJ x4=FLD1(x3,1);
    if(EXPRD(x3,1)){
     x6=x4;
     FREE(FLD1(x3,2),1);DSPRDF(x3);
    }else{
     COPY(x4,1);
     x6=x4;
     FRPRD(x3,1);}}}
  x7=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(x1,2))(x1,x6,x2);
  if(ISTGPRM(x7,1)){
   r=__ABUILTIN_3;
  }else{
   r=__ABUILTIN_5;}}
 return r;}

extern OBJ _ASeqOfSeq_13(OBJ x1,OBJ x2) /* inits'13 */
{OBJ r;
 {OBJ x5;
  if(ISPRM(x1)){
   HLT("Seq at <unknown> : undefined selection ft\'Seq:seq->data");
  }else{
   {OBJ x3=FLD1(x1,1);
    if(EXPRD(x1,1)){
     x5=x3;
     FREE(FLD1(x1,2),1);DSPRDF(x1);
    }else{
     COPY(x3,1);
     x5=x3;
     FRPRD(x1,1);}}}
  PRD1(2,r);FLD1(r,1)=x5;FLD1(r,2)=x2;}
 return r;}

extern OBJ _ASeqOfSeq_16(OBJ x1,OBJ x2,OBJ x3) /* permutations'16 */
{OBJ r;
 {OBJ x4;
  x4=_ASeqOfSeq_10(x1,__ASeq_6,x2,__ASeq_6);
  r=_ASeq_26(x4,x3);}
 return r;}

extern OBJ _ASeqOfSeq_17(OBJ x1,OBJ x2) /* permutations'17 */
{OBJ r;
 CPCLS(__ASeqOfSeq_16,1);
 {OBJ x3;
  x3=(*(OBJ(*)(OBJ,OBJ))METHOD(__ASeqOfSeq_16,1))(__ASeqOfSeq_16,x1);
  r=_ASeqReduce_3(x3,__ASeq_6,x2);}
 return r;}

extern OBJ _ASeqOfSeq_18(OBJ x1,OBJ x2) /* combinations'18 */
{OBJ r;
 PRD1(2,r);FLD1(r,1)=x1;FLD1(r,2)=x2;
 return r;}

extern OBJ _ASeqOfSeq_19(OBJ x1,OBJ x2) /* combinations'19 */
{OBJ r;
 CPCLS(__ASeqOfSeq_18,1);
 {OBJ x3;OBJ x4;
  x3=(*(OBJ(*)(OBJ,OBJ))METHOD(__ASeqOfSeq_18,1))(__ASeqOfSeq_18,x2);
  x4=_ASeqOfSeq_8(x1);
  r=_ASeqMap_3(x3,x4);}
 return r;}




init_ASeqOfSeq()
{
 static int visited=0; if(visited) return; visited=1;
 init_ASeq();
 init_ANat();
 init_AOption();
 init_ASeqFilter();
 init_ASeqMap();
 init_ASeqReduce();
 CLS(2,_ASeqOfSeq_19,__ASeqOfSeq_19);
 CLS(2,_ASeqOfSeq_18,__ASeqOfSeq_18);
 CLS(2,_ASeqOfSeq_17,__ASeqOfSeq_17);
 CLS(3,_ASeqOfSeq_16,__ASeqOfSeq_16);
 CLS(2,_ASeqOfSeq_13,__ASeqOfSeq_13);
 CLS(3,_ASeqOfSeq_11,__ASeqOfSeq_11);
 CLS(4,_ASeqOfSeq_10,__ASeqOfSeq_10);
 CLS(2,_ASeqOfSeq_9,__ASeqOfSeq_9);
 CLS(1,_ASeqOfSeq_8,__ASeqOfSeq_8);
 CLS(1,_ASeqOfSeq_7,__ASeqOfSeq_7);
 CLS(1,_ASeqOfSeq_6,__ASeqOfSeq_6);
 CLS(1,_ASeqOfSeq_5,__ASeqOfSeq_5);
 CLS(1,_ASeqOfSeq_4,__ASeqOfSeq_4);
 CLS(2,_ASeqOfSeq_3,__ASeqOfSeq_3);
 CLS(1,_ASeqOfSeq_2,__ASeqOfSeq_2);
 PRD1F(2,__ASeqOfSeq_12);FLD1(__ASeqOfSeq_12,1)=__ASeq_6;FLD1(__ASeqOfSeq_12,2)=__ASeq_6;
 PRD1F(2,__ASeqOfSeq_14);FLD1(__ASeqOfSeq_14,1)=__ASeq_6;FLD1(__ASeqOfSeq_14,2)=__ASeq_6;
 PRD1F(2,__ASeqOfSeq_15);FLD1(__ASeqOfSeq_15,1)=__ASeq_6;FLD1(__ASeqOfSeq_15,2)=__ASeq_6;}

