

#include "BUILTIN.h"

#include "Nat.h"
extern OBJ _ACAST_3(OBJ);extern OBJ __ACAST_3;

#include "NatConv.h"

#include "Denotation.h"

#include "Char.h"

#include "Int.h"

#include "Real.h"

#include "Array.h"

#define __AArray_S1_L27 __AArray_27
extern OBJ __AArray_S1_L27;

#define __AArray_S1_L28 __AArray_28
extern OBJ __AArray_S1_L28;

#define __AArray_S1_L29 __AArray_29
extern OBJ __AArray_S1_L29;
extern OBJ _AArray_Ainit(OBJ,OBJ);OBJ __AArray_Ainit; /* init */
extern OBJ _AArray_Ainit_O1(OBJ,OBJ);OBJ __AArray_Ainit_O1; /* init,1 */
OBJ __AArray_Aempty; /* empty */
extern OBJ _AArray_Spp(OBJ,OBJ);OBJ __AArray_Spp; /* ++ */
extern OBJ _AArray_Aupd(OBJ,OBJ,OBJ);OBJ __AArray_Aupd; /* upd */
extern OBJ _AArray_Sie(OBJ,OBJ,OBJ);OBJ __AArray_Sie; /* := */
extern OBJ _AArray_Aupd_O1(OBJ,OBJ,OBJ);OBJ __AArray_Aupd_O1; /* upd,1 */
extern OBJ _AArray_Aswap(OBJ,OBJ,OBJ);OBJ __AArray_Aswap; /* swap */
extern OBJ _AArray_Adelete(OBJ,OBJ,OBJ);OBJ __AArray_Adelete; /* delete */
extern OBJ _AArray_Ainsert(OBJ,OBJ,OBJ);OBJ __AArray_Ainsert; /* insert */
extern OBJ _AArray_Aextend(OBJ,OBJ,OBJ);OBJ __AArray_Aextend; /* extend */
extern OBJ _AArray_Aextend_O1(OBJ,OBJ,OBJ);OBJ __AArray_Aextend_O1; /* extend,1 */
extern OBJ _AArray_S1(OBJ,OBJ);OBJ __AArray_S1; /* ! */
extern OBJ _AArray_S3(OBJ);OBJ __AArray_S3; /* # */
extern OBJ _AArray_Aempty_(OBJ);OBJ __AArray_Aempty_; /* empty? */
extern OBJ _AArray_Aproduct(OBJ,OBJ);OBJ __AArray_Aproduct; /* product */
extern OBJ _AArray_Aproduct_(OBJ);OBJ __AArray_Aproduct_; /* product? */
extern OBJ _AArray_Adummy2(OBJ);OBJ __AArray_Adummy2; /* dummy2 */
extern OBJ _AArray_Adummy1(OBJ);OBJ __AArray_Adummy1; /* dummy1 */
extern OBJ _AArray_AuncheckedSel(OBJ,OBJ);OBJ __AArray_AuncheckedSel; /* uncheckedSel */
extern OBJ _AArray_AuncheckedUpd(OBJ,OBJ,OBJ);OBJ __AArray_AuncheckedUpd; /* uncheckedUpd */
extern OBJ _AArray_AuncheckedUpdFun(OBJ,OBJ,OBJ);OBJ __AArray_AuncheckedUpdFun; /* uncheckedUpdFun */
extern OBJ _AArray_AuncheckedSwap(OBJ,OBJ,OBJ);OBJ __AArray_AuncheckedSwap; /* uncheckedSwap */
OBJ __AArray_S1_L27; /* !'27 */
OBJ __AArray_S1_L28; /* !'28 */
OBJ __AArray_S1_L29; /* !'29 */

#include "Array.hc.c"

extern OBJ _AArray_Aupd(OBJ x1,OBJ x2,OBJ x3) /* upd */
{OBJ r;
 CPPRD(x3,1);
 {OBJ x4;OBJ x5;
  AArray_S3(x3,x4);
  ANat_80(x1,x4,x5);
  if(ISTGPRM(x5,1)){
   AArray_AuncheckedUpd(x1,x2,x3,r);
  }else{
   HLT("upd\'Array: index out of range");}}
 return r;}

extern OBJ _AArray_Sie(OBJ x1,OBJ x2,OBJ x3) /* := */
{OBJ r;
 CPPRD(x1,1);
 {OBJ x4;OBJ x5;
  AArray_S3(x1,x4);
  ANat_80(x2,x4,x5);
  if(ISTGPRM(x5,1)){
   AArray_AuncheckedUpd(x2,x3,x1,r);
  }else{
   HLT(":=\'Array: index out of range");}}
 return r;}

extern OBJ _AArray_Aupd_O1(OBJ x1,OBJ x2,OBJ x3) /* upd,1 */
{OBJ r;
 CPPRD(x3,1);
 {OBJ x4;OBJ x5;
  AArray_S3(x3,x4);
  ANat_80(x1,x4,x5);
  if(ISTGPRM(x5,1)){
   AArray_AuncheckedUpdFun(x1,x2,x3,r);
  }else{
   HLT("upd\'Array:nat**(data->data)**array->array: index out of range");}}
 return r;}

extern OBJ _AArray_Aswap(OBJ x1,OBJ x2,OBJ x3) /* swap */
{OBJ r;
 CPPRD(x1,1);
 {OBJ x4;OBJ x5;OBJ x6;
  AArray_S3(x1,x4);
  ANat_80(x2,x4,x5);
  if(ISTGPRM(x5,1)){
   ANat_80(x3,x4,x6);
  }else{
   x6=__ABUILTIN_3;}
  if(ISTGPRM(x6,1)){
   AArray_AuncheckedSwap(x1,x2,x3,r);
  }else{
   HLT("swap\'Array: index out of range");}}
 return r;}

extern OBJ _AArray_S1(OBJ x1,OBJ x2) /* ! */
{OBJ r;
 CPPRD(x1,1);
 {OBJ x3;OBJ x4;
  AArray_S3(x1,x3);
  ANat_80(x2,x3,x4);
  if(ISTGPRM(x4,1)){
   AArray_AuncheckedSel(x1,x2,r);
  }else{
   FRPRD(x1,1);
   CPPRD(__AArray_S1_L27,1);
   CPPRD(__AArray_S1_L28,1);
   CPPRD(__AArray_S1_L29,1);
   {OBJ x5;OBJ x6;OBJ x7;OBJ x8;OBJ x9;OBJ x10;
    ANatConv_1(x2,x5);
    ANatConv_1(x3,x6);
    ADenotation_4(x6,__AArray_S1_L27,x7);
    ADenotation_4(__AArray_S1_L28,x7,x8);
    ADenotation_4(x5,x8,x9);
    ADenotation_4(__AArray_S1_L29,x9,x10);
    ABUILTIN_12(x10,r);}}}
 return r;}

extern OBJ _AArray_Aempty_(OBJ x1) /* empty? */
{OBJ r;
 {OBJ x2;
  AArray_S3(x1,x2);
  ANat_76(x2,__ANat_5,r);}
 return r;}

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

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

extern OBJ _AArray_Adummy2(OBJ x1) /* dummy2 */
{OBJ r;
 {OBJ x3=FLD1(x1,2);
  if(EXPRD(x1,1)){
   r=x3;
   FREE(FLD1(x1,1),1);DSPRDF(x1);
  }else{
   COPY(x3,1);
   r=x3;
   FRPRD(x1,1);}}
 return r;}

extern OBJ _AArray_Adummy1(OBJ x1) /* dummy1 */
{OBJ r;
 {OBJ x2=FLD1(x1,1);
  if(EXPRD(x1,1)){
   r=x2;
   FREE(FLD1(x1,2),1);DSPRDF(x1);
  }else{
   COPY(x2,1);
   r=x2;
   FRPRD(x1,1);}}
 return r;}

static void ___AArray_5()
{
 /* __AArray_Aempty */
 {OBJ x1;
  x1=_ACAST_3(__ANat_5);
  AArray_Ainit(__ANat_5,x1,__AArray_Aempty);}}

init_AArray()
{
 static int visited=0; if(visited) return; visited=1;
 init_ANat();
 init_ACAST();
 init_ANatConv();
 init_ADenotation();
 init_AChar();
 init_AInt();
 init_AReal();
 DEN("!\'Array: index ",__AArray_29);
 DEN(" out of range (",__AArray_28);
 DEN(")",__AArray_27);
 CLS(3,_AArray_26,__AArray_26);
 CLS(3,_AArray_25,__AArray_25);
 CLS(3,_AArray_24,__AArray_24);
 CLS(2,_AArray_23,__AArray_23);
 CLS(1,_AArray_21,__AArray_21);
 CLS(1,_AArray_20,__AArray_20);
 CLS(1,_AArray_19,__AArray_19);
 CLS(2,_AArray_18,__AArray_18);
 CLS(1,_AArray_17,__AArray_17);
 CLS(1,_AArray_16,__AArray_16);
 CLS(2,_AArray_15,__AArray_15);
 CLS(3,_AArray_14,__AArray_14);
 CLS(3,_AArray_13,__AArray_13);
 CLS(3,_AArray_12,__AArray_12);
 CLS(3,_AArray_11,__AArray_11);
 CLS(3,_AArray_10,__AArray_10);
 CLS(3,_AArray_9,__AArray_9);
 CLS(3,_AArray_8,__AArray_8);
 CLS(3,_AArray_7,__AArray_7);
 CLS(2,_AArray_6,__AArray_6);
 CLS(2,_AArray_4,__AArray_4);
 CLS(2,_AArray_3,__AArray_3);
 init_const_AArray();
 ___AArray_5();}

