

#include "BUILTIN.h"
extern OBJ _ASet_39(OBJ,OBJ,OBJ);extern OBJ __ASet_39;
extern OBJ __ASeq_6;

#include "Nat.h"

#include "Int.h"
extern OBJ _ASeqReduce_3(OBJ,OBJ,OBJ);extern OBJ __ASeqReduce_3;
extern OBJ _ASeqReduce_4(OBJ,OBJ,OBJ);extern OBJ __ASeqReduce_4;
extern OBJ _AMapByBST_16(OBJ,OBJ,OBJ);extern OBJ __AMapByBST_16;
extern OBJ _AMapByBST_32(OBJ,OBJ,OBJ,OBJ);extern OBJ __AMapByBST_32;
extern OBJ _AMapByBSTReduce_6(OBJ,OBJ,OBJ,OBJ);extern OBJ __AMapByBSTReduce_6;

#include "Array.h"
extern OBJ _AArrayReduce_5(OBJ,OBJ,OBJ);extern OBJ __AArrayReduce_5;
extern OBJ __ATree_7;

#include "Char.h"
extern OBJ _ASetTopSort_3(OBJ,OBJ,OBJ);OBJ __ASetTopSort_3; /* topSort */
extern OBJ _ASetTopSort_5(OBJ);OBJ __ASetTopSort_5; /* dummy */
extern OBJ _ASetTopSort_6(OBJ,OBJ);OBJ __ASetTopSort_6; /* dummy? */
extern OBJ _ASetTopSort_7(OBJ,OBJ);OBJ __ASetTopSort_7; /* refCnt */
extern OBJ _ASetTopSort_8(OBJ);OBJ __ASetTopSort_8; /* entry */
extern OBJ _ASetTopSort_9(OBJ,OBJ);OBJ __ASetTopSort_9; /* entry? */
extern OBJ _ASetTopSort_10(OBJ,OBJ);OBJ __ASetTopSort_10; /* data */
extern OBJ _ASetTopSort_11(OBJ,OBJ);OBJ __ASetTopSort_11; /* next */
extern OBJ _ASetTopSort_13(OBJ);OBJ __ASetTopSort_13; /* minus1 */
extern TUP2 _ASetTopSort_14(OBJ,OBJ,OBJ,OBJ);OBJ __ASetTopSort_14; /* encode */
extern OBJ _ASetTopSort_15(OBJ,OBJ,OBJ,OBJ);OBJ __ASetTopSort_15; /* decode */
extern OBJ _ASetTopSort_16(OBJ,OBJ);OBJ __ASetTopSort_16; /* start */
extern OBJ _ASetTopSort_17(OBJ,OBJ,OBJ);OBJ __ASetTopSort_17; /* tsort */
extern TUP2 _ASetTopSort_18(OBJ,OBJ,OBJ,OBJ);OBJ __ASetTopSort_18; /* decrNext */
extern TUP2 _ASetTopSort_19(OBJ,OBJ,OBJ,OBJ);OBJ __ASetTopSort_19; /* decr */
extern OBJ _ASetTopSort_20(OBJ,OBJ,OBJ);OBJ __ASetTopSort_20; /* entry,1 */
extern OBJ _ASetTopSort_21(OBJ);OBJ __ASetTopSort_21; /* dummy,1 */
OBJ __ASetTopSort_22; /* minus1'22 */
extern OBJ _ASetTopSort_23(OBJ);OBJ __ASetTopSort_23; /* minus1'23 */
extern OBJ _ASetTopSort_24(OBJ);OBJ __ASetTopSort_24; /* decr'24 */
extern OBJ _ASetTopSort_25(OBJ,OBJ);OBJ __ASetTopSort_25; /* decr'25 */
extern OBJ _ASetTopSort_26(OBJ,OBJ,OBJ);OBJ __ASetTopSort_26; /* decr'26 */
OBJ __ASetTopSort_27; /* start'27 */
extern OBJ _ASetTopSort_28(OBJ,OBJ,OBJ);OBJ __ASetTopSort_28; /* start'28 */
extern OBJ _ASetTopSort_29(OBJ);OBJ __ASetTopSort_29; /* start'29 */
extern OBJ _ASetTopSort_30(OBJ,OBJ);OBJ __ASetTopSort_30; /* start'30 */
extern OBJ _ASetTopSort_31(OBJ,OBJ,OBJ);OBJ __ASetTopSort_31; /* start'31 */
extern OBJ _ASetTopSort_32(OBJ,OBJ);OBJ __ASetTopSort_32; /* topSort'32 */
extern OBJ _ASetTopSort_33(OBJ,OBJ,OBJ,OBJ);OBJ __ASetTopSort_33; /* topSort'33 */
extern OBJ _ASetTopSort_34(OBJ,OBJ,OBJ,OBJ);OBJ __ASetTopSort_34; /* topSort'34 */
extern OBJ _ASetTopSort_35(OBJ,OBJ);OBJ __ASetTopSort_35; /* topSort'35 */
extern OBJ _ASetTopSort_36(OBJ,OBJ,OBJ);OBJ __ASetTopSort_36; /* topSort'36 */
extern OBJ _ASetTopSort_37(OBJ,OBJ,OBJ,OBJ,OBJ,OBJ);OBJ __ASetTopSort_37; /* topSort'37 */

extern OBJ _ASetTopSort_3(OBJ x1,OBJ x2,OBJ x3) /* topSort */
{OBJ r;
 CPCLS(__ASetTopSort_32,1);
 CPCLS(__ASetTopSort_37,1);
 CPCLS(x1,4);
 {OBJ x5;TUP2 x6;OBJ x8;OBJ x9;OBJ x10;
  x5=(*(OBJ(*)(OBJ,OBJ))METHOD(__ASetTopSort_32,1))(__ASetTopSort_32,x1);
  x6=_ASetTopSort_14(x1,x3,__ATree_7,__ANat_5);
  COPY(x6.c1,1);
  AArray_4(x6.c2,x5,x8);
  x9=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ))METHOD(__ASetTopSort_37,3))(__ASetTopSort_37,x1,x2,x6.c1);
  x10=_AMapByBSTReduce_6(x1,x9,x8,x6.c1);
  r=_ASetTopSort_16(x1,x10);}
 return r;}

extern OBJ _ASetTopSort_5(OBJ x1) /* dummy */
{OBJ r;
 CPPRD(__ASetTopSort_21,1);
 FRCLS(x1,1);
 r=__ASetTopSort_21;
 return r;}

extern OBJ _ASetTopSort_6(OBJ x1,OBJ x2) /* dummy? */
{OBJ r;
 FRCLS(x1,1);
 if(ISTGPRD(x2,1)){
  if(EXPRD(x2,1)){
   DSPRDF(x2);
  }else{
   DCPRD(x2,1);}
  r=__ABUILTIN_5;
 }else{
  if(EXPRD(x2,1)){
   DSPRD(x2);
  }else{
   DCPRD(x2,1);}
  r=__ABUILTIN_3;}
 return r;}

extern OBJ _ASetTopSort_7(OBJ x1,OBJ x2) /* refCnt */
{OBJ r;
 FRCLS(x1,1);
 {OBJ x3=FLD(x2,1);
  if(EXPRD(x2,1)){
   r=x3;
   DSPRD(x2);
  }else{
   r=x3;
   FRPRD(x2,1);}}
 return r;}

extern OBJ _ASetTopSort_8(OBJ x1) /* entry */
{OBJ r;
 CPPRD(__ASetTopSort_20,1);
 FRCLS(x1,1);
 r=__ASetTopSort_20;
 return r;}

extern OBJ _ASetTopSort_9(OBJ x1,OBJ x2) /* entry? */
{OBJ r;
 FRCLS(x1,1);
 if(ISTGPRD(x2,0)){
  if(EXPRD(x2,1)){
   DSPRD(x2);
  }else{
   DCPRD(x2,1);}
  r=__ABUILTIN_5;
 }else{
  if(EXPRD(x2,1)){
   DSPRDF(x2);
  }else{
   DCPRD(x2,1);}
  r=__ABUILTIN_3;}
 return r;}

extern OBJ _ASetTopSort_10(OBJ x1,OBJ x2) /* data */
{OBJ r;
 FRCLS(x1,1);
 if(ISTGPRD(x2,0)){
  {OBJ x5=FLD(x2,3);
   if(EXPRD(x2,1)){
    r=x5;
    FREE(FLD(x2,2),1);DSPRDF(x2);
   }else{
    COPY(x5,1);
    r=x5;
    FRPRD(x2,1);}}
 }else{
  HLT("SetTopSort at <21,50-53> : undefined selection data\'SetTopSort:entry->data");}
 return r;}

extern OBJ _ASetTopSort_11(OBJ x1,OBJ x2) /* next */
{OBJ r;
 FRCLS(x1,1);
 if(ISTGPRD(x2,0)){
  {OBJ x4=FLD(x2,2);
   if(EXPRD(x2,1)){
    r=x4;
    FREE(FLD(x2,3),1);DSPRDF(x2);
   }else{
    COPY(x4,1);
    r=x4;
    FRPRD(x2,1);}}
 }else{
  HLT("SetTopSort at <21,34-37> : undefined selection next\'SetTopSort:entry->seq");}
 return r;}

extern OBJ _ASetTopSort_13(OBJ x1) /* minus1 */
{OBJ r;
 CPCLS(__ASetTopSort_23,1);
 FRCLS(x1,1);
 r=(*(OBJ(*)(OBJ,OBJ))METHOD(__ASetTopSort_23,1))(__ASetTopSort_23,__ABUILTIN_20);
 return r;}

extern TUP2 _ASetTopSort_14(register OBJ x1,register OBJ x2,register OBJ x3,register OBJ x4) /* encode */
{TUP2 r;
 for(;;){
  if(ISPRM(x2)){
   FRCLS(x1,1);
   r.c1=x3;r.c2=x4;
  }else{
   {OBJ x24=FLD1(x2,1);OBJ x25=FLD1(x2,2);
    if(EXPRD(x2,1)){
     DSPRDF(x2);
    }else{
     COPY(x24,1);COPY(x25,1);
     FRPRD(x2,1);}
    CPCLS(x1,1);
    {OBJ x26;OBJ x28;
     ANat_2(x4,x26);
     x28=_AMapByBST_32(x1,x24,x4,x3);
     x2=x25;x3=x28;x4=x26;continue;}}}
  break;}
 return r;}
extern OBJ _ASetTopSort_14_c(OBJ x1,OBJ x2,OBJ x3,OBJ x4) /* encode */
{OBJ r;
 {TUP2 t=_ASetTopSort_14(x1,x2,x3,x4);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern OBJ _ASetTopSort_15(OBJ x1,OBJ x2,OBJ x3,OBJ x4) /* decode */
{OBJ r;
 {OBJ x5;OBJ x11;
  AArray_15(x2,x3,x5);
  if(ISTGPRD(x5,0)){
   {OBJ x8=FLD(x5,3);
    if(EXPRD(x5,1)){
     x11=x8;
     FREE(FLD(x5,2),1);DSPRDF(x5);
    }else{
     COPY(x8,1);
     x11=x8;
     FRPRD(x5,1);}}
  }else{
   HLT("SetTopSort at <21,50-53> : undefined selection data\'SetTopSort:entry->data");}
  r=_ASet_39(x1,x11,x4);}
 return r;}

extern OBJ _ASetTopSort_16(OBJ x1,OBJ x2) /* start */
{OBJ r;
 CPPRD(__ASetTopSort_27,1);
 CPCLS(__ASetTopSort_28,1);
 CPPRD(x2,1);
 {OBJ x3;
  x3=_AArrayReduce_5(__ASetTopSort_28,__ASetTopSort_27,x2);
  {OBJ x13=FLD1(x3,1);OBJ x14=FLD1(x3,2);
   if(EXPRD(x3,1)){
    DSPRDF(x3);
   }else{
    COPY(x14,1);
    FRPRD(x3,1);}
   {OBJ x15;
    AInt_79(x13,__AInt_54,x15);
    if(ISTGPRM(x15,1)){
     FRCLS(x1,1);
     FRPRD(x2,1);
     FREE(x14,1);
     r=__ASeq_6;
    }else{
     CPCLS(x1,1);
     COPY(x14,1);
     CPCLS(__ASetTopSort_31,1);
     {OBJ x16;OBJ x17;
      x16=(*(OBJ(*)(OBJ,OBJ))METHOD(__ASetTopSort_31,1))(__ASetTopSort_31,x1);
      x17=_ASeqReduce_4(x16,x2,x14);
      r=_ASetTopSort_17(x1,x17,x14);}}}}}
 return r;}

extern OBJ _ASetTopSort_17(register OBJ x1,register OBJ x2,register OBJ x3) /* tsort */
{OBJ r;OBJ* p1=&r;
 for(;;){
  if(ISPRM(x3)){
   *p1=_ASetTopSort_16(x1,x2);
  }else{
   CPCLS(x1,2);
   CPPRD(x2,1);
   CPPRD(x3,1);
   CPCLS(__ASetTopSort_15,1);
   {OBJ x16;OBJ x17;TUP2 x18;
    x16=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ASetTopSort_15,2))(__ASetTopSort_15,x1,x2);
    x17=_ASeqReduce_4(x16,__ASeq_6,x3);
    x18=_ASetTopSort_18(x1,x3,x2,__ASeq_6);
    PRD1(2,*p1);FLD1(*p1,1)=x17;
    x2=x18.c1;x3=x18.c2;p1=&FLD1(*p1,2);continue;}}
  break;}
 return r;}

extern TUP2 _ASetTopSort_18(register OBJ x1,register OBJ x2,register OBJ x3,register OBJ x4) /* decrNext */
{TUP2 r;
 for(;;){
  if(ISPRM(x2)){
   FRCLS(x1,1);
   r.c1=x3;r.c2=x4;
  }else{
   {OBJ x39=FLD1(x2,1);OBJ x40=FLD1(x2,2);
    if(EXPRD(x2,1)){
     DSPRDF(x2);
    }else{
     COPY(x40,1);
     FRPRD(x2,1);}
    CPPRD(x3,1);
    {OBJ x42;OBJ x48;OBJ x50;OBJ x51;
     AArray_15(x3,x39,x42);
     if(ISTGPRD(x42,0)){
      {OBJ x44=FLD(x42,2);
       if(EXPRD(x42,1)){
	x48=x44;
	FREE(FLD(x42,3),1);DSPRDF(x42);
       }else{
	COPY(x44,1);
	x48=x44;
	FRPRD(x42,1);}
       CPCLS(x1,1);}
     }else{
      HLT("SetTopSort at <21,34-37> : undefined selection next\'SetTopSort:entry->seq");}
     {TUP2 t=_ASetTopSort_19(x1,x48,x3,x4);
      x50=t.c1;
      x51=t.c2;}
     x2=x40;x3=x50;x4=x51;continue;}}}
  break;}
 return r;}
extern OBJ _ASetTopSort_18_c(OBJ x1,OBJ x2,OBJ x3,OBJ x4) /* decrNext */
{OBJ r;
 {TUP2 t=_ASetTopSort_18(x1,x2,x3,x4);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern TUP2 _ASetTopSort_19(register OBJ x1,register OBJ x2,register OBJ x3,register OBJ x4) /* decr */
{TUP2 r;
 for(;;){
  if(ISPRM(x2)){
   FRCLS(x1,1);
   r.c1=x3;r.c2=x4;
  }else{
   {OBJ x36=FLD1(x2,1);OBJ x37=FLD1(x2,2);FLAG x_x2=EXPRD(x2,1);
    if(x_x2){
    }else{
     COPY(x37,1);}
    CPPRD(x3,1);
    {OBJ x39;OBJ x44;OBJ x45;
     AArray_15(x3,x36,x39);
     {OBJ x40=FLD(x39,1);
      if(EXPRD(x39,1)){
       x44=x40;
       DSPRD(x39);
      }else{
       x44=x40;
       FRPRD(x39,1);}}
     AInt_83(x44,__AInt_2,x45);
     if(ISTGPRM(x45,1)){
      if(x_x2){
       DSPRDF(x2);
      }else{
       FRPRD(x2,1);}
      x2=x37;continue;
     }else{
      {OBJ x46;OBJ x47;
       AInt_66(x44,x46);
       AInt_79(x46,__AInt_2,x47);
       if(ISTGPRM(x47,1)){
	CPCLS(x1,1);
	CPCLS(__ASetTopSort_25,1);
	{OBJ x48;OBJ x49;OBJ x50;
	 if(x_x2){
	  RSOME(x2,x48);FLD1(x48,2)=x4;
	 }else{
	  FRPRD(x2,1);PRD1(2,x48);FLD1(x48,1)=x36;FLD1(x48,2)=x4;}
	 x49=(*(OBJ(*)(OBJ,OBJ))METHOD(__ASetTopSort_25,1))(__ASetTopSort_25,x1);
	 AArray_9(x36,x49,x3,x50);
	 x2=x37;x3=x50;x4=x48;continue;}
       }else{
	if(x_x2){
	 DSPRDF(x2);
	}else{
	 FRPRD(x2,1);}
	CPCLS(x1,1);
	CPCLS(__ASetTopSort_26,1);
	{OBJ x51;OBJ x52;
	 x51=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ASetTopSort_26,2))(__ASetTopSort_26,x1,x46);
	 AArray_9(x36,x51,x3,x52);
	 x2=x37;x3=x52;continue;}}}}}}}
  break;}
 return r;}
extern OBJ _ASetTopSort_19_c(OBJ x1,OBJ x2,OBJ x3,OBJ x4) /* decr */
{OBJ r;
 {TUP2 t=_ASetTopSort_19(x1,x2,x3,x4);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern OBJ _ASetTopSort_20(OBJ x1,OBJ x2,OBJ x3) /* entry,1 */
{OBJ r;
 PRD(3,0,r);FLD(r,1)=x1;FLD(r,2)=x2;FLD(r,3)=x3;
 return r;}

extern OBJ _ASetTopSort_21(OBJ x1) /* dummy,1 */
{OBJ r;
 PRDF(1,1,r);FLD(r,1)=x1;
 return r;}

extern OBJ _ASetTopSort_23(OBJ x1) /* minus1'23 */
{OBJ r;
 CPPRD(__ASetTopSort_22,1);
 AInt_55(__ASetTopSort_22,r);
 return r;}

extern OBJ _ASetTopSort_24(OBJ x1) /* decr'24 */
{OBJ r;
 CPPRD(__ASetTopSort_22,1);
 AInt_55(__ASetTopSort_22,r);
 return r;}

extern OBJ _ASetTopSort_25(OBJ x1,OBJ x2) /* decr'25 */
{OBJ r;
 CPCLS(__ASetTopSort_24,1);
 {OBJ x3;OBJ x15;OBJ x9;
  x3=(*(OBJ(*)(OBJ,OBJ))METHOD(__ASetTopSort_24,1))(__ASetTopSort_24,__ABUILTIN_20);
  if(ISTGPRD(x2,0)){
   {OBJ x21=FLD(x2,2);OBJ x22=FLD(x2,3);
    if(EXPRD(x2,1)){
     x9=x21;x15=x22;
     DSPRDF(x2);
    }else{
     COPY(x21,1);COPY(x22,1);
     x9=x21;x15=x22;
     FRPRD(x2,1);}
    CPCLS(__ASetTopSort_8,1);}
  }else{
   HLT("SetTopSort at <21,50-53> : undefined selection data\'SetTopSort:entry->data");}
  r=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ,OBJ))METHOD(__ASetTopSort_8,4))(__ASetTopSort_8,x1,x3,x9,x15);}
 return r;}

extern OBJ _ASetTopSort_26(OBJ x1,OBJ x2,OBJ x3) /* decr'26 */
{OBJ r;
 {OBJ x15;OBJ x9;
  if(ISTGPRD(x3,0)){
   {OBJ x21=FLD(x3,2);OBJ x22=FLD(x3,3);
    if(EXPRD(x3,1)){
     x9=x21;x15=x22;
     DSPRDF(x3);
    }else{
     COPY(x21,1);COPY(x22,1);
     x9=x21;x15=x22;
     FRPRD(x3,1);}
    CPCLS(__ASetTopSort_8,1);}
  }else{
   HLT("SetTopSort at <21,50-53> : undefined selection data\'SetTopSort:entry->data");}
  r=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ,OBJ))METHOD(__ASetTopSort_8,4))(__ASetTopSort_8,x1,x2,x9,x15);}
 return r;}

extern OBJ _ASetTopSort_28(OBJ x1,OBJ x2,OBJ x3) /* start'28 */
{OBJ r;
 {OBJ x8;OBJ x9;
  {OBJ x4=FLD(x2,1);
   if(EXPRD(x2,1)){
    x8=x4;
    DSPRD(x2);
   }else{
    x8=x4;
    FRPRD(x2,1);}}
  AInt_82(x8,__AInt_2,x9);
  if(ISTGPRM(x9,1)){
   {OBJ x20=FLD1(x3,1);OBJ x21=FLD1(x3,2);
    COPY(x21,1);
    {OBJ x22;
     AInt_83(x8,x20,x22);
     if(ISTGPRM(x22,1)){
      if(EXPRD(x3,1)){
       FREE(FLD1(x3,2),1);DSPRDF(x3);
      }else{
       DCPRD(x3,1);}
      FREE(x21,1);
      {OBJ x23;
       PRD1F(2,x23);FLD1(x23,1)=x1;FLD1(x23,2)=__ASeq_6;
       PRD1(2,r);FLD1(r,1)=x8;FLD1(r,2)=x23;}
     }else{
      {OBJ x24;
       AInt_79(x8,x20,x24);
       if(ISTGPRM(x24,1)){
	if(EXPRD(x3,1)){
	 FREE(FLD1(x3,2),1);DSPRDF(x3);
	}else{
	 DCPRD(x3,1);}
	{OBJ x25;
	 PRD1(2,x25);FLD1(x25,1)=x1;FLD1(x25,2)=x21;
	 PRD1(2,r);FLD1(r,1)=x20;FLD1(r,2)=x25;}
       }else{
	FREE(x21,1);
	r=x3;}}}}}
  }else{
   r=x3;}}
 return r;}

extern OBJ _ASetTopSort_29(OBJ x1) /* start'29 */
{OBJ r;
 CPPRD(__ASetTopSort_22,1);
 AInt_55(__ASetTopSort_22,r);
 return r;}

extern OBJ _ASetTopSort_30(OBJ x1,OBJ x2) /* start'30 */
{OBJ r;
 CPCLS(__ASetTopSort_29,1);
 {OBJ x3;OBJ x15;OBJ x9;
  x3=(*(OBJ(*)(OBJ,OBJ))METHOD(__ASetTopSort_29,1))(__ASetTopSort_29,__ABUILTIN_20);
  if(ISTGPRD(x2,0)){
   {OBJ x21=FLD(x2,2);OBJ x22=FLD(x2,3);
    if(EXPRD(x2,1)){
     x9=x21;x15=x22;
     DSPRDF(x2);
    }else{
     COPY(x21,1);COPY(x22,1);
     x9=x21;x15=x22;
     FRPRD(x2,1);}
    CPCLS(__ASetTopSort_8,1);}
  }else{
   HLT("SetTopSort at <21,50-53> : undefined selection data\'SetTopSort:entry->data");}
  r=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ,OBJ))METHOD(__ASetTopSort_8,4))(__ASetTopSort_8,x1,x3,x9,x15);}
 return r;}

extern OBJ _ASetTopSort_31(OBJ x1,OBJ x2,OBJ x3) /* start'31 */
{OBJ r;
 CPCLS(__ASetTopSort_30,1);
 {OBJ x4;
  x4=(*(OBJ(*)(OBJ,OBJ))METHOD(__ASetTopSort_30,1))(__ASetTopSort_30,x1);
  AArray_9(x2,x4,x3,r);}
 return r;}

extern OBJ _ASetTopSort_32(OBJ x1,OBJ x2) /* topSort'32 */
{OBJ r;
 CPCLS(__ASetTopSort_5,1);
 r=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ASetTopSort_5,2))(__ASetTopSort_5,x1,__AInt_2);
 return r;}

extern OBJ _ASetTopSort_33(OBJ x1,OBJ x2,OBJ x3,OBJ x4) /* topSort'33 */
{OBJ r;
 {
  PRD1(2,r);FLD1(r,2)=x4;
  FLD1(r,1)=_AMapByBST_16(x1,x2,x3);}
 return r;}

extern OBJ _ASetTopSort_34(OBJ x1,OBJ x2,OBJ x3,OBJ x4) /* topSort'34 */
{OBJ r;
 {OBJ x9;
  {OBJ x5=FLD(x4,1);
   if(EXPRD(x4,1)){
    x9=x5;
    DSPRD(x4);
   }else{
    x9=x5;
    FRPRD(x4,1);}
   CPCLS(__ASetTopSort_8,1);}
  r=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ,OBJ))METHOD(__ASetTopSort_8,4))(__ASetTopSort_8,x1,x9,x3,x2);}
 return r;}

extern OBJ _ASetTopSort_35(OBJ x1,OBJ x2) /* topSort'35 */
{OBJ r;
 {OBJ x12;OBJ x7;OBJ x13;
  if(ISTGPRD(x2,0)){
   {OBJ x40=FLD(x2,1);
    x12=x40;
    x7=__ABUILTIN_3;}
  }else{
   {OBJ x43=FLD(x2,1);
    x12=x43;
    x7=__ABUILTIN_5;}}
  AInt_65(x12,x13);
  if(ISTGPRM(x7,1)){
   FRPRD(x2,1);
   CPCLS(__ASetTopSort_5,1);
   r=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ASetTopSort_5,2))(__ASetTopSort_5,x1,x13);
  }else{
   {OBJ x25;OBJ x19;
    if(ISTGPRD(x2,0)){
     {OBJ x31=FLD(x2,2);OBJ x32=FLD(x2,3);
      if(EXPRD(x2,1)){
       x19=x31;x25=x32;
       DSPRDF(x2);
      }else{
       COPY(x31,1);COPY(x32,1);
       x19=x31;x25=x32;
       FRPRD(x2,1);}
      CPCLS(__ASetTopSort_8,1);}
    }else{
     HLT("SetTopSort at <21,50-53> : undefined selection data\'SetTopSort:entry->data");}
    r=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ,OBJ))METHOD(__ASetTopSort_8,4))(__ASetTopSort_8,x1,x13,x19,x25);}}}
 return r;}

extern OBJ _ASetTopSort_36(OBJ x1,OBJ x2,OBJ x3) /* topSort'36 */
{OBJ r;
 CPCLS(__ASetTopSort_35,1);
 {OBJ x4;
  x4=(*(OBJ(*)(OBJ,OBJ))METHOD(__ASetTopSort_35,1))(__ASetTopSort_35,x1);
  AArray_9(x2,x4,x3,r);}
 return r;}

extern OBJ _ASetTopSort_37(OBJ x1,OBJ x2,OBJ x3,OBJ x4,OBJ x5,OBJ x6) /* topSort'37 */
{OBJ r;
 CPCLS(__ASetTopSort_33,1);
 CPCLS(__ASetTopSort_34,1);
 CPCLS(__ASetTopSort_36,1);
 CPCLS(x1,2);
 COPY(x4,1);
 {OBJ x7;OBJ x8;OBJ x9;OBJ x10;OBJ x11;OBJ x12;
  x7=(*(OBJ(*)(OBJ,OBJ))METHOD(x2,1))(x2,x4);
  x8=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ASetTopSort_33,2))(__ASetTopSort_33,x1,x3);
  x9=_ASeqReduce_3(x8,__ASeq_6,x7);
  COPY(x9,1);
  x10=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ))METHOD(__ASetTopSort_34,3))(__ASetTopSort_34,x1,x4,x9);
  AArray_9(x5,x10,x6,x11);
  x12=(*(OBJ(*)(OBJ,OBJ))METHOD(__ASetTopSort_36,1))(__ASetTopSort_36,x1);
  r=_ASeqReduce_4(x12,x11,x9);}
 return r;}


static OBJ _mt_1_0_2(OBJ t,OBJ t1,OBJ t2) 
{OBJ r;
 {OBJ t3;
  DCCLS(t,1);
  t3=(*(OBJ(*)(OBJ))ENTRY(t))(t1);
  r=(*(OBJ(*)(OBJ,OBJ))METHOD(t3,1))(t3,t2);}
 return r;}

static OBJ _mt_1_0_4(OBJ t,OBJ t1,OBJ t2,OBJ t3,OBJ t4) 
{OBJ r;
 {OBJ t5;
  DCCLS(t,1);
  t5=(*(OBJ(*)(OBJ))ENTRY(t))(t1);
  r=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ))METHOD(t5,3))(t5,t2,t3,t4);}
 return r;}

static OBJ _mt_4_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_4_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_4_2_2(OBJ t,OBJ t1,OBJ t2) 
{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,OBJ))ENTRY(t))(FLDCLS(t,1),FLDCLS(t,2),t1,t2);
 return r;}

static OBJ _mt_6_0_3(OBJ t,OBJ t1,OBJ t2,OBJ t3) 
{OBJ r;
 DPCLS(t,r);
 INCCLS(r,0,3);
 FLDCLS(r,1)=t1;
 FLDCLS(r,2)=t2;
 FLDCLS(r,3)=t3;
 return r;}

static OBJ _mt_6_3_3(OBJ t,OBJ t1,OBJ t2,OBJ t3) 
{OBJ r;
 if(EXCLS(t)){
  DSCLSF(t);
 }else{
  COPY(FLDCLS(t,1),1);
  COPY(FLDCLS(t,2),1);
  COPY(FLDCLS(t,3),1);
  DCCLS(t,1);}
 r=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ,OBJ,OBJ))ENTRY(t))(FLDCLS(t,1),FLDCLS(t,2),FLDCLS(t,3),t1,t2,t3);
 return r;}

init_ASetTopSort()
{
 static int visited=0; if(visited) return; visited=1;
 init_ASet();
 init_ASeq();
 init_ANat();
 init_AOption();
 init_AInt();
 init_APair();
 init_ASeqReduce();
 init_ASetReduce();
 init_ASetConv();
 init_AMapByBST();
 init_AMapByBSTReduce();
 init_AArray();
 init_AArrayReduce();
 init_ASetByBST();
 init_ABSTree();
 init_ATree();
 init_AString();
 init_AChar();
 init_ASeqConv();
 CLS(3,_ASetTopSort_31,__ASetTopSort_31);
 CLS(2,_ASetTopSort_30,__ASetTopSort_30);
 LCLS(1,_ASetTopSort_29,__ASetTopSort_29);
 CLS(3,_ASetTopSort_28,__ASetTopSort_28);
 CLS(3,_ASetTopSort_26,__ASetTopSort_26);
 CLS(2,_ASetTopSort_25,__ASetTopSort_25);
 LCLS(1,_ASetTopSort_24,__ASetTopSort_24);
 LCLS(1,_ASetTopSort_23,__ASetTopSort_23);
 DEN("-1",__ASetTopSort_22);
 CLS(1,_ASetTopSort_21,__ASetTopSort_21);
 CLS(3,_ASetTopSort_20,__ASetTopSort_20);
 CLS(4,_ASetTopSort_19_c,__ASetTopSort_19);
 CLS(4,_ASetTopSort_18_c,__ASetTopSort_18);
 CLS(3,_ASetTopSort_17,__ASetTopSort_17);
 CLS(2,_ASetTopSort_16,__ASetTopSort_16);
 CLS(4,_ASetTopSort_15,__ASetTopSort_15);
 CLS(4,_ASetTopSort_14_c,__ASetTopSort_14);
 CLS(1,_ASetTopSort_13,__ASetTopSort_13);
 CLS(2,_ASetTopSort_11,__ASetTopSort_11);
 CLS(2,_ASetTopSort_10,__ASetTopSort_10);
 CLS(2,_ASetTopSort_9,__ASetTopSort_9);
 CLS(1,_ASetTopSort_8,__ASetTopSort_8);
 CLS(2,_ASetTopSort_7,__ASetTopSort_7);
 CLS(2,_ASetTopSort_6,__ASetTopSort_6);
 CLS(6,_ASetTopSort_37,__ASetTopSort_37);
 CLS(1,_ASetTopSort_5,__ASetTopSort_5);
 CLS(3,_ASetTopSort_36,__ASetTopSort_36);
 CLS(2,_ASetTopSort_35,__ASetTopSort_35);
 CLS(3,_ASetTopSort_3,__ASetTopSort_3);
 CLS(4,_ASetTopSort_34,__ASetTopSort_34);
 CLS(4,_ASetTopSort_33,__ASetTopSort_33);
 CLS(2,_ASetTopSort_32,__ASetTopSort_32);
 MTH(1,0,2,_mt_1_0_2);LZYMTH(1,0,2,_mt_1_0_2);
 MTH(1,0,4,_mt_1_0_4);LZYMTH(1,0,4,_mt_1_0_4);
 MTH(4,0,2,_mt_4_0_2);LZYMTH(4,0,2,_mt_4_0_2);
 MTH(4,1,1,_mt_4_1_1);LZYMTH(4,1,1,_mt_4_1_1);
 MTH(4,2,2,_mt_4_2_2);LZYMTH(4,2,2,_mt_4_2_2);
 MTH(6,0,3,_mt_6_0_3);LZYMTH(6,0,3,_mt_6_0_3);
 MTH(6,3,3,_mt_6_3_3);LZYMTH(6,3,3,_mt_6_3_3);
 PRD1F(2,__ASetTopSort_27);FLD1(__ASetTopSort_27,1)=__AInt_54;FLD1(__ASetTopSort_27,2)=__ASeq_6;}

