

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

#include "Denotation.h"

#include "Nat.h"
extern TUP2 _ASeqMapEnv_4(OBJ,OBJ,OBJ);extern OBJ __ASeqMapEnv_4;
extern OBJ _AAcFun_14(OBJ,OBJ);extern OBJ __AAcFun_14;
extern OBJ _AAcFun_15(OBJ,OBJ);extern OBJ __AAcFun_15;
extern OBJ __ASeq_6;
extern OBJ _ASeq_52(OBJ,OBJ);extern OBJ __ASeq_52;
extern OBJ _ATypeAnFun_4(OBJ);extern OBJ __ATypeAnFun_4;
extern OBJ _ATypeAnFun_8(OBJ,OBJ);extern OBJ __ATypeAnFun_8;
extern OBJ _ATypeAnFun_9(OBJ,OBJ);extern OBJ __ATypeAnFun_9;
extern OBJ _AAc_21(OBJ);extern OBJ __AAc_21;
extern OBJ _AAc_22(OBJ);extern OBJ __AAc_22;
extern OBJ __ABuiltin_1;

#include "Char.h"

#include "Array.h"

#include "Bitset.h"

#include "Int.h"
extern OBJ _AIde_18(OBJ);extern OBJ __AIde_18;
extern OBJ __AOptimAn_24;
extern OBJ _AFormat_10(OBJ,OBJ);extern OBJ __AFormat_10;
extern OBJ _ASet_39(OBJ,OBJ,OBJ);extern OBJ __ASet_39;
extern OBJ _ASet_44(OBJ,OBJ,OBJ);extern OBJ __ASet_44;
extern OBJ _ACalcEvalMethods_1(OBJ,OBJ);OBJ __ACalcEvalMethods_1; /* calcEvalMethods */
extern OBJ _ACalcEvalMethods_3(OBJ,OBJ);OBJ __ACalcEvalMethods_3; /* noBuiltin? */
extern OBJ _ACalcEvalMethods_4(OBJ);OBJ __ACalcEvalMethods_4; /* any */
extern OBJ _ACalcEvalMethods_5(OBJ,OBJ,OBJ);OBJ __ACalcEvalMethods_5; /* calcGivenMethods */
extern OBJ _ACalcEvalMethods_6(OBJ,OBJ,OBJ,OBJ);OBJ __ACalcEvalMethods_6; /* calcRequiredMethods */
extern OBJ _ACalcEvalMethods_7(OBJ);OBJ __ACalcEvalMethods_7; /* retrieveRank */
extern OBJ _ACalcEvalMethods_8(OBJ,OBJ);OBJ __ACalcEvalMethods_8; /* orderMethod */
extern OBJ _ACalcEvalMethods_9(OBJ,OBJ,OBJ,OBJ,OBJ);OBJ __ACalcEvalMethods_9; /* calcMethods */
extern OBJ _ACalcEvalMethods_10(OBJ,OBJ,OBJ,OBJ,OBJ);OBJ __ACalcEvalMethods_10; /* calc */
extern OBJ _ACalcEvalMethods_11(OBJ);OBJ __ACalcEvalMethods_11; /* calcThrunks */
extern TUP2 _ACalcEvalMethods_12(OBJ,OBJ);OBJ __ACalcEvalMethods_12; /* calc'12 */
extern OBJ _ACalcEvalMethods_13(OBJ,OBJ,OBJ,OBJ,OBJ);OBJ __ACalcEvalMethods_13; /* calc'13 */
OBJ __ACalcEvalMethods_14; /* calcMethods'14 */

extern OBJ _ACalcEvalMethods_1(OBJ x1,OBJ x2) /* calcEvalMethods */
{OBJ r;
 CPCLS(__ACalcEvalMethods_3,1);
 CPCLS(__ACalcEvalMethods_4,1);
 CPCLS(__ACalcEvalMethods_5,1);
 CPCLS(__ACalcEvalMethods_6,1);
 FRPRD(x1,1);
 CPPRD(x2,4);
 {OBJ x3;OBJ x4;OBJ x5;OBJ x6;OBJ x7;OBJ x8;
  x3=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACalcEvalMethods_5,1))(__ACalcEvalMethods_5,x2);
  x4=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACalcEvalMethods_3,1))(__ACalcEvalMethods_3,x2);
  x5=_AAcFun_14(__ACalcEvalMethods_4,x2);
  x6=_AAcFun_15(x4,x2);
  x7=_ASeqReduce_3(x3,__ASeq_6,x6);
  x8=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ACalcEvalMethods_6,2))(__ACalcEvalMethods_6,x2,x7);
  r=_ASeqReduce_3(x8,__ASeq_6,x5);}
 return r;}

extern OBJ _ACalcEvalMethods_3(OBJ x1,OBJ x2) /* noBuiltin? */
{OBJ r;
 FRPRD(x1,1);
 {OBJ x3;OBJ x8;OBJ x9;
  x3=_AAc_21(x2);
  if(ISTGPRD(x3,0)){
   {OBJ x5=FLD(x3,2);
    if(EXPRD(x3,1)){
     x8=x5;
     DSPRDF(x3);
    }else{
     x8=x5;
     FRPRD(x3,1);}}
  }else{
   HLT("Ide at <unknown> : undefined selection origin\'Ide:ide->origin");}
  ANat_76(x8,__ABuiltin_1,x9);
  if(ISTGPRM(x9,1)){
   r=__ABUILTIN_3;
  }else{
   r=__ABUILTIN_5;}}
 return r;}

extern OBJ _ACalcEvalMethods_4(OBJ x1) /* any */
{OBJ r;
 FRPRD(x1,1);
 r=__ABUILTIN_5;
 return r;}

extern OBJ _ACalcEvalMethods_5(OBJ x1,OBJ x2,OBJ x3) /* calcGivenMethods */
{OBJ r;
 CPPRD(x2,1);
 {OBJ x4;OBJ x5;OBJ x6;
  x4=_ACalcEvalMethods_7(x2);
  ANat_77(x4,__ANat_59,x5);
  if(ISTGPRM(x5,1)){
   ANat_81(x4,__ANat_5,x6);
  }else{
   x6=__ABUILTIN_3;}
  if(ISTGPRM(x6,1)){
   CPPRD(x2,1);
   CPCLS(__ATypeAnFun_9,1);
   {OBJ x7;OBJ x8;OBJ x9;OBJ x10;
    x7=(*(OBJ(*)(OBJ,OBJ))METHOD(__ATypeAnFun_9,1))(__ATypeAnFun_9,x1);
    x8=_ATypeAnFun_4(x2);
    x9=_AAc_21(x2);
    x10=_ATypeAnFun_8(x7,x8);
    r=_ACalcEvalMethods_9(x9,x4,x10,__ASeq_6,x3);}
  }else{
   FRPRD(x1,1);
   FRPRD(x2,1);
   r=x3;}}
 return r;}

extern OBJ _ACalcEvalMethods_6(OBJ x1,OBJ x2,OBJ x3,OBJ x4) /* calcRequiredMethods */
{OBJ r;
 CPPRD(x3,1);
 {OBJ x5;OBJ x6;OBJ x7;
  x5=_ACalcEvalMethods_7(x3);
  ANat_77(x5,__ANat_59,x6);
  if(ISTGPRM(x6,1)){
   ANat_81(x5,__ANat_5,x7);
  }else{
   x7=__ABUILTIN_3;}
  if(ISTGPRM(x7,1)){
   CPPRD(x3,1);
   CPCLS(__ATypeAnFun_9,1);
   {OBJ x8;OBJ x9;OBJ x10;OBJ x11;
    x8=(*(OBJ(*)(OBJ,OBJ))METHOD(__ATypeAnFun_9,1))(__ATypeAnFun_9,x1);
    x9=_ATypeAnFun_4(x3);
    x10=_AAc_21(x3);
    x11=_ATypeAnFun_8(x8,x9);
    r=_ACalcEvalMethods_9(x10,x5,x11,x2,x4);}
  }else{
   FRPRD(x1,1);
   FREE(x2,1);
   FRPRD(x3,1);
   r=x4;}}
 return r;}

extern OBJ _ACalcEvalMethods_7(OBJ x1) /* retrieveRank */
{OBJ r;
 if(ISTGPRD(x1,3)){
  {OBJ x31=FLD(x1,4);
   if(EXPRD(x1,1)){
    r=x31;
    DSPRD(x1);
   }else{
    r=x31;
    FRPRD(x1,1);}}
 }else{
  {OBJ x32;OBJ x38;OBJ x40;OBJ x44;
   x32=_AAc_22(x1);
   if(ISPRM(x32)){
    x38=__AOptimAn_24;
   }else{
    {OBJ x35=FLD1(x32,3);
     if(EXPRD(x32,1)){
      x38=x35;
      FLD1(x32,3)=NIL;DSPRD(x32);
     }else{
      COPY(x35,1);
      x38=x35;
      FRPRD(x32,1);}}}
   if(ISPRD(x38)&&(ISTGPRD(x38,2))){
    x40=__ABUILTIN_5;
   }else{
    x40=__ABUILTIN_3;}
   if(ISTGPRM(x40,1)){
    x44=__ABUILTIN_5;
   }else{
    if(ISPRD(x38)&&(ISTGPRD(x38,1))){
     x44=__ABUILTIN_5;
    }else{
     x44=__ABUILTIN_3;}}
   if(ISTGPRM(x44,1)){
    if(ISPRD(x38)&&(ISTGPRD(x38,1))){
     {OBJ x46=FLD(x38,2);
      if(EXPRD(x38,1)){
       r=x46;
       DSPRDF(x38);
      }else{
       r=x46;
       FRPRD(x38,1);}}
    }else{
     if(ISPRD(x38)&&(ISTGPRD(x38,2))){
      {OBJ x48=FLD(x38,1);
       if(EXPRD(x38,1)){
	r=x48;
	DSPRDF(x38);
       }else{
	r=x48;
	FRPRD(x38,1);}}
     }else{
      HLT("OptimAn at <unknown> : undefined selection rank\'OptimAn:optimAn->nat");}}
   }else{
    FREE(x38,1);
    r=__ANat_59;}}}
 return r;}

extern OBJ _ACalcEvalMethods_8(OBJ x1,OBJ x2) /* orderMethod */
{OBJ r;
 {OBJ x31=FLD1(x1,1);OBJ x32=FLD1(x1,2);OBJ x33=FLD1(x1,3);
  if(EXPRD(x1,1)){
   DSPRDF(x1);
  }else{
   FRPRD(x1,1);}
  {OBJ x50=FLD1(x2,1);OBJ x51=FLD1(x2,2);OBJ x52=FLD1(x2,3);
   if(EXPRD(x2,1)){
    DSPRDF(x2);
   }else{
    FRPRD(x2,1);}
   {OBJ x53;
    ANat_80(x31,x50,x53);
    if(ISTGPRM(x53,1)){
     r=__ABUILTIN_5;
    }else{
     {OBJ x54;
      ANat_81(x31,x50,x54);
      if(ISTGPRM(x54,1)){
       r=__ABUILTIN_3;
      }else{
       {OBJ x55;
	ANat_80(x32,x51,x55);
	if(ISTGPRM(x55,1)){
	 r=__ABUILTIN_5;
	}else{
	 {OBJ x56;
	  ANat_81(x32,x51,x56);
	  if(ISTGPRM(x56,1)){
	   r=__ABUILTIN_3;
	  }else{
	   ANat_80(x33,x52,r);}}}}}}}}}}
 return r;}

extern OBJ _ACalcEvalMethods_9(OBJ x1,OBJ x2,OBJ x3,OBJ x4,OBJ x5) /* calcMethods */
{OBJ r;
 if(ISPRM(x3)){
  FREE(x4,1);
  FREE(x5,1);
  CPPRD(__ACalcEvalMethods_14,1);
  {OBJ x11;OBJ x12;OBJ x13;
   x11=_AIde_18(x1);
   x12=_AFormat_10(x11,__ANat_59);
   ADenotation_4(__ACalcEvalMethods_14,x12,x13);
   ABUILTIN_12(x13,r);}
 }else{
  FRPRD(x1,1);
  {OBJ x14;
   x14=_ACalcEvalMethods_11(x3);
   r=_ACalcEvalMethods_10(__ANat_5,x2,x14,x4,x5);}}
 return r;}

extern OBJ _ACalcEvalMethods_10(register OBJ x1,register OBJ x2,register OBJ x3,register OBJ x4,register OBJ x5) /* calc */
{OBJ r;
 for(;;){
  if(ISPRM(x3)){
   FREE(x4,1);
   r=x5;
  }else{
   {OBJ x30=FLD1(x3,1);OBJ x31=FLD1(x3,2);
    COPY(x31,1);
    {OBJ x32;
     ANat_80(x1,x2,x32);
     if(ISTGPRM(x32,1)){
      COPY(x4,1);
      CPCLS(__ACalcEvalMethods_12,1);
      CPCLS(__ACalcEvalMethods_13,1);
      {OBJ x34;OBJ x35;TUP2 x37;OBJ x39;
       ANat_61(x1,x30,x34);
       x35=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ))METHOD(__ACalcEvalMethods_13,3))(__ACalcEvalMethods_13,x1,x2,x4);
       x37=_ASeqMapEnv_4(__ACalcEvalMethods_12,__ANat_5,x3);
       x39=_ASeqReduce_3(x35,x5,x37.c2);
       x1=x34;x3=x31;x5=x39;continue;}
     }else{
      if(EXPRD(x3,1)){
       FREE(FLD1(x3,2),1);DSPRDF(x3);
      }else{
       DCPRD(x3,1);}
      FREE(x4,1);
      FREE(x31,1);
      r=x5;}}}}
  break;}
 return r;}

extern OBJ _ACalcEvalMethods_11(register OBJ x1) /* calcThrunks */
{OBJ r;OBJ* p1=&r;
 for(;;){
  if(ISPRD(x1)&&(ISTGPRD(x1,3))){
   {OBJ x17=FLD(x1,1);OBJ x18=FLD(x1,2);
    if(EXPRD(x1,1)){
     DSPRDF(x1);
    }else{
     COPY(x17,1);COPY(x18,1);
     FRPRD(x1,1);}
    {OBJ x19;
     x19=_ASeq_52(x17,__ANat_5);
     PRD1(2,*p1);FLD1(*p1,1)=x19;
     x1=x18;p1=&FLD1(*p1,2);continue;}}
  }else{
   FREE(x1,1);
   *p1=__ASeq_6;}
  break;}
 return r;}

extern TUP2 _ACalcEvalMethods_12(OBJ x1,OBJ x2) /* calc'12 */
{TUP2 r;
 ANat_61(x2,x1,r.c2);
 r.c1=r.c2;
 return r;}
extern OBJ _ACalcEvalMethods_12_c(OBJ x1,OBJ x2) /* calc'12 */
{OBJ r;
 {TUP2 t=_ACalcEvalMethods_12(x1,x2);
  PRD1(2,r);
  FLD1(r,1)=t.c1;
  FLD1(r,2)=t.c2;}
 return r;}

extern OBJ _ACalcEvalMethods_13(OBJ x1,OBJ x2,OBJ x3,OBJ x4,OBJ x5) /* calc'13 */
{OBJ r;
 CPCLS(__ACalcEvalMethods_8,1);
 {OBJ x6;OBJ x7;
  PRD1F(3,x6);FLD1(x6,1)=x2;FLD1(x6,2)=x1;FLD1(x6,3)=x4;
  CPPRD(x6,1);
  x7=_ASet_44(__ACalcEvalMethods_8,x6,x3);
  if(ISTGPRM(x7,1)){
   FRPRD(x6,1);
   r=x5;
  }else{
   CPCLS(__ACalcEvalMethods_8,1);
   r=_ASet_39(__ACalcEvalMethods_8,x6,x5);}}
 return r;}

init_ACalcEvalMethods()
{
 static int visited=0; if(visited) return; visited=1;
 init_ASeqMap();
 init_ASeqReduce();
 init_ASetConv();
 init_ADenotation();
 init_ANat();
 init_ASeqMapEnv();
 init_ATriple();
 init_AAcFun();
 init_ASeq();
 init_ATypeAnFun();
 init_AAc();
 init_ABuiltin();
 init_APreparedOptions();
 init_ASeqConv();
 init_AOcOptions();
 init_AMap();
 init_AChar();
 init_AArray();
 init_ACom();
 init_ASetByBST();
 init_AStream();
 init_ABSTree();
 init_AVoid();
 init_ATree();
 init_AString();
 init_ABitset();
 init_AFile();
 init_AInt();
 init_AOption();
 init_ANatMap();
 init_AIde();
 init_AAn();
 init_ATypeAn();
 init_ASourceAn();
 init_AOptimAn();
 init_ATransAn();
 init_APragmaAn();
 init_AStore();
 init_AFormat();
 init_AFmt();
 init_ASet();
 init_APair();
 init_AIdeMap();
 DEN("calcMethods\'CalcEvalMethods: expected type information for ",__ACalcEvalMethods_14);
 CLS(5,_ACalcEvalMethods_13,__ACalcEvalMethods_13);
 CLS(2,_ACalcEvalMethods_12_c,__ACalcEvalMethods_12);
 CLS(1,_ACalcEvalMethods_11,__ACalcEvalMethods_11);
 CLS(5,_ACalcEvalMethods_10,__ACalcEvalMethods_10);
 CLS(5,_ACalcEvalMethods_9,__ACalcEvalMethods_9);
 CLS(2,_ACalcEvalMethods_8,__ACalcEvalMethods_8);
 CLS(1,_ACalcEvalMethods_7,__ACalcEvalMethods_7);
 CLS(4,_ACalcEvalMethods_6,__ACalcEvalMethods_6);
 CLS(3,_ACalcEvalMethods_5,__ACalcEvalMethods_5);
 CLS(1,_ACalcEvalMethods_4,__ACalcEvalMethods_4);
 CLS(2,_ACalcEvalMethods_3,__ACalcEvalMethods_3);
 CLS(2,_ACalcEvalMethods_1,__ACalcEvalMethods_1);}

