

#include "BUILTIN.h"
extern OBJ _ABag_16(OBJ,OBJ,OBJ,OBJ);extern OBJ __ABag_16;
extern OBJ _ABag_40(OBJ,OBJ,OBJ);extern OBJ __ABag_40;

#include "Nat.h"
extern OBJ __ASeq_6;
extern OBJ _AString_57(OBJ);extern OBJ __AString_57;

#include "Char.h"
extern OBJ _ASeqConv_3(OBJ,OBJ,OBJ,OBJ,OBJ);extern OBJ __ASeqConv_3;
extern OBJ _ASeqConv_5(OBJ,OBJ,OBJ,OBJ,OBJ);extern OBJ __ASeqConv_5;
extern OBJ __ASeqConv_8;

#include "NatConv.h"
extern OBJ _APairConv_4(OBJ,OBJ,OBJ,OBJ,OBJ,OBJ);extern OBJ __APairConv_4;

#include "Denotation.h"
extern OBJ _AStringConv_1(OBJ);extern OBJ __AStringConv_1;
extern OBJ _ACompose_4(OBJ,OBJ,OBJ);extern OBJ __ACompose_4;

#include "Int.h"

#include "Real.h"
extern OBJ _ABagConv_3(OBJ,OBJ);OBJ __ABagConv_3; /* asSeq */
extern OBJ _ABagConv_4(OBJ,OBJ);OBJ __ABagConv_4; /* asBag */
extern OBJ _ABagConv_5(OBJ,OBJ);OBJ __ABagConv_5; /* asSeqPair */
extern OBJ _ABagConv_6(OBJ,OBJ);OBJ __ABagConv_6; /* asBag,1 */
extern OBJ _ABagConv_7(OBJ,OBJ,OBJ);OBJ __ABagConv_7; /* ` */
extern OBJ _ABagConv_8(OBJ,OBJ,OBJ);OBJ __ABagConv_8; /* `,1 */
extern OBJ _ABagConv_9(OBJ,OBJ);OBJ __ABagConv_9; /* explode */
extern OBJ _ABagConv_10(OBJ,OBJ);OBJ __ABagConv_10; /* explodeCt */
extern OBJ _ABagConv_11(OBJ,OBJ);OBJ __ABagConv_11; /* implode */
extern OBJ _ABagConv_12(OBJ,OBJ);OBJ __ABagConv_12; /* implodeCt */
extern OBJ _ABagConv_13(OBJ,OBJ);OBJ __ABagConv_13; /* fromPairSeq */
OBJ __ABagConv_14; /* `'14 */
OBJ __ABagConv_15; /* `'15 */
OBJ __ABagConv_16; /* `'16 */
OBJ __ABagConv_17; /* `'17 */

extern OBJ _ABagConv_3(OBJ x1,OBJ x2) /* asSeq */
{OBJ r;
 r=_ABagConv_13(x1,x2);
 return r;}

extern OBJ _ABagConv_4(OBJ x1,OBJ x2) /* asBag */
{OBJ r;
 if(ISPRM(x2)){
  FRCLS(x1,1);
  r=__ASeq_6;
 }else{
  {OBJ x21=FLD1(x2,1);OBJ x22=FLD1(x2,2);
   if(EXPRD(x2,1)){
    DSPRDF(x2);
   }else{
    COPY(x21,1);COPY(x22,1);
    FRPRD(x2,1);}
   CPCLS(x1,1);
   {OBJ x24;
    x24=_ABagConv_4(x1,x22);
    r=_ABag_40(x1,x21,x24);}}}
 return r;}

extern OBJ _ABagConv_5(OBJ x1,OBJ x2) /* asSeqPair */
{OBJ r;
 FRCLS(x1,1);
 r=x2;
 return r;}

extern OBJ _ABagConv_6(OBJ x1,OBJ x2) /* asBag,1 */
{OBJ r;
 if(ISPRM(x2)){
  FRCLS(x1,1);
  r=__ASeq_6;
 }else{
  {OBJ x29=FLD1(x2,1);OBJ x30=FLD1(x2,2);
   if(EXPRD(x2,1)){
    DSPRDF(x2);
   }else{
    CPPRD(x29,1);COPY(x30,1);
    FRPRD(x2,1);}
   CPCLS(x1,1);
   {OBJ x32;
    x32=_ABagConv_6(x1,x30);
    {OBJ x33=FLD1(x29,1);OBJ x34=FLD1(x29,2);
     if(EXPRD(x29,1)){
      DSPRDF(x29);
     }else{
      COPY(x33,1);
      FRPRD(x29,1);}
     r=_ABag_16(x1,x33,x34,x32);}}}}
 return r;}

extern OBJ _ABagConv_7(OBJ x1,OBJ x2,OBJ x3) /* ` */
{OBJ r;
 CPPRD(__ABagConv_14,2);
 CPPRD(__ABagConv_15,1);
 CPPRD(__ABagConv_16,1);
 CPPRD(__ABagConv_17,1);
 CPPRD(__ASeqConv_8,1);
 CPCLS(__ANatConv_1,1);
 CPCLS(__APairConv_4,1);
 FRCLS(x1,1);
 {OBJ x4;
  x4=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ,OBJ,OBJ))METHOD(__APairConv_4,5))(__APairConv_4,__ABagConv_14,__ABagConv_15,__ABagConv_14,x2,__ANatConv_1);
  r=_ASeqConv_3(__ABagConv_16,__ASeqConv_8,__ABagConv_17,x4,x3);}
 return r;}

extern OBJ _ABagConv_8(OBJ x1,OBJ x2,OBJ x3) /* `,1 */
{OBJ r;
 CPPRD(__ABagConv_14,2);
 CPPRD(__ABagConv_15,1);
 CPPRD(__ABagConv_16,1);
 CPPRD(__ABagConv_17,1);
 CPCLS(__AString_57,1);
 CPPRD(__ASeqConv_8,1);
 CPCLS(__ANatConv_1,1);
 CPCLS(__APairConv_4,1);
 CPCLS(__AStringConv_1,1);
 CPCLS(__ACompose_4,2);
 FRCLS(x1,1);
 {OBJ x4;OBJ x5;OBJ x6;
  x4=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ACompose_4,2))(__ACompose_4,__AStringConv_1,x2);
  x5=(*(OBJ(*)(OBJ,OBJ,OBJ,OBJ,OBJ,OBJ))METHOD(__APairConv_4,5))(__APairConv_4,__ABagConv_14,__ABagConv_15,__ABagConv_14,x4,__ANatConv_1);
  x6=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(__ACompose_4,2))(__ACompose_4,__AString_57,x5);
  r=_ASeqConv_5(__ABagConv_16,__ASeqConv_8,__ABagConv_17,x6,x3);}
 return r;}

extern OBJ _ABagConv_9(OBJ x1,OBJ x2) /* explode */
{OBJ r;
 r=_ABagConv_13(x1,x2);
 return r;}

extern OBJ _ABagConv_10(OBJ x1,OBJ x2) /* explodeCt */
{OBJ r;
 FRCLS(x1,1);
 r=x2;
 return r;}

extern OBJ _ABagConv_11(OBJ x1,OBJ x2) /* implode */
{OBJ r;
 r=_ABagConv_4(x1,x2);
 return r;}

extern OBJ _ABagConv_12(OBJ x1,OBJ x2) /* implodeCt */
{OBJ r;
 r=_ABagConv_6(x1,x2);
 return r;}

extern OBJ _ABagConv_13(register OBJ x1,register OBJ x2) /* fromPairSeq */
{OBJ r;OBJ* p1=&r;
 for(;;){
  if(ISPRM(x2)){
   FRCLS(x1,1);
   *p1=__ASeq_6;
  }else{
   {OBJ x44=FLD1(x2,1);OBJ x45=FLD1(x2,2);FLAG x_x2=EXPRD(x2,1);
    if(x_x2){
    }else{
     CPPRD(x44,1);COPY(x45,1);}
    {OBJ x46=FLD1(x44,1);OBJ x47=FLD1(x44,2);FLAG x_x44=EXPRD(x44,1);
     if(x_x44){
     }else{
      COPY(x46,1);}
     {OBJ x48;
      ANat_6(x47,x48);
      if(ISTGPRM(x48,1)){
       if(x_x2){
	DSPRDF(x2);
       }else{
	FRPRD(x2,1);}
       if(x_x44){
	DSPRDF(x44);
       }else{
	FRPRD(x44,1);}
       FREE(x46,1);
       x2=x45;continue;
      }else{
       {OBJ x49;
	ANat_3(x47,x49);
	if(ISTGPRM(x49,1)){
	 COPY(x46,1);
	 {OBJ x50;OBJ x51;OBJ x52;
	  ANat_4(x47,x50);
	  if(x_x44){
	   RSOME(x44,x51);FLD1(x51,2)=x50;
	  }else{
	   FRPRD(x44,1);PRD1(2,x51);FLD1(x51,1)=x46;FLD1(x51,2)=x50;}
	  if(x_x2){
	   RSOME(x2,x52);FLD1(x52,1)=x51;
	  }else{
	   FRPRD(x2,1);PRD1(2,x52);FLD1(x52,1)=x51;FLD1(x52,2)=x45;}
	  PRD1(2,*p1);FLD1(*p1,1)=x46;
	  x2=x52;p1=&FLD1(*p1,2);continue;}
	}else{
	 HLT("BagConv at <33,5-15> : missing else in fromPairSeq\'BagConv:seq->seq");}}}}}}}
  break;}
 return r;}

static OBJ _mt_3_1_1(OBJ t,OBJ t1) 
{OBJ r;
 if(EXCLS(t)){
  r=t;
 }else{
  DPCLS(t,r);
  FLDCLS(r,1)=FLDCLS(t,1);
  COPY(FLDCLS(r,1),1);}
 INCCLS(r,1,1);
 FLDCLS(r,2)=t1;
 return r;}

init_ABagConv()
{
 static int visited=0; if(visited) return; visited=1;
 init_ABag();
 init_ANat();
 init_ASeq();
 init_APair();
 init_AString();
 init_AChar();
 init_AOption();
 init_ASeqMap();
 init_ASeqOfSeq();
 init_ASeqConv();
 init_ANatConv();
 init_APairConv();
 init_ADenotation();
 init_APrintableChar();
 init_AStringConv();
 init_ACompose();
 init_AInt();
 init_AReal();
 init_AStringMapSeq();
 DEN("}}",__ABagConv_17);
 DEN("{{",__ABagConv_16);
 DEN(":",__ABagConv_15);
 DEN("",__ABagConv_14);
 CLS(2,_ABagConv_13,__ABagConv_13);
 CLS(2,_ABagConv_12,__ABagConv_12);
 CLS(2,_ABagConv_11,__ABagConv_11);
 CLS(2,_ABagConv_10,__ABagConv_10);
 CLS(2,_ABagConv_9,__ABagConv_9);
 CLS(3,_ABagConv_8,__ABagConv_8);
 CLS(3,_ABagConv_7,__ABagConv_7);
 CLS(2,_ABagConv_6,__ABagConv_6);
 CLS(2,_ABagConv_5,__ABagConv_5);
 CLS(2,_ABagConv_4,__ABagConv_4);
 CLS(2,_ABagConv_3,__ABagConv_3);
 MTH(3,1,1,_mt_3_1_1);LZYMTH(3,1,1,_mt_3_1_1);}

