

#include "BUILTIN.h"
extern OBJ __ASeq_6;
extern OBJ _ASeq_18(OBJ,OBJ,OBJ,OBJ,OBJ,OBJ);extern OBJ __ASeq_18;
extern OBJ _AIde_14(OBJ,OBJ);extern OBJ __AIde_14;
extern OBJ _AIde_18(OBJ);extern OBJ __AIde_18;
extern OBJ __AIdeSet_2;
extern OBJ _AFormat_5(OBJ,OBJ);extern OBJ __AFormat_5;
extern OBJ __AFormat_9;

#include "Nat.h"
extern OBJ _AFmt_28(OBJ);extern OBJ __AFmt_28;

#include "Char.h"

#include "Int.h"
extern OBJ _ASeqReduce_3(OBJ,OBJ,OBJ);extern OBJ __ASeqReduce_3;

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

#include "NatConv.h"
extern OBJ _AFormatFun1_2(OBJ,OBJ,OBJ,OBJ,OBJ);extern OBJ __AFormatFun1_2;

#include "Real.h"
extern OBJ _ASetByBSTConv_7(OBJ,OBJ);extern OBJ __ASetByBSTConv_7;
extern OBJ _ABSTree_57(OBJ,OBJ,OBJ);extern OBJ __ABSTree_57;
extern OBJ _ABSTree_61(OBJ,OBJ,OBJ);extern OBJ __ABSTree_61;
extern OBJ _ABSTreeConv_7(OBJ,OBJ);extern OBJ __ABSTreeConv_7;
OBJ __AIdeOrd_2; /* {} */
extern OBJ _AIdeOrd_3(OBJ);OBJ __AIdeOrd_3; /* {}? */
extern OBJ _AIdeOrd_4(OBJ,OBJ,OBJ);OBJ __AIdeOrd_4; /* arc */
extern OBJ _AIdeOrd_5(OBJ,OBJ);OBJ __AIdeOrd_5; /* point */
extern OBJ _AIdeOrd_6(OBJ);OBJ __AIdeOrd_6; /* topSort */
extern TUP2 _AIdeOrd_7(OBJ,OBJ);OBJ __AIdeOrd_7; /* extract */
extern OBJ _AIdeOrd_8(OBJ,OBJ);OBJ __AIdeOrd_8; /* uppers */
extern OBJ _AIdeOrd_9(OBJ);OBJ __AIdeOrd_9; /* format */
extern OBJ _AIdeOrd_11(OBJ,OBJ);OBJ __AIdeOrd_11; /* mkE */
extern OBJ _AIdeOrd_12(OBJ);OBJ __AIdeOrd_12; /* mkE? */
extern OBJ _AIdeOrd_13(OBJ);OBJ __AIdeOrd_13; /* succs */
extern OBJ _AIdeOrd_14(OBJ);OBJ __AIdeOrd_14; /* predCt */
OBJ __AIdeOrd_15; /* null */
extern OBJ _AIdeOrd_16(OBJ);OBJ __AIdeOrd_16; /* null? */
extern OBJ _AIdeOrd_17(OBJ);OBJ __AIdeOrd_17; /* mkA */
extern OBJ _AIdeOrd_18(OBJ);OBJ __AIdeOrd_18; /* mkA? */
extern OBJ _AIdeOrd_19(OBJ);OBJ __AIdeOrd_19; /* A */
OBJ __AIdeOrd_20; /* growSize */
extern OBJ _AIdeOrd_22(OBJ,OBJ);OBJ __AIdeOrd_22; /* extend */
extern TUP2 _AIdeOrd_26(OBJ,OBJ,OBJ,OBJ);OBJ __AIdeOrd_26; /* extr */
extern TUP2 _AIdeOrd_27(OBJ,OBJ,OBJ,OBJ,OBJ);OBJ __AIdeOrd_27; /* extrSuccs */
extern OBJ _AIdeOrd_28(OBJ,OBJ,OBJ,OBJ,OBJ);OBJ __AIdeOrd_28; /* drawTransArcs */
extern OBJ _AIdeOrd_30(OBJ,OBJ,OBJ);OBJ __AIdeOrd_30; /* upps */
extern OBJ _AIdeOrd_31(OBJ,OBJ);OBJ __AIdeOrd_31; /* tsort */
extern TUP2 _AIdeOrd_32(OBJ,OBJ,OBJ);OBJ __AIdeOrd_32; /* decr */
extern TUP2 _AIdeOrd_33(OBJ,OBJ,OBJ);OBJ __AIdeOrd_33; /* decrSuccs */
extern OBJ _AIdeOrd_34(OBJ,OBJ,OBJ);OBJ __AIdeOrd_34; /* extend'34 */
extern OBJ _AIdeOrd_35(OBJ,OBJ);OBJ __AIdeOrd_35; /* arc'35 */
OBJ __AIdeOrd_36; /* arc'36 */
extern OBJ _AIdeOrd_37(OBJ);OBJ __AIdeOrd_37; /* arc'37 */
OBJ __AIdeOrd_38; /* point'38 */
extern OBJ _AIdeOrd_39(OBJ,OBJ);OBJ __AIdeOrd_39; /* decrSuccs'39 */
extern OBJ _AIdeOrd_40(OBJ,OBJ,OBJ);OBJ __AIdeOrd_40; /* topSort'40 */
extern OBJ _AIdeOrd_41(OBJ);OBJ __AIdeOrd_41; /* extrSuccs'41 */
OBJ __AIdeOrd_42; /* format'42 */
extern OBJ _AIdeOrd_43(OBJ);OBJ __AIdeOrd_43; /* format'43 */
OBJ __AIdeOrd_44; /* format'44 */
extern OBJ _AIdeOrd_45(OBJ);OBJ __AIdeOrd_45; /* format'45 */
OBJ __AIdeOrd_46; /* format'46 */
extern OBJ _AIdeOrd_47(OBJ);OBJ __AIdeOrd_47; /* format'47 */
OBJ __AIdeOrd_48; /* format'48 */
extern OBJ _AIdeOrd_49(OBJ);OBJ __AIdeOrd_49; /* format'49 */
OBJ __AIdeOrd_50; /* format'50 */
extern OBJ _AIdeOrd_51(OBJ);OBJ __AIdeOrd_51; /* format'51 */
extern OBJ _AIdeOrd_52(OBJ);OBJ __AIdeOrd_52; /* format'52 */
extern OBJ _AIdeOrd_53(OBJ,OBJ,OBJ);OBJ __AIdeOrd_53; /* format'53 */

extern OBJ _AIdeOrd_3(OBJ x1) /* {}? */
{OBJ r;
 {OBJ x2;
  AArray_16(x1,x2);
  ANat_6(x2,r);}
 return r;}

extern OBJ _AIdeOrd_4(OBJ x1,OBJ x2,OBJ x3) /* arc */
{OBJ r;
 {OBJ x11;OBJ x7;OBJ x12;OBJ x13;OBJ x14;OBJ x15;OBJ x16;
  {OBJ x8=FLD(x2,1);
   if(EXPRD(x2,1)){
    x11=x8;
    DSPRD(x2);
   }else{
    x11=x8;
    FRPRD(x2,1);}}
  {OBJ x4=FLD(x1,1);
   if(EXPRD(x1,1)){
    x7=x4;
    DSPRD(x1);
   }else{
    x7=x4;
    FRPRD(x1,1);}
   CPCLS(__AIdeOrd_35,1);
   CPCLS(__AIdeOrd_37,1);}
  ANat_73(x11,x7,x12);
  ANat_2(x12,x13);
  x14=_AIdeOrd_22(x13,x3);
  x15=(*(OBJ(*)(OBJ,OBJ))METHOD(__AIdeOrd_35,1))(__AIdeOrd_35,x7);
  AArray_9(x11,x15,x14,x16);
  AArray_9(x7,__AIdeOrd_37,x16,r);}
 return r;}

extern OBJ _AIdeOrd_5(OBJ x1,OBJ x2) /* point */
{OBJ r;
 if(ISTGPRD(x1,1)){
  {OBJ x19=FLD(x1,1);
   if(EXPRD(x1,1)){
    DSPRDF(x1);
   }else{
    FRPRD(x1,1);}
   CPPRD(x2,1);
   {OBJ x20;OBJ x21;OBJ x25;
    AArray_16(x2,x20);
    ANat_80(x19,x20,x21);
    if(ISTGPRM(x21,1)){
     CPPRD(x2,1);
     {OBJ x22;
      AArray_15(x2,x19,x22);
      if(ISPRM(x22)){
       x25=__ABUILTIN_3;
      }else{
       if(EXPRD(x22,1)){
	FREE(FLD1(x22,2),1);DSPRDF(x22);
       }else{
	DCPRD(x22,1);}
       x25=__ABUILTIN_5;}}
    }else{
     x25=__ABUILTIN_3;}
    if(ISTGPRM(x25,1)){
     r=x2;
    }else{
     COPY(__AIdeOrd_38,1);
     {OBJ x26;OBJ x27;
      ANat_2(x19,x26);
      x27=_AIdeOrd_22(x26,x2);
      AArray_7(x19,__AIdeOrd_38,x27,r);}}}}
 }else{
  HLT("IdeOrd at <unknown> : missing else in point\'IdeOrd:ide**ideOrd->ideOrd");}
 return r;}

extern OBJ _AIdeOrd_6(OBJ x1) /* topSort */
{OBJ r;
 CPCLS(__AIdeOrd_40,1);
 CPPRD(x1,1);
 {OBJ x2;
  x2=_AArrayReduce_5(__AIdeOrd_40,__ASeq_6,x1);
  r=_AIdeOrd_31(x2,x1);}
 return r;}

extern TUP2 _AIdeOrd_7(OBJ x1,OBJ x2) /* extract */
{TUP2 r;
 CPPRD(__AIdeOrd_2,1);
 CPCLS(__AIde_14,1);
 COPY(x2,1);
 {OBJ x3;
  x3=_ABSTreeConv_7(__AIde_14,x2);
  r=_AIdeOrd_26(x2,x1,__AIdeOrd_2,x3);}
 return r;}
extern OBJ _AIdeOrd_7_c(OBJ x1,OBJ x2) /* extract */
{OBJ r;
 {TUP2 t=_AIdeOrd_7(x1,x2);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern OBJ _AIdeOrd_8(OBJ x1,OBJ x2) /* uppers */
{OBJ r;
 if(ISTGPRD(x2,1)){
  {OBJ x11=FLD(x2,1);
   if(EXPRD(x2,1)){
    DSPRDF(x2);
   }else{
    FRPRD(x2,1);}
   COPY(__AIdeSet_2,1);
   r=_AIdeOrd_30(x1,x11,__AIdeSet_2);}
 }else{
  HLT("IdeOrd at <unknown> : missing else in uppers\'IdeOrd:ideOrd**ide->ideSet");}
 return r;}

extern OBJ _AIdeOrd_9(OBJ x1) /* format */
{OBJ r;
 CPCLS(__AIdeOrd_53,1);
 {OBJ x2;
  x2=_AArrayReduce_5(__AIdeOrd_53,__ASeq_6,x1);
  r=_AFormat_5(__ANat_5,x2);}
 return r;}

extern OBJ _AIdeOrd_11(OBJ x1,OBJ x2) /* mkE */
{OBJ r;
 PRD1(2,r);FLD1(r,1)=x1;FLD1(r,2)=x2;
 return r;}

extern OBJ _AIdeOrd_12(OBJ x1) /* mkE? */
{OBJ r;
 if(ISPRM(x1)){
  r=__ABUILTIN_3;
 }else{
  if(EXPRD(x1,1)){
   FREE(FLD1(x1,2),1);DSPRDF(x1);
  }else{
   DCPRD(x1,1);}
  r=__ABUILTIN_5;}
 return r;}

extern OBJ _AIdeOrd_13(OBJ x1) /* succs */
{OBJ r;
 if(ISPRM(x1)){
  HLT("IdeOrd at <31,38-42> : undefined selection succs\'IdeOrd:elem->seq");
 }else{
  {OBJ x3=FLD1(x1,2);
   if(EXPRD(x1,1)){
    r=x3;
    DSPRDF(x1);
   }else{
    COPY(x3,1);
    r=x3;
    FRPRD(x1,1);}}}
 return r;}

extern OBJ _AIdeOrd_14(OBJ x1) /* predCt */
{OBJ r;
 if(ISPRM(x1)){
  HLT("IdeOrd at <31,25-30> : undefined selection predCt\'IdeOrd:elem->nat");
 }else{
  {OBJ x2=FLD1(x1,1);
   if(EXPRD(x1,1)){
    r=x2;
    FREE(FLD1(x1,2),1);DSPRDF(x1);
   }else{
    r=x2;
    FRPRD(x1,1);}}}
 return r;}

extern OBJ _AIdeOrd_16(OBJ x1) /* null? */
{OBJ r;
 if(ISPRM(x1)){
  r=__ABUILTIN_5;
 }else{
  if(EXPRD(x1,1)){
   FREE(FLD1(x1,2),1);DSPRDF(x1);
  }else{
   DCPRD(x1,1);}
  r=__ABUILTIN_3;}
 return r;}

extern OBJ _AIdeOrd_17(OBJ x1) /* mkA */
{OBJ r;
 r=x1;
 return r;}

extern OBJ _AIdeOrd_18(OBJ x1) /* mkA? */
{OBJ r;
 FRPRD(x1,1);
 r=__ABUILTIN_5;
 return r;}

extern OBJ _AIdeOrd_19(OBJ x1) /* A */
{OBJ r;
 r=x1;
 return r;}

extern OBJ _AIdeOrd_22(OBJ x1,OBJ x2) /* extend */
{OBJ r;
 CPPRD(x2,1);
 {OBJ x3;OBJ x4;
  AArray_16(x2,x3);
  ANat_81(x1,x3,x4);
  if(ISTGPRM(x4,1)){
   CPCLS(__AIdeOrd_34,1);
   {OBJ x5;OBJ x6;OBJ x7;
    ANat_61(x3,__AIdeOrd_20,x5);
    ANat_73(x1,x5,x6);
    x7=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__AIdeOrd_34,2))(__AIdeOrd_34,x2,x3);
    AArray_4(x6,x7,r);}
  }else{
   r=x2;}}
 return r;}

extern TUP2 _AIdeOrd_26(register OBJ x1,register OBJ x2,register OBJ x3,register OBJ x4) /* extr */
{TUP2 r;
 for(;;){
  if(ISPRM(x4)){
   FREE(x1,1);
   r.c1=x2;r.c2=x3;
  }else{
   {OBJ x80=FLD1(x4,1);OBJ x81=FLD1(x4,2);
    if(EXPRD(x4,1)){
     DSPRDF(x4);
    }else{
     CPPRD(x80,1);COPY(x81,1);
     FRPRD(x4,1);}
    if(ISTGPRD(x80,1)){
     {OBJ x82=FLD(x80,1);
      CPPRD(x2,1);
      {OBJ x83;OBJ x84;OBJ x88;
       AArray_16(x2,x83);
       ANat_79(x82,x83,x84);
       if(ISTGPRM(x84,1)){
	x88=__ABUILTIN_5;
       }else{
	CPPRD(x2,1);
	{OBJ x85;
	 AArray_15(x2,x82,x85);
	 if(ISPRM(x85)){
	  x88=__ABUILTIN_5;
	 }else{
	  if(EXPRD(x85,1)){
	   FREE(FLD1(x85,2),1);DSPRDF(x85);
	  }else{
	   DCPRD(x85,1);}
	  x88=__ABUILTIN_3;}}}
       if(ISTGPRM(x88,1)){
	if(EXPRD(x80,1)){
	 DSPRDF(x80);
	}else{
	 DCPRD(x80,1);}
	x4=x81;continue;
       }else{
	CPPRD(x2,1);
	CPPRD(x80,1);
	{OBJ x89;OBJ x90;
	 x89=_AIdeOrd_5(x80,x3);
	 AArray_15(x2,x82,x90);
	 if(ISPRM(x90)){
	  HLT("IdeOrd at <31,38-42> : undefined selection succs\'IdeOrd:elem->seq");
	 }else{
	  {OBJ x92=FLD1(x90,2);
	   if(EXPRD(x90,1)){
	    DSPRDF(x90);
	   }else{
	    COPY(x92,1);
	    FRPRD(x90,1);}
	   COPY(x1,1);
	   {TUP2 x95;OBJ x97;
	    x95=_AIdeOrd_27(x1,x2,x89,x80,x92);
	    AArray_7(x82,__AIdeOrd_15,x95.c1,x97);
	    x2=x97;x3=x95.c2;x4=x81;continue;}}}}}}}
    }else{
     HLT("IdeOrd at <103,5-8> : missing else in extr\'IdeOrd:ideSet**array**ideOrd**seq->array**ideOrd");}}}
  break;}
 return r;}
extern OBJ _AIdeOrd_26_c(OBJ x1,OBJ x2,OBJ x3,OBJ x4) /* extr */
{OBJ r;
 {TUP2 t=_AIdeOrd_26(x1,x2,x3,x4);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern TUP2 _AIdeOrd_27(register OBJ x1,register OBJ x2,register OBJ x3,register OBJ x4,register OBJ x5) /* extrSuccs */
{TUP2 r;
 for(;;){
  if(ISPRM(x5)){
   FREE(x1,1);
   FRPRD(x4,1);
   r.c1=x2;r.c2=x3;
  }else{
   {OBJ x51=FLD1(x5,1);OBJ x52=FLD1(x5,2);FLAG x_x5=EXPRD(x5,1);
    if(x_x5){
    }else{
     COPY(x52,1);}
    COPY(x1,1);
    CPCLS(__AIde_14,1);
    {OBJ x54;OBJ x55;
     PRDF(1,1,x54);FLD(x54,1)=x51;
     CPPRD(x54,1);
     x55=_ABSTree_61(__AIde_14,x54,x1);
     if(ISTGPRM(x55,1)){
      if(x_x5){
       DSPRDF(x5);
      }else{
       FRPRD(x5,1);}
      CPPRD(x4,1);
      {OBJ x56;
       x56=_AIdeOrd_4(x54,x4,x3);
       x3=x56;x5=x52;continue;}
     }else{
      FRPRD(x54,1);
      CPPRD(x2,1);
      {OBJ x57;OBJ x58;OBJ x62;
       AArray_16(x2,x57);
       ANat_80(x51,x57,x58);
       if(ISTGPRM(x58,1)){
	CPPRD(x2,1);
	{OBJ x59;
	 AArray_15(x2,x51,x59);
	 if(ISPRM(x59)){
	  x62=__ABUILTIN_3;
	 }else{
	  if(EXPRD(x59,1)){
	   FREE(FLD1(x59,2),1);DSPRDF(x59);
	  }else{
	   DCPRD(x59,1);}
	  x62=__ABUILTIN_5;}}
       }else{
	x62=__ABUILTIN_3;}
       if(ISTGPRM(x62,1)){
	COPY(x1,1);
	CPPRD(x2,2);
	CPPRD(x4,1);
	CPCLS(__AIdeOrd_28,1);
	COPY(__AIdeSet_2,1);
	{OBJ x63;OBJ x64;OBJ x65;
	 if(x_x5){
	  RSOME(x5,x63);FLD1(x63,1)=__AIdeSet_2;FLD1(x63,2)=x3;
	 }else{
	  FRPRD(x5,1);PRD1(2,x63);FLD1(x63,1)=__AIdeSet_2;FLD1(x63,2)=x3;}
	 x64=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ))METHOD(__AIdeOrd_28,3))(__AIdeOrd_28,x1,x2,x4);
	 AArray_15(x2,x51,x65);
	 if(ISPRM(x65)){
	  HLT("IdeOrd at <31,38-42> : undefined selection succs\'IdeOrd:elem->seq");
	 }else{
	  {OBJ x76=FLD1(x65,2);
	   if(EXPRD(x65,1)){
	    DSPRDF(x65);
	   }else{
	    COPY(x76,1);
	    FRPRD(x65,1);}
	   CPCLS(__AIdeOrd_41,1);
	   {OBJ x78;OBJ x79;
	    x78=_ASeqReduce_3(x64,x63,x76);
	    AArray_9(x51,__AIdeOrd_41,x2,x79);
	    {OBJ x81=FLD1(x78,2);
	     if(EXPRD(x78,1)){
	      FREE(FLD1(x78,1),1);DSPRDF(x78);
	     }else{
	      CPPRD(x81,1);
	      FRPRD(x78,1);}
	     x2=x79;x3=x81;x5=x52;continue;}}}}}
       }else{
	if(x_x5){
	 DSPRDF(x5);
	}else{
	 FRPRD(x5,1);}
	x5=x52;continue;}}}}}}
  break;}
 return r;}
extern OBJ _AIdeOrd_27_c(OBJ x1,OBJ x2,OBJ x3,OBJ x4,OBJ x5) /* extrSuccs */
{OBJ r;
 {TUP2 t=_AIdeOrd_27(x1,x2,x3,x4,x5);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern OBJ _AIdeOrd_28(OBJ x1,OBJ x2,OBJ x3,OBJ x4,OBJ x5) /* drawTransArcs */
{OBJ r;
 {OBJ x12;
  PRDF(1,1,x12);FLD(x12,1)=x4;
  {OBJ x41=FLD1(x5,1);OBJ x42=FLD1(x5,2);
   COPY(x41,1);CPPRD(x42,1);
   COPY(x1,1);
   CPPRD(x12,1);
   CPCLS(__AIde_14,1);
   {OBJ x43;
    x43=_ABSTree_61(__AIde_14,x12,x1);
    if(ISTGPRM(x43,1)){
     FREE(x1,1);
     FRPRD(x2,1);
     if(EXPRD(x5,1)){
      DSPRD(x5);
     }else{
      DCPRD(x5,1);}
     {
      PRD1(2,r);FLD1(r,1)=x41;
      FLD1(r,2)=_AIdeOrd_4(x12,x3,x42);}
    }else{
     CPPRD(x2,1);
     {OBJ x45;OBJ x46;OBJ x51;
      AArray_16(x2,x45);
      ANat_80(x4,x45,x46);
      if(ISTGPRM(x46,1)){
       CPPRD(x2,1);
       {OBJ x47;
	AArray_15(x2,x4,x47);
	if(ISPRM(x47)){
	 x51=__ABUILTIN_3;
	}else{
	 if(EXPRD(x47,1)){
	  FREE(FLD1(x47,2),1);DSPRDF(x47);
	 }else{
	  DCPRD(x47,1);}
	 CPPRD(x12,1);
	 COPY(x41,1);
	 CPCLS(__AIde_14,1);
	 {OBJ x50;
	  x50=_ABSTree_61(__AIde_14,x12,x41);
	  if(ISTGPRM(x50,1)){
	   x51=__ABUILTIN_3;
	  }else{
	   x51=__ABUILTIN_5;}}}}
      }else{
       x51=__ABUILTIN_3;}
      if(ISTGPRM(x51,1)){
       if(EXPRD(x5,1)){
	DSPRD(x5);
       }else{
	DCPRD(x5,1);}
       CPPRD(x2,1);
       CPCLS(__AIdeOrd_28,1);
       CPCLS(__AIde_14,1);
       {OBJ x53;OBJ x52;OBJ x54;
	AArray_15(x2,x4,x53);
	x52=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ))METHOD(__AIdeOrd_28,3))(__AIdeOrd_28,x1,x2,x3);
	x54=_ABSTree_57(__AIde_14,x12,x41);
	if(ISPRM(x53)){
	 HLT("IdeOrd at <31,38-42> : undefined selection succs\'IdeOrd:elem->seq");
	}else{
	 {OBJ x62=FLD1(x53,2);FLAG x_x53=EXPRD(x53,1);
	  if(x_x53){
	  }else{
	   COPY(x62,1);}
	  {OBJ x64;
	   if(x_x53){
	    RSOME(x53,x64);FLD1(x64,1)=x54;FLD1(x64,2)=x42;
	   }else{
	    FRPRD(x53,1);PRD1(2,x64);FLD1(x64,1)=x54;FLD1(x64,2)=x42;}
	   r=_ASeqReduce_3(x52,x64,x62);}}}}
      }else{
       FREE(x1,1);
       FRPRD(x2,1);
       FRPRD(x3,1);
       FRPRD(x12,1);
       FREE(x41,1);
       FRPRD(x42,1);
       r=x5;}}}}}}
 return r;}

extern OBJ _AIdeOrd_30(OBJ x1,OBJ x2,OBJ x3) /* upps */
{OBJ r;
 CPCLS(__AIde_14,1);
 CPPRD(x1,1);
 {OBJ x4;OBJ x5;OBJ x6;OBJ x7;OBJ x11;
  PRDF(1,1,x4);FLD(x4,1)=x2;
  AArray_16(x1,x5);
  x6=_ABSTree_57(__AIde_14,x4,x3);
  ANat_80(x2,x5,x7);
  if(ISTGPRM(x7,1)){
   CPPRD(x1,1);
   {OBJ x8;
    AArray_15(x1,x2,x8);
    if(ISPRM(x8)){
     x11=__ABUILTIN_3;
    }else{
     if(EXPRD(x8,1)){
      FREE(FLD1(x8,2),1);DSPRDF(x8);
     }else{
      DCPRD(x8,1);}
     x11=__ABUILTIN_5;}}
  }else{
   x11=__ABUILTIN_3;}
  if(ISTGPRM(x11,1)){
   CPPRD(x1,1);
   CPCLS(__AIdeOrd_30,1);
   {OBJ x12;OBJ x13;OBJ x19;OBJ x16;
    AArray_15(x1,x2,x12);
    x13=(*(OBJ(*)(OBJ,OBJ))METHOD(__AIdeOrd_30,1))(__AIdeOrd_30,x1);
    if(ISPRM(x12)){
     HLT("IdeOrd at <31,38-42> : undefined selection succs\'IdeOrd:elem->seq");
    }else{
     {OBJ x23=FLD1(x12,2);
      if(EXPRD(x12,1)){
       x19=x23;
       DSPRDF(x12);
      }else{
       COPY(x23,1);
       x19=x23;
       FRPRD(x12,1);}
      x16=__ABUILTIN_5;}}
    r=_ASeqReduce_3(x13,x6,x19);}
  }else{
   r=x6;
   FRPRD(x1,1);}}
 return r;}

extern OBJ _AIdeOrd_31(register OBJ x1,register OBJ x2) /* tsort */
{OBJ r;OBJ* p1=&r;
 for(;;){
  if(ISPRM(x1)){
   FRPRD(x2,1);
   *p1=__ASeq_6;
  }else{
   CPPRD(x1,1);
   CPCLS(__AIde_14,1);
   {OBJ x13;TUP2 x15;
    x13=_ASetByBSTConv_7(__AIde_14,x1);
    x15=_AIdeOrd_32(x1,__ASeq_6,x2);
    PRD1(2,*p1);FLD1(*p1,1)=x13;
    x1=x15.c1;x2=x15.c2;p1=&FLD1(*p1,2);continue;}}
  break;}
 return r;}

extern TUP2 _AIdeOrd_32(register OBJ x1,register OBJ x2,register OBJ x3) /* decr */
{TUP2 r;
 for(;;){
  if(ISPRM(x1)){
   r.c1=x2;r.c2=x3;
  }else{
   {OBJ x39=FLD1(x1,1);OBJ x40=FLD1(x1,2);
    if(EXPRD(x1,1)){
     DSPRDF(x1);
    }else{
     CPPRD(x39,1);COPY(x40,1);
     FRPRD(x1,1);}
    {OBJ x45;OBJ x46;OBJ x49;OBJ x51;OBJ x52;
     {OBJ x42=FLD(x39,1);
      if(EXPRD(x39,1)){
       x45=x42;
       DSPRD(x39);
      }else{
       x45=x42;
       FRPRD(x39,1);}
      CPPRD(x3,1);}
     AArray_15(x3,x45,x46);
     if(ISPRM(x46)){
      HLT("IdeOrd at <31,38-42> : undefined selection succs\'IdeOrd:elem->seq");
     }else{
      {OBJ x48=FLD1(x46,2);
       if(EXPRD(x46,1)){
	x49=x48;
	DSPRDF(x46);
       }else{
	COPY(x48,1);
	x49=x48;
	FRPRD(x46,1);}}}
     {TUP2 t=_AIdeOrd_33(x49,x2,x3);
      x51=t.c1;
      x52=t.c2;}
     x1=x40;x2=x51;x3=x52;continue;}}}
  break;}
 return r;}
extern OBJ _AIdeOrd_32_c(OBJ x1,OBJ x2,OBJ x3) /* decr */
{OBJ r;
 {TUP2 t=_AIdeOrd_32(x1,x2,x3);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern TUP2 _AIdeOrd_33(register OBJ x1,register OBJ x2,register OBJ x3) /* decrSuccs */
{TUP2 r;
 for(;;){
  if(ISPRM(x1)){
   r.c1=x2;r.c2=x3;
  }else{
   {OBJ x45=FLD1(x1,1);OBJ x46=FLD1(x1,2);
    if(EXPRD(x1,1)){
     DSPRDF(x1);
    }else{
     COPY(x46,1);
     FRPRD(x1,1);}
    CPPRD(x3,1);
    {OBJ x47;OBJ x49;OBJ x53;
     AArray_16(x3,x47);
     ANat_80(x45,x47,x49);
     if(ISTGPRM(x49,1)){
      CPPRD(x3,1);
      {OBJ x50;
       AArray_15(x3,x45,x50);
       if(ISPRM(x50)){
	x53=__ABUILTIN_3;
       }else{
	if(EXPRD(x50,1)){
	 FREE(FLD1(x50,2),1);DSPRDF(x50);
	}else{
	 DCPRD(x50,1);}
	x53=__ABUILTIN_5;}}
     }else{
      x53=__ABUILTIN_3;}
     if(ISTGPRM(x53,1)){
      CPPRD(x3,1);
      {OBJ x54;
       AArray_15(x3,x45,x54);
       if(ISPRM(x54)){
	HLT("IdeOrd at <31,25-30> : undefined selection predCt\'IdeOrd:elem->nat");
       }else{
	{OBJ x66=FLD1(x54,1);FLAG x_x54=EXPRD(x54,1);
	 if(x_x54){
	 }else{}
	 CPCLS(__AIdeOrd_39,1);
	 {OBJ x69;OBJ x70;OBJ x71;OBJ x72;
	  ANat_4(x66,x69);
	  ANat_6(x69,x70);
	  x71=(*(OBJ(*)(OBJ,OBJ))METHOD(__AIdeOrd_39,1))(__AIdeOrd_39,x69);
	  AArray_9(x45,x71,x3,x72);
	  if(ISTGPRM(x70,1)){
	   {OBJ x73;OBJ x74;
	    PRDF(1,1,x73);FLD(x73,1)=x45;
	    if(x_x54){
	     RSOME(x54,x74);FLD1(x74,1)=x73;FREE(FLD1(x74,2),1);FLD1(x74,2)=x2;
	    }else{
	     FRPRD(x54,1);PRD1(2,x74);FLD1(x74,1)=x73;FLD1(x74,2)=x2;}
	    x1=x46;x2=x74;x3=x72;continue;}
	  }else{
	   if(x_x54){
	    FREE(FLD1(x54,2),1);DSPRDF(x54);
	   }else{
	    FRPRD(x54,1);}
	   x1=x46;x3=x72;continue;}}}}}
     }else{
      x1=x46;continue;}}}}
  break;}
 return r;}
extern OBJ _AIdeOrd_33_c(OBJ x1,OBJ x2,OBJ x3) /* decrSuccs */
{OBJ r;
 {TUP2 t=_AIdeOrd_33(x1,x2,x3);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern OBJ _AIdeOrd_34(OBJ x1,OBJ x2,OBJ x3) /* extend'34 */
{OBJ r;
 {OBJ x4;
  ANat_80(x3,x2,x4);
  if(ISTGPRM(x4,1)){
   AArray_15(x1,x3,r);
  }else{
   FRPRD(x1,1);
   r=__AIdeOrd_15;}}
 return r;}

extern OBJ _AIdeOrd_35(OBJ x1,OBJ x2) /* arc'35 */
{OBJ r;
 if(ISPRM(x2)){
  {OBJ x19;
   PRD1F(2,x19);FLD1(x19,1)=x1;FLD1(x19,2)=__ASeq_6;
   PRD1(2,r);FLD1(r,1)=__ANat_5;FLD1(r,2)=x19;}
 }else{
  {OBJ x20=FLD1(x2,1);OBJ x21;FLAG x_x2=EXPRD(x2,1);
   if(x_x2){
   }else{
    x21=FLD1(x2,2);COPY(x21,1);}
   {OBJ x23;
    if(x_x2){
     RSOME(x2,x23);FLD1(x23,1)=x1;
    }else{
     FRPRD(x2,1);PRD1(2,x23);FLD1(x23,1)=x1;FLD1(x23,2)=x21;}
    PRD1(2,r);FLD1(r,1)=x20;FLD1(r,2)=x23;}}}
 return r;}

extern OBJ _AIdeOrd_37(OBJ x1) /* arc'37 */
{OBJ r;
 if(ISPRM(x1)){
  COPY(__AIdeOrd_36,1);
  r=__AIdeOrd_36;
 }else{
  {OBJ x17=FLD1(x1,1);OBJ x18;
   if(EXPRD(x1,1)){
    {
     RSOME(x1,r);
     ANat_2(x17,FLD1(r,1));}
   }else{
    x18=FLD1(x1,2);COPY(x18,1);
    {
     FRPRD(x1,1);PRD1(2,r);FLD1(r,2)=x18;
     ANat_2(x17,FLD1(r,1));}}}}
 return r;}

extern OBJ _AIdeOrd_39(OBJ x1,OBJ x2) /* decrSuccs'39 */
{OBJ r;
 {OBJ x5;
  if(ISPRM(x2)){
   HLT("IdeOrd at <31,38-42> : undefined selection succs\'IdeOrd:elem->seq");
  }else{
   {OBJ x4=FLD1(x2,2);
    if(EXPRD(x2,1)){
     x5=x4;
     DSPRDF(x2);
    }else{
     COPY(x4,1);
     x5=x4;
     FRPRD(x2,1);}}}
  PRD1(2,r);FLD1(r,1)=x1;FLD1(r,2)=x5;}
 return r;}

extern OBJ _AIdeOrd_40(OBJ x1,OBJ x2,OBJ x3) /* topSort'40 */
{OBJ r;
 {OBJ x6;OBJ x10;
  if(ISPRM(x2)){
   x6=__ABUILTIN_3;
  }else{
   x6=__ABUILTIN_5;}
  if(ISTGPRM(x6,1)){
   {OBJ x9;
    if(ISPRM(x2)){
     HLT("IdeOrd at <31,25-30> : undefined selection predCt\'IdeOrd:elem->nat");
    }else{
     {OBJ x7=FLD1(x2,1);
      if(EXPRD(x2,1)){
       x9=x7;
       FREE(FLD1(x2,2),1);DSPRDF(x2);
      }else{
       x9=x7;
       FRPRD(x2,1);}}}
    ANat_6(x9,x10);}
  }else{
   FREE(x2,1);
   x10=__ABUILTIN_3;}
  if(ISTGPRM(x10,1)){
   {OBJ x11;
    PRDF(1,1,x11);FLD(x11,1)=x1;
    PRD1(2,r);FLD1(r,1)=x11;FLD1(r,2)=x3;}
  }else{
   r=x3;}}
 return r;}

extern OBJ _AIdeOrd_41(OBJ x1) /* extrSuccs'41 */
{OBJ r;
 {OBJ x7;OBJ x4;
  if(ISPRM(x1)){
   HLT("IdeOrd at <31,38-42> : undefined selection succs\'IdeOrd:elem->seq");
  }else{
   {OBJ x11=FLD1(x1,1);OBJ x12=FLD1(x1,2);
    if(EXPRD(x1,1)){
     x4=x11;x7=x12;
     DSPRDF(x1);
    }else{
     COPY(x12,1);
     x4=x11;x7=x12;
     FRPRD(x1,1);}}}
  PRD1(2,r);FLD1(r,2)=x7;
  ANat_4(x4,FLD1(r,1));}
 return r;}

extern OBJ _AIdeOrd_43(OBJ x1) /* format'43 */
{OBJ r;
 CPPRD(__AIdeOrd_42,1);
 r=_AFmt_28(__AIdeOrd_42);
 return r;}

extern OBJ _AIdeOrd_45(OBJ x1) /* format'45 */
{OBJ r;
 CPPRD(__AIdeOrd_44,1);
 r=_AFmt_28(__AIdeOrd_44);
 return r;}

extern OBJ _AIdeOrd_47(OBJ x1) /* format'47 */
{OBJ r;
 CPPRD(__AIdeOrd_46,1);
 r=_AFmt_28(__AIdeOrd_46);
 return r;}

extern OBJ _AIdeOrd_49(OBJ x1) /* format'49 */
{OBJ r;
 CPPRD(__AIdeOrd_48,1);
 r=_AFmt_28(__AIdeOrd_48);
 return r;}

extern OBJ _AIdeOrd_51(OBJ x1) /* format'51 */
{OBJ r;
 CPPRD(__AIdeOrd_50,1);
 r=_AFmt_28(__AIdeOrd_50);
 return r;}

extern OBJ _AIdeOrd_52(OBJ x1) /* format'52 */
{OBJ r;
 {OBJ x2;
  PRDF(1,1,x2);FLD(x2,1)=x1;
  r=_AIde_18(x2);}
 return r;}

extern OBJ _AIdeOrd_53(OBJ x1,OBJ x2,OBJ x3) /* format'53 */
{OBJ r;
 if(ISPRM(x2)){
  r=x3;
 }else{
  {OBJ x30=FLD1(x2,1);OBJ x31=FLD1(x2,2);
   if(EXPRD(x2,1)){
    CPCLS(__AIdeOrd_43,1);
    CPCLS(__AIdeOrd_45,1);
    CPCLS(__AIdeOrd_47,1);
    CPCLS(__AIdeOrd_49,1);
    CPCLS(__AIdeOrd_51,1);
    CPCLS(__AIdeOrd_52,1);
    COPY(__AFormat_9,1);
    {OBJ x32;OBJ x33;OBJ x34;OBJ x35;OBJ x36;OBJ x37;OBJ x39;OBJ x40;OBJ x41;OBJ x42;OBJ x43;
     x32=(*(OBJ(*)(OBJ,OBJ))METHOD(__AIdeOrd_51,1))(__AIdeOrd_51,__ABUILTIN_20);
     x33=(*(OBJ(*)(OBJ,OBJ))METHOD(__AIdeOrd_49,1))(__AIdeOrd_49,__ABUILTIN_20);
     x34=(*(OBJ(*)(OBJ,OBJ))METHOD(__AIdeOrd_47,1))(__AIdeOrd_47,__ABUILTIN_20);
     x35=(*(OBJ(*)(OBJ,OBJ))METHOD(__AIdeOrd_45,1))(__AIdeOrd_45,__ABUILTIN_20);
     x36=(*(OBJ(*)(OBJ,OBJ))METHOD(__AIdeOrd_43,1))(__AIdeOrd_43,__ABUILTIN_20);
     PRDF(1,1,x37);FLD(x37,1)=x1;
     ANatConv_1(x30,x39);
     x40=_AIde_18(x37);
     x41=_AFmt_28(x39);
     x42=_AFormatFun1_2(x34,x33,x32,__AIdeOrd_52,x31);
     x43=_ASeq_18(x40,x36,x41,x35,x42,__AFormat_9);
     RSOME(x2,r);FLD1(r,2)=x3;
     FLD1(r,1)=_AFormat_5(__ANat_5,x43);}
   }else{
    COPY(x31,1);
    CPCLS(__AIdeOrd_43,1);
    CPCLS(__AIdeOrd_45,1);
    CPCLS(__AIdeOrd_47,1);
    CPCLS(__AIdeOrd_49,1);
    CPCLS(__AIdeOrd_51,1);
    CPCLS(__AIdeOrd_52,1);
    COPY(__AFormat_9,1);
    {OBJ x32;OBJ x33;OBJ x34;OBJ x35;OBJ x36;OBJ x37;OBJ x39;OBJ x40;OBJ x41;OBJ x42;OBJ x43;
     x32=(*(OBJ(*)(OBJ,OBJ))METHOD(__AIdeOrd_51,1))(__AIdeOrd_51,__ABUILTIN_20);
     x33=(*(OBJ(*)(OBJ,OBJ))METHOD(__AIdeOrd_49,1))(__AIdeOrd_49,__ABUILTIN_20);
     x34=(*(OBJ(*)(OBJ,OBJ))METHOD(__AIdeOrd_47,1))(__AIdeOrd_47,__ABUILTIN_20);
     x35=(*(OBJ(*)(OBJ,OBJ))METHOD(__AIdeOrd_45,1))(__AIdeOrd_45,__ABUILTIN_20);
     x36=(*(OBJ(*)(OBJ,OBJ))METHOD(__AIdeOrd_43,1))(__AIdeOrd_43,__ABUILTIN_20);
     PRDF(1,1,x37);FLD(x37,1)=x1;
     ANatConv_1(x30,x39);
     x40=_AIde_18(x37);
     x41=_AFmt_28(x39);
     x42=_AFormatFun1_2(x34,x33,x32,__AIdeOrd_52,x31);
     x43=_ASeq_18(x40,x36,x41,x35,x42,__AFormat_9);
     FRPRD(x2,1);PRD1(2,r);FLD1(r,2)=x3;
     FLD1(r,1)=_AFormat_5(__ANat_5,x43);}}}}
 return r;}






static OBJ _mt_5_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_5_3_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);
  COPY(FLDCLS(t,3),1);
  DCCLS(t,1);}
 r=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ,OBJ))ENTRY(t))(FLDCLS(t,1),FLDCLS(t,2),FLDCLS(t,3),t1,t2);
 return r;}

init_AIdeOrd()
{
 static int visited=0; if(visited) return; visited=1;
 init_ASeq();
 init_AIde();
 init_AIdeSet();
 init_AFormat();
 init_ANat();
 init_AString();
 init_ACom();
 init_AStream();
 init_AVoid();
 init_AFmt();
 init_AOption();
 init_AChar();
 init_AFile();
 init_AInt();
 init_ASeqReduce();
 init_ASeqMap();
 init_AArray();
 init_AArrayReduce();
 init_AArrayMap();
 init_ANatConv();
 init_APair();
 init_AFormatFun1();
 init_AReal();
 init_ASetByBST();
 init_ASetByBSTFilter();
 init_ASetByBSTConv();
 init_ABSTree();
 init_ATree();
 init_ABSTreeConv();
 CLS(2,_AIdeOrd_31,__AIdeOrd_31);
 CLS(3,_AIdeOrd_30,__AIdeOrd_30);
 CLS(5,_AIdeOrd_28,__AIdeOrd_28);
 CLS(5,_AIdeOrd_27_c,__AIdeOrd_27);
 CLS(4,_AIdeOrd_26_c,__AIdeOrd_26);
 CLS(2,_AIdeOrd_22,__AIdeOrd_22);
 CLS(3,_AIdeOrd_53,__AIdeOrd_53);
 CLS(1,_AIdeOrd_52,__AIdeOrd_52);
 LCLS(1,_AIdeOrd_51,__AIdeOrd_51);
 CLS(1,_AIdeOrd_19,__AIdeOrd_19);
 DEN(">",__AIdeOrd_50);
 CLS(1,_AIdeOrd_18,__AIdeOrd_18);
 LCLS(1,_AIdeOrd_49,__AIdeOrd_49);
 CLS(1,_AIdeOrd_17,__AIdeOrd_17);
 DEN(",",__AIdeOrd_48);
 CLS(1,_AIdeOrd_16,__AIdeOrd_16);
 LCLS(1,_AIdeOrd_47,__AIdeOrd_47);
 DEN(" -> <",__AIdeOrd_46);
 CLS(1,_AIdeOrd_14,__AIdeOrd_14);
 LCLS(1,_AIdeOrd_45,__AIdeOrd_45);
 CLS(1,_AIdeOrd_13,__AIdeOrd_13);
 DEN(")",__AIdeOrd_44);
 CLS(1,_AIdeOrd_12,__AIdeOrd_12);
 LCLS(1,_AIdeOrd_43,__AIdeOrd_43);
 CLS(2,_AIdeOrd_11,__AIdeOrd_11);
 DEN(" (rc=",__AIdeOrd_42);
 CLS(1,_AIdeOrd_41,__AIdeOrd_41);
 CLS(1,_AIdeOrd_9,__AIdeOrd_9);
 CLS(3,_AIdeOrd_40,__AIdeOrd_40);
 CLS(2,_AIdeOrd_8,__AIdeOrd_8);
 CLS(2,_AIdeOrd_39,__AIdeOrd_39);
 CLS(2,_AIdeOrd_7_c,__AIdeOrd_7);
 CLS(1,_AIdeOrd_6,__AIdeOrd_6);
 CLS(1,_AIdeOrd_37,__AIdeOrd_37);
 CLS(2,_AIdeOrd_5,__AIdeOrd_5);
 CLS(3,_AIdeOrd_4,__AIdeOrd_4);
 CLS(2,_AIdeOrd_35,__AIdeOrd_35);
 CLS(1,_AIdeOrd_3,__AIdeOrd_3);
 CLS(3,_AIdeOrd_34,__AIdeOrd_34);
 CLS(3,_AIdeOrd_33_c,__AIdeOrd_33);
 CLS(3,_AIdeOrd_32_c,__AIdeOrd_32);
 MTH(5,0,3,_mt_5_0_3);LZYMTH(5,0,3,_mt_5_0_3);
 MTH(5,3,2,_mt_5_3_2);LZYMTH(5,3,2,_mt_5_3_2);
 PRM1(__AIdeOrd_15);
 __AIdeOrd_20=__ANat_31;
 AArray_3(__AIdeOrd_20,__AIdeOrd_15,__AIdeOrd_2);
 PRD1F(2,__AIdeOrd_36);FLD1(__AIdeOrd_36,1)=__ANat_8;FLD1(__AIdeOrd_36,2)=__ASeq_6;
 PRD1F(2,__AIdeOrd_38);FLD1(__AIdeOrd_38,1)=__ANat_5;FLD1(__AIdeOrd_38,2)=__ASeq_6;}

