

#include "BUILTIN.h"

#include "Int.h"

#define __AInt_S8_L94 __AInt_94
#define _AInt_S8_L94 _AInt_94
#define AInt_94 AInt_S8_L94
extern OBJ __AInt_S8_L94;
extern OBJ _AInt_S8_L94(OBJ);
OBJ __AInt_A0; /* 0 */
OBJ __AInt_A1; /* 1 */
OBJ __AInt_A2; /* 2 */
OBJ __AInt_A3; /* 3 */
OBJ __AInt_A4; /* 4 */
OBJ __AInt_A5; /* 5 */
OBJ __AInt_A6; /* 6 */
OBJ __AInt_A7; /* 7 */
OBJ __AInt_A8; /* 8 */
OBJ __AInt_A9; /* 9 */
OBJ __AInt_A10; /* 10 */
OBJ __AInt_A11; /* 11 */
OBJ __AInt_A12; /* 12 */
OBJ __AInt_A13; /* 13 */
OBJ __AInt_A14; /* 14 */
OBJ __AInt_A15; /* 15 */
OBJ __AInt_A16; /* 16 */
OBJ __AInt_A17; /* 17 */
OBJ __AInt_A18; /* 18 */
OBJ __AInt_A19; /* 19 */
OBJ __AInt_A20; /* 20 */
OBJ __AInt_A21; /* 21 */
OBJ __AInt_A22; /* 22 */
OBJ __AInt_A23; /* 23 */
OBJ __AInt_A24; /* 24 */
OBJ __AInt_A25; /* 25 */
OBJ __AInt_A26; /* 26 */
OBJ __AInt_A27; /* 27 */
OBJ __AInt_A28; /* 28 */
OBJ __AInt_A29; /* 29 */
OBJ __AInt_A30; /* 30 */
OBJ __AInt_A31; /* 31 */
OBJ __AInt_A32; /* 32 */
OBJ __AInt_A64; /* 64 */
OBJ __AInt_A128; /* 128 */
OBJ __AInt_A256; /* 256 */
OBJ __AInt_A512; /* 512 */
OBJ __AInt_A1024; /* 1024 */
OBJ __AInt_A100; /* 100 */
OBJ __AInt_A1000; /* 1000 */
OBJ __AInt_A10000; /* 10000 */
OBJ __AInt_A100000; /* 100000 */
OBJ __AInt_A1000000; /* 1000000 */
OBJ __AInt_Amin; /* min */
OBJ __AInt_Amax; /* max */
extern OBJ _AInt_S1(OBJ);OBJ __AInt_S1; /* ! */
extern OBJ _AInt_Sp(OBJ,OBJ);OBJ __AInt_Sp; /* + */
extern OBJ _AInt_Sm(OBJ,OBJ);OBJ __AInt_Sm; /* - */
extern OBJ _AInt_S8(OBJ,OBJ);OBJ __AInt_S8; /* * */
extern OBJ _AInt_Ss(OBJ,OBJ);OBJ __AInt_Ss; /* / */
extern OBJ _AInt_Adiv(OBJ,OBJ);OBJ __AInt_Adiv; /* div */
extern OBJ _AInt_S5(OBJ,OBJ);OBJ __AInt_S5; /* % */
extern OBJ _AInt_Amod(OBJ,OBJ);OBJ __AInt_Amod; /* mod */
extern OBJ _AInt_S6(OBJ,OBJ);OBJ __AInt_S6; /* ^ */
extern OBJ _AInt_Apow(OBJ,OBJ);OBJ __AInt_Apow; /* pow */
extern OBJ _AInt_Asucc(OBJ);OBJ __AInt_Asucc; /* succ */
extern OBJ _AInt_Apred(OBJ);OBJ __AInt_Apred; /* pred */
extern OBJ _AInt_Adouble(OBJ);OBJ __AInt_Adouble; /* double */
extern OBJ _AInt_Ahalf(OBJ);OBJ __AInt_Ahalf; /* half */
extern OBJ _AInt_Amin_O1(OBJ,OBJ);OBJ __AInt_Amin_O1; /* min,1 */
extern OBJ _AInt_Amax_O1(OBJ,OBJ);OBJ __AInt_Amax_O1; /* max,1 */
extern OBJ _AInt_Asign(OBJ);OBJ __AInt_Asign; /* sign */
extern OBJ _AInt_Sm_O1(OBJ);OBJ __AInt_Sm_O1; /* -,1 */
extern OBJ _AInt_Aabs(OBJ);OBJ __AInt_Aabs; /* abs */
extern OBJ _AInt_Aeven_(OBJ);OBJ __AInt_Aeven_; /* even? */
extern OBJ _AInt_Aodd_(OBJ);OBJ __AInt_Aodd_; /* odd? */
extern OBJ _AInt_Aneg_(OBJ);OBJ __AInt_Aneg_; /* neg? */
extern OBJ _AInt_Azero_(OBJ);OBJ __AInt_Azero_; /* zero? */
extern OBJ _AInt_Apos_(OBJ);OBJ __AInt_Apos_; /* pos? */
extern OBJ _AInt_Se(OBJ,OBJ);OBJ __AInt_Se; /* = */
extern OBJ _AInt_SSe(OBJ,OBJ);OBJ __AInt_SSe; /* |= */
extern OBJ _AInt_Sle(OBJ,OBJ);OBJ __AInt_Sle; /* <= */
extern OBJ _AInt_Sge(OBJ,OBJ);OBJ __AInt_Sge; /* >= */
extern OBJ _AInt_Sl(OBJ,OBJ);OBJ __AInt_Sl; /* < */
extern OBJ _AInt_Sg(OBJ,OBJ);OBJ __AInt_Sg; /* > */
OBJ __AInt_Aprimitive; /* primitive */
extern OBJ _AInt_Aprimitive_(OBJ);OBJ __AInt_Aprimitive_; /* primitive? */
extern OBJ _AInt_AuncheckedSucc(OBJ);OBJ __AInt_AuncheckedSucc; /* uncheckedSucc */
extern OBJ _AInt_AuncheckedPred(OBJ);OBJ __AInt_AuncheckedPred; /* uncheckedPred */
extern OBJ _AInt_AuncheckedAdd(OBJ,OBJ);OBJ __AInt_AuncheckedAdd; /* uncheckedAdd */
extern OBJ _AInt_AuncheckedSub(OBJ,OBJ);OBJ __AInt_AuncheckedSub; /* uncheckedSub */
extern OBJ _AInt_AuncheckedMul(OBJ,OBJ);OBJ __AInt_AuncheckedMul; /* uncheckedMul */
extern OBJ _AInt_AuncheckedDiv(OBJ,OBJ);OBJ __AInt_AuncheckedDiv; /* uncheckedDiv */
extern OBJ _AInt_AuncheckedMod(OBJ,OBJ);OBJ __AInt_AuncheckedMod; /* uncheckedMod */
extern OBJ _AInt_S8_L94(OBJ);OBJ __AInt_S8_L94; /* *'94 */

#include "Int.hc.c"

extern OBJ _AInt_Sp(OBJ x1,OBJ x2) /* + */
{OBJ r;
 {OBJ x3;OBJ x6;
  AInt_Sge(x1,__AInt_A0,x3);
  if(ISTGPRM(x3,1)){
   {OBJ x4;
    AInt_AuncheckedSub(__AInt_Amax,x1,x4);
    AInt_Sg(x4,x2,x6);}
  }else{
   {OBJ x5;
    AInt_AuncheckedSub(__AInt_Amin,x1,x5);
    AInt_Sl(x5,x2,x6);}}
  if(ISTGPRM(x6,1)){
   AInt_AuncheckedAdd(x1,x2,r);
  }else{
   HLT("+\'Int: sum out of range");}}
 return r;}

extern OBJ _AInt_Sm(OBJ x1,OBJ x2) /* - */
{OBJ r;
 {OBJ x3;OBJ x9;
  AInt_Sg(x1,__AInt_A0,x3);
  if(ISTGPRM(x3,1)){
   {OBJ x4;OBJ x5;
    AInt_AuncheckedSub(__AInt_Amax,x1,x4);
    AInt_Sm_O1(x2,x5);
    AInt_Sg(x4,x5,x9);}
  }else{
   {OBJ x6;
    AInt_Sl(x1,__AInt_A0,x6);
    if(ISTGPRM(x6,1)){
     {OBJ x7;OBJ x8;
      AInt_Sm_O1(x2,x7);
      AInt_AuncheckedSub(__AInt_Amin,x1,x8);
      AInt_Sl(x8,x7,x9);}
    }else{
     AInt_SSe(x2,__AInt_Amax,x9);}}}
  if(ISTGPRM(x9,1)){
   AInt_AuncheckedSub(x1,x2,r);
  }else{
   HLT("-\'Int: difference out of range");}}
 return r;}

extern OBJ _AInt_S8(OBJ x1,OBJ x2) /* * */
{OBJ r;
 {OBJ x3;OBJ x12;
  AInt_Se(x1,__AInt_A0,x3);
  if(ISTGPRM(x3,1)){
   x12=__ABUILTIN_5;
  }else{
   {OBJ x4;OBJ x5;OBJ x6;OBJ x7;OBJ x8;
    AInt_Asign(x1,x4);
    AInt_Asign(x2,x5);
    AInt_Aabs(x1,x6);
    AInt_Aabs(x2,x7);
    AInt_Se(x4,x5,x8);
    if(ISTGPRM(x8,1)){
     {OBJ x9;
      AInt_AuncheckedDiv(__AInt_Amax,x6,x9);
      AInt_Sge(x9,x7,x12);}
    }else{
     CPCLS(__AInt_S8_L94,1);
     {OBJ x10;OBJ x11;
      x10=(*(OBJ(*)(OBJ,OBJ))METHOD(__AInt_S8_L94,1))(__AInt_S8_L94,__ABUILTIN_20);
      AInt_AuncheckedDiv(x10,x6,x11);
      AInt_Sge(x11,x7,x12);}}}}
  if(ISTGPRM(x12,1)){
   AInt_AuncheckedMul(x1,x2,r);
  }else{
   HLT("*\'Int: product out of range");}}
 return r;}

extern OBJ _AInt_Ss(OBJ x1,OBJ x2) /* / */
{OBJ r;
 {OBJ x3;
  AInt_SSe(x2,__AInt_A0,x3);
  if(ISTGPRM(x3,1)){
   AInt_AuncheckedDiv(x1,x2,r);
  }else{
   HLT("/\'Int: divisor zero");}}
 return r;}

extern OBJ _AInt_Adiv(OBJ x1,OBJ x2) /* div */
{OBJ r;
 {OBJ x3;
  AInt_SSe(x2,__AInt_A0,x3);
  if(ISTGPRM(x3,1)){
   AInt_AuncheckedDiv(x1,x2,r);
  }else{
   HLT("div\'Int: divisor zero");}}
 return r;}

extern OBJ _AInt_S5(OBJ x1,OBJ x2) /* % */
{OBJ r;
 {OBJ x3;
  AInt_SSe(x2,__AInt_A0,x3);
  if(ISTGPRM(x3,1)){
   AInt_AuncheckedMod(x1,x2,r);
  }else{
   HLT("%\'Int: divisor zero");}}
 return r;}

extern OBJ _AInt_Amod(OBJ x1,OBJ x2) /* mod */
{OBJ r;
 {OBJ x3;
  AInt_SSe(x2,__AInt_A0,x3);
  if(ISTGPRM(x3,1)){
   AInt_AuncheckedMod(x1,x2,r);
  }else{
   HLT("mod\'Int: divisor zero");}}
 return r;}

extern OBJ _AInt_S6(OBJ x1,OBJ x2) /* ^ */
{OBJ r;
 AInt_Apow(x1,x2,r);
 return r;}

extern OBJ _AInt_Asucc(OBJ x1) /* succ */
{OBJ r;
 {OBJ x2;
  AInt_Sl(x1,__AInt_Amax,x2);
  if(ISTGPRM(x2,1)){
   AInt_AuncheckedSucc(x1,r);
  }else{
   HLT("succ\'Int: applied to max");}}
 return r;}

extern OBJ _AInt_Apred(OBJ x1) /* pred */
{OBJ r;
 {OBJ x2;
  AInt_Sg(x1,__AInt_Amin,x2);
  if(ISTGPRM(x2,1)){
   AInt_AuncheckedPred(x1,r);
  }else{
   HLT("pred\'Int: applied to min");}}
 return r;}

extern OBJ _AInt_Adouble(OBJ x1) /* double */
{OBJ r;
 {OBJ x2;OBJ x5;
  AInt_Sge(x1,__AInt_A0,x2);
  if(ISTGPRM(x2,1)){
   {OBJ x3;
    AInt_AuncheckedSub(__AInt_Amax,x1,x3);
    AInt_Sg(x3,x1,x5);}
  }else{
   {OBJ x4;
    AInt_AuncheckedSub(__AInt_Amin,x1,x4);
    AInt_Sl(x4,x1,x5);}}
  if(ISTGPRM(x5,1)){
   AInt_AuncheckedAdd(x1,x1,r);
  }else{
   HLT("double\'Int: operand out of range");}}
 return r;}

extern OBJ _AInt_Ahalf(OBJ x1) /* half */
{OBJ r;
 AInt_Ss(x1,__AInt_A2,r);
 return r;}

extern OBJ _AInt_Amin_O1(OBJ x1,OBJ x2) /* min,1 */
{OBJ r;
 {OBJ x3;
  AInt_Sle(x1,x2,x3);
  if(ISTGPRM(x3,1)){
   r=x1;
  }else{
   r=x2;}}
 return r;}

extern OBJ _AInt_Amax_O1(OBJ x1,OBJ x2) /* max,1 */
{OBJ r;
 {OBJ x3;
  AInt_Sge(x1,x2,x3);
  if(ISTGPRM(x3,1)){
   r=x1;
  }else{
   r=x2;}}
 return r;}

extern OBJ _AInt_Aprimitive_(OBJ x1) /* primitive? */
{OBJ r;
 r=__ABUILTIN_5;
 return r;}

extern OBJ _AInt_S8_L94(OBJ x1) /* *'94 */
{OBJ r;
 AInt_Sm_O1(__AInt_Amin,r);
 return r;}












































static OBJ _mt_1_0_1(OBJ t,OBJ t1) 
{OBJ r;
 DCCLS(t,1);
 r=(*(OBJ(*)(OBJ))ENTRY(t))(t1);
 return r;}
static OBJ _mt_1_0_1_l(OBJ t,OBJ t1) 
{OBJ r;
 DCCLS(t,1);
 r=(*(OBJ(*)(OBJ))ENTRY(t))(t1);
 COPY(r,1);LZYCLS(t,r);
 return r;}

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

init_AInt()
{
 static int visited=0; if(visited) return; visited=1;
 CLS(2,_AInt_63,__AInt_63);
 LCLS(1,_AInt_94,__AInt_94);
 CLS(2,_AInt_62,__AInt_62);
 CLS(2,_AInt_93,__AInt_93);
 CLS(2,_AInt_61,__AInt_61);
 CLS(2,_AInt_92,__AInt_92);
 CLS(2,_AInt_60,__AInt_60);
 CLS(2,_AInt_91,__AInt_91);
 CLS(2,_AInt_59,__AInt_59);
 CLS(2,_AInt_90,__AInt_90);
 CLS(2,_AInt_58,__AInt_58);
 CLS(2,_AInt_89,__AInt_89);
 CLS(2,_AInt_57,__AInt_57);
 CLS(1,_AInt_88,__AInt_88);
 CLS(2,_AInt_56,__AInt_56);
 CLS(1,_AInt_87,__AInt_87);
 CLS(1,_AInt_55,__AInt_55);
 CLS(1,_AInt_86,__AInt_86);
 CLS(2,_AInt_84,__AInt_84);
 CLS(2,_AInt_83,__AInt_83);
 CLS(2,_AInt_82,__AInt_82);
 CLS(2,_AInt_81,__AInt_81);
 CLS(2,_AInt_80,__AInt_80);
 CLS(2,_AInt_79,__AInt_79);
 CLS(1,_AInt_78,__AInt_78);
 CLS(1,_AInt_77,__AInt_77);
 CLS(1,_AInt_76,__AInt_76);
 CLS(1,_AInt_75,__AInt_75);
 CLS(1,_AInt_74,__AInt_74);
 CLS(1,_AInt_73,__AInt_73);
 CLS(1,_AInt_72,__AInt_72);
 CLS(1,_AInt_71,__AInt_71);
 CLS(2,_AInt_70,__AInt_70);
 CLS(2,_AInt_69,__AInt_69);
 CLS(1,_AInt_68,__AInt_68);
 CLS(1,_AInt_67,__AInt_67);
 CLS(1,_AInt_66,__AInt_66);
 CLS(1,_AInt_65,__AInt_65);
 CLS(2,_AInt_64,__AInt_64);
 MTH(1,0,1,_mt_1_0_1);LZYMTH(1,0,1,_mt_1_0_1_l);
 MTH(2,0,2,_mt_2_0_2);LZYMTH(2,0,2,_mt_2_0_2);
 init_const_AInt();
 /* __AInt_A1 */
 AInt_Asucc(__AInt_A0,__AInt_A1);
 /* __AInt_A2 */
 AInt_Asucc(__AInt_A1,__AInt_A2);
 /* __AInt_A3 */
 AInt_Asucc(__AInt_A2,__AInt_A3);
 /* __AInt_A4 */
 AInt_Asucc(__AInt_A3,__AInt_A4);
 /* __AInt_A5 */
 AInt_Asucc(__AInt_A4,__AInt_A5);
 /* __AInt_A6 */
 AInt_Asucc(__AInt_A5,__AInt_A6);
 /* __AInt_A7 */
 AInt_Asucc(__AInt_A6,__AInt_A7);
 /* __AInt_A8 */
 AInt_Asucc(__AInt_A7,__AInt_A8);
 /* __AInt_A9 */
 AInt_Asucc(__AInt_A8,__AInt_A9);
 /* __AInt_A10 */
 AInt_Asucc(__AInt_A9,__AInt_A10);
 /* __AInt_A11 */
 AInt_Asucc(__AInt_A10,__AInt_A11);
 /* __AInt_A12 */
 AInt_Asucc(__AInt_A11,__AInt_A12);
 /* __AInt_A13 */
 AInt_Asucc(__AInt_A12,__AInt_A13);
 /* __AInt_A14 */
 AInt_Asucc(__AInt_A13,__AInt_A14);
 /* __AInt_A15 */
 AInt_Asucc(__AInt_A14,__AInt_A15);
 /* __AInt_A16 */
 AInt_Asucc(__AInt_A15,__AInt_A16);
 /* __AInt_A17 */
 AInt_Asucc(__AInt_A16,__AInt_A17);
 /* __AInt_A18 */
 AInt_Asucc(__AInt_A17,__AInt_A18);
 /* __AInt_A19 */
 AInt_Asucc(__AInt_A18,__AInt_A19);
 /* __AInt_A20 */
 AInt_Asucc(__AInt_A19,__AInt_A20);
 /* __AInt_A21 */
 AInt_Asucc(__AInt_A20,__AInt_A21);
 /* __AInt_A22 */
 AInt_Asucc(__AInt_A21,__AInt_A22);
 /* __AInt_A23 */
 AInt_Asucc(__AInt_A22,__AInt_A23);
 /* __AInt_A24 */
 AInt_Asucc(__AInt_A23,__AInt_A24);
 /* __AInt_A25 */
 AInt_Asucc(__AInt_A24,__AInt_A25);
 /* __AInt_A26 */
 AInt_Asucc(__AInt_A25,__AInt_A26);
 /* __AInt_A27 */
 AInt_Asucc(__AInt_A26,__AInt_A27);
 /* __AInt_A28 */
 AInt_Asucc(__AInt_A27,__AInt_A28);
 /* __AInt_A29 */
 AInt_Asucc(__AInt_A28,__AInt_A29);
 /* __AInt_A30 */
 AInt_Asucc(__AInt_A29,__AInt_A30);
 /* __AInt_A31 */
 AInt_Asucc(__AInt_A30,__AInt_A31);
 /* __AInt_A32 */
 AInt_Asucc(__AInt_A31,__AInt_A32);
 /* __AInt_A64 */
 AInt_S8(__AInt_A2,__AInt_A32,__AInt_A64);
 /* __AInt_A128 */
 AInt_S8(__AInt_A2,__AInt_A64,__AInt_A128);
 /* __AInt_A256 */
 AInt_S8(__AInt_A2,__AInt_A128,__AInt_A256);
 /* __AInt_A512 */
 AInt_S8(__AInt_A2,__AInt_A256,__AInt_A512);
 /* __AInt_A1024 */
 AInt_S8(__AInt_A2,__AInt_A512,__AInt_A1024);
 /* __AInt_A100 */
 AInt_S8(__AInt_A10,__AInt_A10,__AInt_A100);
 /* __AInt_A1000 */
 AInt_S8(__AInt_A100,__AInt_A10,__AInt_A1000);
 /* __AInt_A10000 */
 AInt_S8(__AInt_A1000,__AInt_A10,__AInt_A10000);
 /* __AInt_A100000 */
 AInt_S8(__AInt_A10000,__AInt_A10,__AInt_A100000);
 /* __AInt_A1000000 */
 AInt_S8(__AInt_A100000,__AInt_A10,__AInt_A1000000);
 /* __AInt_Aprimitive */
 PRM1(__AInt_Aprimitive);}

