

#include "BUILTIN.h"
extern OBJ __AVoid_2;
extern OBJ _AOcOptions_14(OBJ,OBJ);extern OBJ __AOcOptions_14;
extern OBJ __AOption_5;
extern OBJ _ACom_47(OBJ,OBJ);extern OBJ __ACom_47;

#include "Nat.h"
extern OBJ __ASeq_6;

#include "Char.h"
extern OBJ __AStream_4;
extern OBJ __AStream_5;
extern OBJ _AFile_28(OBJ,OBJ);extern OBJ __AFile_28;

#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 _ABinStream_6(OBJ,OBJ,OBJ);extern OBJ __ABinStream_6;
extern OBJ _ABinStream_8(OBJ,OBJ);extern OBJ __ABinStream_8;
extern OBJ __AOcExit_2;

#include "Bitset.h"
extern OBJ _AOcBinStream_2(OBJ,OBJ,OBJ,OBJ);OBJ __AOcBinStream_2; /* write */
extern OBJ _AOcBinStream_3(OBJ,OBJ,OBJ);OBJ __AOcBinStream_3; /* read */
extern OBJ _AOcBinStream_4(OBJ,OBJ,OBJ);OBJ __AOcBinStream_4; /* optread */
extern OBJ _AOcBinStream_5(OBJ,OBJ,OBJ);OBJ __AOcBinStream_5; /* trace */
extern OBJ _AOcBinStream_9(OBJ,OBJ);OBJ __AOcBinStream_9; /* writeErr */
OBJ __AOcBinStream_10; /* trace'10 */
OBJ __AOcBinStream_11; /* trace'11 */
extern OBJ _AOcBinStream_12(OBJ);OBJ __AOcBinStream_12; /* trace'12 */
OBJ __AOcBinStream_13; /* writeErr'13 */
OBJ __AOcBinStream_14; /* writeErr'14 */
OBJ __AOcBinStream_15; /* write'15 */
OBJ __AOcBinStream_16; /* write'16 */
extern OBJ _AOcBinStream_17(OBJ);OBJ __AOcBinStream_17; /* write'17 */
extern OBJ _AOcBinStream_18(OBJ,OBJ);OBJ __AOcBinStream_18; /* write'18 */
extern OBJ _AOcBinStream_19(OBJ,OBJ,OBJ,OBJ);OBJ __AOcBinStream_19; /* write'19 */
OBJ __AOcBinStream_20; /* read'20 */
OBJ __AOcBinStream_21; /* read'21 */
extern OBJ _AOcBinStream_22(OBJ);OBJ __AOcBinStream_22; /* read'22 */
extern OBJ _AOcBinStream_23(OBJ,OBJ);OBJ __AOcBinStream_23; /* read'23 */
extern OBJ _AOcBinStream_24(OBJ,OBJ,OBJ);OBJ __AOcBinStream_24; /* read'24 */
OBJ __AOcBinStream_25; /* optread'25 */
OBJ __AOcBinStream_26; /* optread'26 */
extern OBJ _AOcBinStream_27(OBJ,OBJ);OBJ __AOcBinStream_27; /* optread'27 */
OBJ __AOcBinStream_28; /* optread'28 */
OBJ __AOcBinStream_29; /* optread'29 */
OBJ __AOcBinStream_30; /* optread'30 */
extern OBJ _AOcBinStream_31(OBJ);OBJ __AOcBinStream_31; /* optread'31 */
extern OBJ _AOcBinStream_32(OBJ);OBJ __AOcBinStream_32; /* optread'32 */
extern OBJ _AOcBinStream_33(OBJ,OBJ,OBJ);OBJ __AOcBinStream_33; /* optread'33 */
extern OBJ _AOcBinStream_34(OBJ,OBJ,OBJ,OBJ);OBJ __AOcBinStream_34; /* optread'34 */

extern OBJ _AOcBinStream_2(OBJ x1,OBJ x2,OBJ x3,OBJ x4) /* write */
{OBJ r;
 CPPRD(__AOcBinStream_15,1);
 CPCLS(__AOcBinStream_19,1);
 CPPRD(x2,1);
 {OBJ x5;OBJ x6;
  x5=_AOcBinStream_5(x1,__AOcBinStream_15,x2);
  x6=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ))METHOD(__AOcBinStream_19,3))(__AOcBinStream_19,x2,x3,x4);
  r=_AComCompose_3(x5,x6);}
 return r;}

extern OBJ _AOcBinStream_3(OBJ x1,OBJ x2,OBJ x3) /* read */
{OBJ r;
 CPPRD(__AOcBinStream_20,1);
 CPCLS(__AOcBinStream_24,1);
 CPPRD(x2,1);
 {OBJ x4;OBJ x5;
  x4=_AOcBinStream_5(x1,__AOcBinStream_20,x2);
  x5=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__AOcBinStream_24,2))(__AOcBinStream_24,x2,x3);
  r=_AComCompose_3(x4,x5);}
 return r;}

extern OBJ _AOcBinStream_4(OBJ x1,OBJ x2,OBJ x3) /* optread */
{OBJ r;
 CPPRD(__AOcBinStream_25,1);
 CPCLS(__AOcBinStream_34,1);
 CPPRD(x1,1);
 CPPRD(x2,1);
 {OBJ x4;OBJ x5;
  x4=_AOcBinStream_5(x1,__AOcBinStream_25,x2);
  x5=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ))METHOD(__AOcBinStream_34,3))(__AOcBinStream_34,x1,x2,x3);
  r=_AComCompose_3(x4,x5);}
 return r;}

extern OBJ _AOcBinStream_5(OBJ x1,OBJ x2,OBJ x3) /* trace */
{OBJ r;
 CPPRD(__AOcBinStream_10,1);
 {OBJ x4;
  x4=_AOcOptions_14(__AOcBinStream_10,x1);
  if(ISTGPRM(x4,1)){
   {OBJ x5;
    ADenotation_4(x2,x3,x5);
    r=_AFile_28(__AStream_4,x5);}
  }else{
   FRPRD(x2,1);
   FRPRD(x3,1);
   CPCLS(__AOcBinStream_12,1);
   {OBJ x6;
    x6=(*(OBJ(*)(OBJ,OBJ))METHOD(__AOcBinStream_12,1))(__AOcBinStream_12,__ABUILTIN_20);
    PRD(2,0,r);FLD(r,1)=x6;FLD(r,2)=__ASeq_6;}}}
 return r;}

extern OBJ _AOcBinStream_9(OBJ x1,OBJ x2) /* writeErr */
{OBJ r;
 CPPRD(__AOcBinStream_13,1);
 CPPRD(__AOcBinStream_14,1);
 {OBJ x3;OBJ x4;OBJ x5;
  ADenotation_4(__AOcBinStream_13,x2,x3);
  ADenotation_4(x1,x3,x4);
  ADenotation_4(__AOcBinStream_14,x4,x5);
  r=_AFile_28(__AStream_5,x5);}
 return r;}

extern OBJ _AOcBinStream_12(OBJ x1) /* trace'12 */
{OBJ r;
 CPPRD(__AOcBinStream_11,1);
 CPCLS(__ACom_47,1);
 r=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACom_47,1))(__ACom_47,__AOcBinStream_11);
 return r;}

extern OBJ _AOcBinStream_17(OBJ x1) /* write'17 */
{OBJ r;
 CPPRD(__AOcBinStream_16,1);
 CPCLS(__ACom_47,1);
 r=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACom_47,1))(__ACom_47,__AOcBinStream_16);
 return r;}

extern OBJ _AOcBinStream_18(OBJ x1,OBJ x2) /* write'18 */
{OBJ r;
 if(ISTGPRD(x2,0)){
  FRPRD(x1,1);
  CPCLS(__ACom_47,1);
  {OBJ x18;
   x18=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACom_47,1))(__ACom_47,x2);
   PRD(2,0,r);FLD(r,1)=x18;FLD(r,2)=__ASeq_6;}
 }else{
  {OBJ x19=FLD(x2,1);
   if(EXPRD(x2,1)){
    DSPRDF(x2);
   }else{
    CPPRD(x19,1);
    FRPRD(x2,1);}
   CPCLS(__AOcBinStream_17,1);
   {OBJ x20;OBJ x21;OBJ x22;
    x20=(*(OBJ(*)(OBJ,OBJ))METHOD(__AOcBinStream_17,1))(__AOcBinStream_17,__ABUILTIN_20);
    x21=_AOcBinStream_9(x1,x19);
    PRD(2,0,x22);FLD(x22,1)=x20;FLD(x22,2)=__ASeq_6;
    r=_AComCompose_4(x21,x22);}}}
 return r;}

extern OBJ _AOcBinStream_19(OBJ x1,OBJ x2,OBJ x3,OBJ x4) /* write'19 */
{OBJ r;
 CPCLS(__AOcBinStream_18,1);
 CPPRD(x1,1);
 FRPRD(x4,1);
 {OBJ x5;OBJ x6;
  x5=_ABinStream_6(x1,x2,x3);
  x6=(*(OBJ(*)(OBJ,OBJ))METHOD(__AOcBinStream_18,1))(__AOcBinStream_18,x1);
  r=_AComCompose_3(x5,x6);}
 return r;}

extern OBJ _AOcBinStream_22(OBJ x1) /* read'22 */
{OBJ r;
 CPPRD(__AOcBinStream_21,1);
 CPCLS(__ACom_47,1);
 r=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACom_47,1))(__ACom_47,__AOcBinStream_21);
 return r;}

extern OBJ _AOcBinStream_23(OBJ x1,OBJ x2) /* read'23 */
{OBJ r;
 if(ISTGPRD(x2,0)){
  FRPRD(x1,1);
  CPCLS(__ACom_47,1);
  {OBJ x18;
   x18=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACom_47,1))(__ACom_47,x2);
   PRD(2,0,r);FLD(r,1)=x18;FLD(r,2)=__ASeq_6;}
 }else{
  {OBJ x19=FLD(x2,1);
   if(EXPRD(x2,1)){
    DSPRDF(x2);
   }else{
    CPPRD(x19,1);
    FRPRD(x2,1);}
   CPCLS(__AOcBinStream_22,1);
   {OBJ x20;OBJ x21;OBJ x22;
    x20=(*(OBJ(*)(OBJ,OBJ))METHOD(__AOcBinStream_22,1))(__AOcBinStream_22,__ABUILTIN_20);
    x21=_AOcBinStream_9(x1,x19);
    PRD(2,0,x22);FLD(x22,1)=x20;FLD(x22,2)=__ASeq_6;
    r=_AComCompose_4(x21,x22);}}}
 return r;}

extern OBJ _AOcBinStream_24(OBJ x1,OBJ x2,OBJ x3) /* read'24 */
{OBJ r;
 CPCLS(__AOcBinStream_23,1);
 CPPRD(x1,1);
 FRPRD(x3,1);
 {OBJ x4;OBJ x5;
  x4=_ABinStream_8(x1,x2);
  x5=(*(OBJ(*)(OBJ,OBJ))METHOD(__AOcBinStream_23,1))(__AOcBinStream_23,x1);
  r=_AComCompose_3(x4,x5);}
 return r;}

extern OBJ _AOcBinStream_27(OBJ x1,OBJ x2) /* optread'27 */
{OBJ r;
 FRPRD(x2,1);
 if(ISPRD(x1)&&(ISTGPRD(x1,0))){
  {OBJ x3=FLD(x1,1);FLAG x_x1=EXPRD(x1,1);
   if(x_x1){
   }else{
    COPY(x3,1);}
   CPCLS(__ACom_47,1);
   {OBJ x5;OBJ x6;OBJ x7;OBJ x8;
    x5=x3;
    PRD1(1,x6);FLD1(x6,1)=x5;
    if(x_x1){
     RPRD(x1,x7);FLD(x7,1)=x6;
    }else{
     FRPRD(x1,1);PRD(1,0,x7);FLD(x7,1)=x6;}
    x8=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACom_47,1))(__ACom_47,x7);
    PRD(2,0,r);FLD(r,1)=x8;FLD(r,2)=__ASeq_6;}}
 }else{
  HLT("Com at <unknown> : undefined selection data\'Com:ans->data");}
 return r;}

extern OBJ _AOcBinStream_31(OBJ x1) /* optread'31 */
{OBJ r;
 CPPRD(__AOcBinStream_30,1);
 CPCLS(__ACom_47,1);
 r=(*(OBJ(*)(OBJ,OBJ))METHOD(__ACom_47,1))(__ACom_47,__AOcBinStream_30);
 return r;}

extern OBJ _AOcBinStream_32(OBJ x1) /* optread'32 */
{OBJ r;
 CPCLS(__AOcBinStream_31,1);
 FRPRD(x1,1);
 {OBJ x2;
  x2=(*(OBJ(*)(OBJ,OBJ))METHOD(__AOcBinStream_31,1))(__AOcBinStream_31,__ABUILTIN_20);
  PRD(2,0,r);FLD(r,1)=x2;FLD(r,2)=__ASeq_6;}
 return r;}

extern OBJ _AOcBinStream_33(OBJ x1,OBJ x2,OBJ x3) /* optread'33 */
{OBJ r;
 if(ISTGPRD(x3,0)){
  CPPRD(__AOcBinStream_26,1);
  CPCLS(__AOcBinStream_27,1);
  {OBJ x20;OBJ x21;
   x20=_AOcBinStream_5(x1,__AOcBinStream_26,x2);
   x21=(*(OBJ(*)(OBJ,OBJ))METHOD(__AOcBinStream_27,1))(__AOcBinStream_27,x3);
   r=_AComCompose_3(x20,x21);}
 }else{
  {OBJ x22=FLD(x3,1);
   if(EXPRD(x3,1)){
    DSPRDF(x3);
   }else{
    CPPRD(x22,1);
    FRPRD(x3,1);}
   CPPRD(__AOcBinStream_28,1);
   CPPRD(__AOcBinStream_29,1);
   CPCLS(__AOcBinStream_32,1);
   {OBJ x23;OBJ x24;OBJ x25;
    ADenotation_4(__AOcBinStream_28,x22,x23);
    ADenotation_4(x2,x23,x24);
    x25=_AOcBinStream_5(x1,__AOcBinStream_29,x24);
    r=_AComCompose_3(x25,__AOcBinStream_32);}}}
 return r;}

extern OBJ _AOcBinStream_34(OBJ x1,OBJ x2,OBJ x3,OBJ x4) /* optread'34 */
{OBJ r;
 CPCLS(__AOcBinStream_33,1);
 CPPRD(x2,1);
 FRPRD(x4,1);
 {OBJ x5;OBJ x6;
  x5=_ABinStream_8(x2,x3);
  x6=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__AOcBinStream_33,2))(__AOcBinStream_33,x1,x2);
  r=_AComCompose_3(x5,x6);}
 return r;}





static OBJ _mt_4_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_4_3_1(OBJ t,OBJ t1) 
{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))ENTRY(t))(FLDCLS(t,1),FLDCLS(t,2),FLDCLS(t,3),t1);
 return r;}
static OBJ _mt_4_3_1_l(OBJ t,OBJ t1) 
{OBJ r;
 r=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ))ENTRY(t))(FLDCLS(t,1),FLDCLS(t,2),FLDCLS(t,3),t1);
 if(EXCLS(t)){
  DSCLSF(t);
 }else{
  DCCLS(t,1);
  FLDCLS(t,1)=NIL;FLDCLS(t,2)=NIL;FLDCLS(t,3)=NIL;
  COPY(r,1);LZYCLS(t,r);}
 return r;}

init_AOcBinStream()
{
 static int visited=0; if(visited) return; visited=1;
 init_AVoid();
 init_AOcOptions();
 init_AOption();
 init_ACom();
 init_ANat();
 init_ASeq();
 init_AChar();
 init_AStream();
 init_AString();
 init_AFile();
 init_AInt();
 init_ADenotation();
 init_AComCompose();
 init_ABinStream();
 init_AOcExit();
 init_ATree();
 init_ABitset();
 init_APair();
 init_ASet();
 init_AMap();
 init_AMapReduce();
 init_ASeqReduce();
 init_ASetByBST();
 init_ABSTree();
 init_ASeqMap();
 init_ABinFile();
 LCLS(1,_AOcBinStream_31,__AOcBinStream_31);
 DEN("failed reading ",__AOcBinStream_29);
 DEN(" : ",__AOcBinStream_28);
 CLS(2,_AOcBinStream_27,__AOcBinStream_27);
 DEN("successful reading ",__AOcBinStream_26);
 DEN("try reading binary ",__AOcBinStream_25);
 CLS(3,_AOcBinStream_24,__AOcBinStream_24);
 CLS(2,_AOcBinStream_23,__AOcBinStream_23);
 LCLS(1,_AOcBinStream_22,__AOcBinStream_22);
 DEN("reading binary ",__AOcBinStream_20);
 CLS(4,_AOcBinStream_19,__AOcBinStream_19);
 CLS(2,_AOcBinStream_18,__AOcBinStream_18);
 LCLS(1,_AOcBinStream_17,__AOcBinStream_17);
 DEN("writing binary ",__AOcBinStream_15);
 DEN("I/O error: ",__AOcBinStream_14);
 DEN(": ",__AOcBinStream_13);
 LCLS(1,_AOcBinStream_12,__AOcBinStream_12);
 DEN("traceIO",__AOcBinStream_10);
 CLS(2,_AOcBinStream_9,__AOcBinStream_9);
 CLS(3,_AOcBinStream_5,__AOcBinStream_5);
 CLS(3,_AOcBinStream_4,__AOcBinStream_4);
 CLS(3,_AOcBinStream_3,__AOcBinStream_3);
 CLS(4,_AOcBinStream_34,__AOcBinStream_34);
 CLS(4,_AOcBinStream_2,__AOcBinStream_2);
 CLS(3,_AOcBinStream_33,__AOcBinStream_33);
 CLS(1,_AOcBinStream_32,__AOcBinStream_32);
 MTH(4,0,3,_mt_4_0_3);LZYMTH(4,0,3,_mt_4_0_3);
 MTH(4,3,1,_mt_4_3_1);LZYMTH(4,3,1,_mt_4_3_1_l);
 PRDF(1,0,__AOcBinStream_11);FLD(__AOcBinStream_11,1)=__AVoid_2;
 CPPRD(__AOcExit_2,1);
 PRD(1,1,__AOcBinStream_16);FLD(__AOcBinStream_16,1)=__AOcExit_2;
 CPPRD(__AOcExit_2,1);
 PRD(1,1,__AOcBinStream_21);FLD(__AOcBinStream_21,1)=__AOcExit_2;
 PRDF(1,0,__AOcBinStream_30);FLD(__AOcBinStream_30,1)=__AOption_5;}

