

#include "BUILTIN.h"

#include "Nat.h"
extern OBJ __AVoid_2;

#include "Char.h"
extern OBJ _ACom_47(OBJ,OBJ);extern OBJ __ACom_47;
extern OBJ __AStream_4;
extern OBJ __AStream_5;
extern OBJ _AStream_16(OBJ);extern OBJ __AStream_16;
extern OBJ _AStream_17(OBJ);extern OBJ __AStream_17;
extern OBJ _AOcOptions_14(OBJ,OBJ);extern OBJ __AOcOptions_14;
extern OBJ __ASeq_6;
extern OBJ _AFile_14(OBJ);extern OBJ __AFile_14;
extern OBJ _AFile_25(OBJ,OBJ);extern OBJ __AFile_25;
extern OBJ _AFile_26(OBJ,OBJ);extern OBJ __AFile_26;
extern OBJ _AFile_27(OBJ,OBJ);extern OBJ __AFile_27;
extern OBJ _AFile_28(OBJ,OBJ);extern OBJ __AFile_28;
extern OBJ _AFile_29(OBJ,OBJ);extern OBJ __AFile_29;

#include "Int.h"

#include "Denotation.h"
extern OBJ _AComCompose_3(OBJ,OBJ);extern OBJ __AComCompose_3;
extern OBJ _AComCompose_4(OBJ,OBJ);extern OBJ __AComCompose_4;
extern OBJ __AOcExit_2;

#include "Bitset.h"
extern OBJ _AOcStream_1(OBJ,OBJ);OBJ __AOcStream_1; /* create */
extern OBJ _AOcStream_2(OBJ,OBJ);OBJ __AOcStream_2; /* append */
extern OBJ _AOcStream_3(OBJ,OBJ);OBJ __AOcStream_3; /* close */
extern OBJ _AOcStream_4(OBJ,OBJ,OBJ);OBJ __AOcStream_4; /* write */
extern OBJ _AOcStream_5(OBJ,OBJ,OBJ);OBJ __AOcStream_5; /* write,1 */
extern OBJ _AOcStream_6(OBJ,OBJ,OBJ);OBJ __AOcStream_6; /* write,2 */
extern OBJ _AOcStream_7(OBJ,OBJ,OBJ);OBJ __AOcStream_7; /* writeLine */
extern OBJ _AOcStream_8(OBJ,OBJ,OBJ);OBJ __AOcStream_8; /* writeLine,1 */
extern OBJ _AOcStream_9(OBJ,OBJ);OBJ __AOcStream_9; /* traceWriting */
extern OBJ _AOcStream_18(OBJ);OBJ __AOcStream_18; /* writeErr */
extern OBJ _AOcStream_19(OBJ,OBJ);OBJ __AOcStream_19; /* writeErr,1 */
OBJ __AOcStream_20; /* traceWriting'20 */
OBJ __AOcStream_21; /* traceWriting'21 */
OBJ __AOcStream_22; /* traceWriting'22 */
extern OBJ _AOcStream_23(OBJ);OBJ __AOcStream_23; /* traceWriting'23 */
OBJ __AOcStream_24; /* writeErr,1'24 */
OBJ __AOcStream_25; /* writeErr,1'25 */
extern OBJ _AOcStream_26(OBJ);OBJ __AOcStream_26; /* writeErr,1'26 */
OBJ __AOcStream_27; /* writeErr,1'27 */
extern OBJ _AOcStream_28(OBJ,OBJ);OBJ __AOcStream_28; /* create'28 */
extern OBJ _AOcStream_29(OBJ,OBJ);OBJ __AOcStream_29; /* create'29 */
extern OBJ _AOcStream_30(OBJ,OBJ);OBJ __AOcStream_30; /* append'30 */
extern OBJ _AOcStream_31(OBJ,OBJ);OBJ __AOcStream_31; /* append'31 */
OBJ __AOcStream_32; /* writeErr'32 */
OBJ __AOcStream_33; /* writeErr'33 */
extern OBJ _AOcStream_34(OBJ);OBJ __AOcStream_34; /* writeErr'34 */
extern OBJ _AOcStream_35(OBJ);OBJ __AOcStream_35; /* close'35 */
extern OBJ _AOcStream_36(OBJ);OBJ __AOcStream_36; /* write'36 */
extern OBJ _AOcStream_37(OBJ);OBJ __AOcStream_37; /* write,1'37 */
extern OBJ _AOcStream_38(OBJ);OBJ __AOcStream_38; /* write,2'38 */
extern OBJ _AOcStream_39(OBJ);OBJ __AOcStream_39; /* writeLine'39 */
extern OBJ _AOcStream_40(OBJ);OBJ __AOcStream_40; /* writeLine,1'40 */

extern OBJ _AOcStream_1(OBJ x1,OBJ x2) /* create */
{OBJ r;
 CPCLS(__AOcStream_29,1);
 CPPRD(x2,1);
 {OBJ x3;OBJ x4;
  x3=_AOcStream_9(x1,x2);
  x4=(*(OBJ(*)(OBJ,OBJ))METHOD(__AOcStream_29,1))(__AOcStream_29,x2);
  r=_AComCompose_3(x3,x4);}
 return r;}

extern OBJ _AOcStream_2(OBJ x1,OBJ x2) /* append */
{OBJ r;
 CPCLS(__AOcStream_31,1);
 CPPRD(x2,1);
 {OBJ x3;OBJ x4;
  x3=_AOcStream_9(x1,x2);
  x4=(*(OBJ(*)(OBJ,OBJ))METHOD(__AOcStream_31,1))(__AOcStream_31,x2);
  r=_AComCompose_3(x3,x4);}
 return r;}

extern OBJ _AOcStream_3(OBJ x1,OBJ x2) /* close */
{OBJ r;
 CPCLS(__AOcStream_35,1);
 FRPRD(x1,1);
 {OBJ x3;
  x3=_AFile_14(x2);
  r=_AComCompose_3(x3,__AOcStream_35);}
 return r;}

extern OBJ _AOcStream_4(OBJ x1,OBJ x2,OBJ x3) /* write */
{OBJ r;
 CPCLS(__AOcStream_36,1);
 FRPRD(x1,1);
 {OBJ x4;
  x4=_AFile_25(x2,x3);
  r=_AComCompose_3(x4,__AOcStream_36);}
 return r;}

extern OBJ _AOcStream_5(OBJ x1,OBJ x2,OBJ x3) /* write,1 */
{OBJ r;
 CPCLS(__AOcStream_37,1);
 FRPRD(x1,1);
 {OBJ x4;
  x4=_AFile_26(x2,x3);
  r=_AComCompose_3(x4,__AOcStream_37);}
 return r;}

extern OBJ _AOcStream_6(OBJ x1,OBJ x2,OBJ x3) /* write,2 */
{OBJ r;
 CPCLS(__AOcStream_38,1);
 FRPRD(x1,1);
 {OBJ x4;
  x4=_AFile_27(x2,x3);
  r=_AComCompose_3(x4,__AOcStream_38);}
 return r;}

extern OBJ _AOcStream_7(OBJ x1,OBJ x2,OBJ x3) /* writeLine */
{OBJ r;
 CPCLS(__AOcStream_39,1);
 FRPRD(x1,1);
 {OBJ x4;
  x4=_AFile_29(x2,x3);
  r=_AComCompose_3(x4,__AOcStream_39);}
 return r;}

extern OBJ _AOcStream_8(OBJ x1,OBJ x2,OBJ x3) /* writeLine,1 */
{OBJ r;
 CPCLS(__AOcStream_40,1);
 FRPRD(x1,1);
 {OBJ x4;
  x4=_AFile_28(x2,x3);
  r=_AComCompose_3(x4,__AOcStream_40);}
 return r;}

extern OBJ _AOcStream_9(OBJ x1,OBJ x2) /* traceWriting */
{OBJ r;
 CPPRD(__AOcStream_20,1);
 {OBJ x3;
  x3=_AOcOptions_14(__AOcStream_20,x1);
  if(ISTGPRM(x3,1)){
   CPPRD(__AOcStream_21,1);
   {OBJ x4;
    ADenotation_4(__AOcStream_21,x2,x4);
    r=_AFile_28(__AStream_4,x4);}
  }else{
   FRPRD(x2,1);
   CPCLS(__AOcStream_23,1);
   {OBJ x5;
    x5=(*(OBJ(*)(OBJ,OBJ))METHOD(__AOcStream_23,1))(__AOcStream_23,__ABUILTIN_20);
    PRD(2,0,r);FLD(r,1)=x5;FLD(r,2)=__ASeq_6;}}}
 return r;}

extern OBJ _AOcStream_18(OBJ x1) /* writeErr */
{OBJ r;
 CPPRD(__AOcStream_32,1);
 CPCLS(__AOcStream_34,1);
 {OBJ x2;OBJ x3;OBJ x4;OBJ x5;
  ADenotation_4(__AOcStream_32,x1,x2);
  x3=_AFile_28(__AStream_5,x2);
  x4=(*(OBJ(*)(OBJ,OBJ))METHOD(__AOcStream_34,1))(__AOcStream_34,__ABUILTIN_20);
  PRD(2,0,x5);FLD(x5,1)=x4;FLD(x5,2)=__ASeq_6;
  r=_AComCompose_4(x3,x5);}
 return r;}

extern OBJ _AOcStream_19(OBJ x1,OBJ x2) /* writeErr,1 */
{OBJ r;
 CPPRD(__AOcStream_24,1);
 CPCLS(__AOcStream_26,1);
 CPPRD(__AOcStream_27,1);
 {OBJ x3;OBJ x4;OBJ x5;OBJ x6;OBJ x7;OBJ x8;
  ADenotation_4(__AOcStream_24,x2,x3);
  ADenotation_4(x1,x3,x4);
  x5=(*(OBJ(*)(OBJ,OBJ))METHOD(__AOcStream_26,1))(__AOcStream_26,__ABUILTIN_20);
  ADenotation_4(__AOcStream_27,x4,x6);
  PRD(2,0,x7);FLD(x7,1)=x5;FLD(x7,2)=__ASeq_6;
  x8=_AFile_28(__AStream_5,x6);
  r=_AComCompose_4(x8,x7);}
 return r;}

extern OBJ _AOcStream_23(OBJ x1) /* traceWriting'23 */
{OBJ r;
 CPPRD(__AOcStream_22,1);
 CPCLS(__ACom_47,1);
 r=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACom_47,1))(__ACom_47,__AOcStream_22);
 return r;}

extern OBJ _AOcStream_26(OBJ x1) /* writeErr,1'26 */
{OBJ r;
 CPPRD(__AOcStream_25,1);
 CPCLS(__ACom_47,1);
 r=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACom_47,1))(__ACom_47,__AOcStream_25);
 return r;}

extern OBJ _AOcStream_28(OBJ x1,OBJ x2) /* create'28 */
{OBJ r;
 if(ISTGPRD(x2,0)){
  FRPRD(x1,1);
  CPCLS(__ACom_47,1);
  {OBJ x15;
   x15=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACom_47,1))(__ACom_47,x2);
   PRD(2,0,r);FLD(r,1)=x15;FLD(r,2)=__ASeq_6;}
 }else{
  {OBJ x16=FLD(x2,1);
   if(EXPRD(x2,1)){
    DSPRDF(x2);
   }else{
    CPPRD(x16,1);
    FRPRD(x2,1);}
   r=_AOcStream_19(x1,x16);}}
 return r;}

extern OBJ _AOcStream_29(OBJ x1,OBJ x2) /* create'29 */
{OBJ r;
 CPCLS(__AOcStream_28,1);
 CPPRD(x1,1);
 FRPRD(x2,1);
 {OBJ x3;OBJ x4;
  x3=_AStream_16(x1);
  x4=(*(OBJ(*)(OBJ,OBJ))METHOD(__AOcStream_28,1))(__AOcStream_28,x1);
  r=_AComCompose_3(x3,x4);}
 return r;}

extern OBJ _AOcStream_30(OBJ x1,OBJ x2) /* append'30 */
{OBJ r;
 if(ISTGPRD(x2,0)){
  FRPRD(x1,1);
  CPCLS(__ACom_47,1);
  {OBJ x15;
   x15=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACom_47,1))(__ACom_47,x2);
   PRD(2,0,r);FLD(r,1)=x15;FLD(r,2)=__ASeq_6;}
 }else{
  {OBJ x16=FLD(x2,1);
   if(EXPRD(x2,1)){
    DSPRDF(x2);
   }else{
    CPPRD(x16,1);
    FRPRD(x2,1);}
   r=_AOcStream_19(x1,x16);}}
 return r;}

extern OBJ _AOcStream_31(OBJ x1,OBJ x2) /* append'31 */
{OBJ r;
 CPCLS(__AOcStream_30,1);
 CPPRD(x1,1);
 FRPRD(x2,1);
 {OBJ x3;OBJ x4;
  x3=_AStream_17(x1);
  x4=(*(OBJ(*)(OBJ,OBJ))METHOD(__AOcStream_30,1))(__AOcStream_30,x1);
  r=_AComCompose_3(x3,x4);}
 return r;}

extern OBJ _AOcStream_34(OBJ x1) /* writeErr'34 */
{OBJ r;
 CPPRD(__AOcStream_33,1);
 CPCLS(__ACom_47,1);
 r=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACom_47,1))(__ACom_47,__AOcStream_33);
 return r;}

extern OBJ _AOcStream_35(OBJ x1) /* close'35 */
{OBJ r;
 if(ISTGPRD(x1,0)){
  CPCLS(__ACom_47,1);
  {OBJ x14;
   x14=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACom_47,1))(__ACom_47,x1);
   PRD(2,0,r);FLD(r,1)=x14;FLD(r,2)=__ASeq_6;}
 }else{
  {OBJ x15=FLD(x1,1);
   if(EXPRD(x1,1)){
    DSPRDF(x1);
   }else{
    CPPRD(x15,1);
    FRPRD(x1,1);}
   r=_AOcStream_18(x15);}}
 return r;}

extern OBJ _AOcStream_36(OBJ x1) /* write'36 */
{OBJ r;
 if(ISTGPRD(x1,0)){
  CPCLS(__ACom_47,1);
  {OBJ x14;
   x14=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACom_47,1))(__ACom_47,x1);
   PRD(2,0,r);FLD(r,1)=x14;FLD(r,2)=__ASeq_6;}
 }else{
  {OBJ x15=FLD(x1,1);
   if(EXPRD(x1,1)){
    DSPRDF(x1);
   }else{
    CPPRD(x15,1);
    FRPRD(x1,1);}
   r=_AOcStream_18(x15);}}
 return r;}

extern OBJ _AOcStream_37(OBJ x1) /* write,1'37 */
{OBJ r;
 if(ISTGPRD(x1,0)){
  CPCLS(__ACom_47,1);
  {OBJ x14;
   x14=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACom_47,1))(__ACom_47,x1);
   PRD(2,0,r);FLD(r,1)=x14;FLD(r,2)=__ASeq_6;}
 }else{
  {OBJ x15=FLD(x1,1);
   if(EXPRD(x1,1)){
    DSPRDF(x1);
   }else{
    CPPRD(x15,1);
    FRPRD(x1,1);}
   r=_AOcStream_18(x15);}}
 return r;}

extern OBJ _AOcStream_38(OBJ x1) /* write,2'38 */
{OBJ r;
 if(ISTGPRD(x1,0)){
  CPCLS(__ACom_47,1);
  {OBJ x14;
   x14=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACom_47,1))(__ACom_47,x1);
   PRD(2,0,r);FLD(r,1)=x14;FLD(r,2)=__ASeq_6;}
 }else{
  {OBJ x15=FLD(x1,1);
   if(EXPRD(x1,1)){
    DSPRDF(x1);
   }else{
    CPPRD(x15,1);
    FRPRD(x1,1);}
   r=_AOcStream_18(x15);}}
 return r;}

extern OBJ _AOcStream_39(OBJ x1) /* writeLine'39 */
{OBJ r;
 if(ISTGPRD(x1,0)){
  CPCLS(__ACom_47,1);
  {OBJ x14;
   x14=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACom_47,1))(__ACom_47,x1);
   PRD(2,0,r);FLD(r,1)=x14;FLD(r,2)=__ASeq_6;}
 }else{
  {OBJ x15=FLD(x1,1);
   if(EXPRD(x1,1)){
    DSPRDF(x1);
   }else{
    CPPRD(x15,1);
    FRPRD(x1,1);}
   r=_AOcStream_18(x15);}}
 return r;}

extern OBJ _AOcStream_40(OBJ x1) /* writeLine,1'40 */
{OBJ r;
 if(ISTGPRD(x1,0)){
  CPCLS(__ACom_47,1);
  {OBJ x14;
   x14=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACom_47,1))(__ACom_47,x1);
   PRD(2,0,r);FLD(r,1)=x14;FLD(r,2)=__ASeq_6;}
 }else{
  {OBJ x15=FLD(x1,1);
   if(EXPRD(x1,1)){
    DSPRDF(x1);
   }else{
    CPPRD(x15,1);
    FRPRD(x1,1);}
   r=_AOcStream_18(x15);}}
 return r;}




init_AOcStream()
{
 static int visited=0; if(visited) return; visited=1;
 init_ANat();
 init_AVoid();
 init_AChar();
 init_AString();
 init_ACom();
 init_AStream();
 init_AOcOptions();
 init_ASeq();
 init_AFile();
 init_AInt();
 init_AOption();
 init_ADenotation();
 init_AComCompose();
 init_AOcExit();
 init_ASeqMap();
 init_ATree();
 init_ABitset();
 init_APair();
 init_ASet();
 init_AMap();
 init_AMapReduce();
 init_ASeqReduce();
 init_ASetByBST();
 init_ABSTree();
 CLS(2,_AOcStream_31,__AOcStream_31);
 CLS(2,_AOcStream_30,__AOcStream_30);
 CLS(2,_AOcStream_29,__AOcStream_29);
 CLS(2,_AOcStream_28,__AOcStream_28);
 DEN("I/O write-open error: ",__AOcStream_27);
 LCLS(1,_AOcStream_26,__AOcStream_26);
 DEN(" : ",__AOcStream_24);
 LCLS(1,_AOcStream_23,__AOcStream_23);
 DEN("writing ",__AOcStream_21);
 DEN("traceIO",__AOcStream_20);
 CLS(2,_AOcStream_19,__AOcStream_19);
 CLS(1,_AOcStream_18,__AOcStream_18);
 CLS(2,_AOcStream_9,__AOcStream_9);
 CLS(1,_AOcStream_40,__AOcStream_40);
 CLS(3,_AOcStream_8,__AOcStream_8);
 CLS(1,_AOcStream_39,__AOcStream_39);
 CLS(3,_AOcStream_7,__AOcStream_7);
 CLS(1,_AOcStream_38,__AOcStream_38);
 CLS(3,_AOcStream_6,__AOcStream_6);
 CLS(1,_AOcStream_37,__AOcStream_37);
 CLS(3,_AOcStream_5,__AOcStream_5);
 CLS(1,_AOcStream_36,__AOcStream_36);
 CLS(3,_AOcStream_4,__AOcStream_4);
 CLS(1,_AOcStream_35,__AOcStream_35);
 CLS(2,_AOcStream_3,__AOcStream_3);
 LCLS(1,_AOcStream_34,__AOcStream_34);
 CLS(2,_AOcStream_2,__AOcStream_2);
 CLS(2,_AOcStream_1,__AOcStream_1);
 DEN("I/O write error: ",__AOcStream_32);
 PRDF(1,0,__AOcStream_22);FLD(__AOcStream_22,1)=__AVoid_2;
 CPPRD(__AOcExit_2,1);
 PRD(1,1,__AOcStream_25);FLD(__AOcStream_25,1)=__AOcExit_2;
 CPPRD(__AOcExit_2,1);
 PRD(1,1,__AOcStream_33);FLD(__AOcStream_33,1)=__AOcExit_2;}

