

#include "BUILTIN.h"
extern OBJ _AString_2(OBJ,OBJ);extern OBJ __AString_2;
extern OBJ _AString_4(OBJ);extern OBJ __AString_4;
extern OBJ _AString_5(OBJ);extern OBJ __AString_5;

#include "Char.h"

#include "Nat.h"
extern OBJ _AStringFold_1(OBJ,OBJ);OBJ __AStringFold_1; /* / */
extern OBJ _AStringFold_2(OBJ,OBJ);OBJ __AStringFold_2; /* \ */
extern OBJ _AStringFold_3(OBJ,OBJ,OBJ);OBJ __AStringFold_3; /* ifoldl */

extern OBJ _AStringFold_1(OBJ x1,OBJ x2) /* / */
{OBJ r;
 if(ISPRM(x2)){
  HLT("/\'StringFold applied to empty string");
 }else{
  CPPRD(x2,1);
  {OBJ x36;
   x36=_AString_4(x2);
   if(ISPRM(x36)){
    FRCLS(x1,1);
    r=_AString_5(x2);
   }else{
    CPCLS(x1,1);
    CPPRD(x36,1);
    {OBJ x40;OBJ x41;OBJ x42;OBJ x43;OBJ x44;
     x40=_AString_5(x2);
     x41=_AString_5(x36);
     x42=_AString_4(x36);
     x43=_AString_2(x41,x42);
     x44=_AStringFold_1(x1,x43);
     r=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(x1,2))(x1,x40,x44);}}}}
 return r;}

extern OBJ _AStringFold_2(OBJ x1,OBJ x2) /* \ */
{OBJ r;
 if(ISPRM(x2)){
  HLT("\'StringFold applied to empty stirng");
 }else{
  CPPRD(x2,1);
  {OBJ x34;
   x34=_AString_4(x2);
   if(ISPRM(x34)){
    FRCLS(x1,1);
    r=_AString_5(x2);
   }else{
    CPPRD(x34,1);
    {OBJ x38;OBJ x39;OBJ x40;OBJ x41;
     x38=_AString_5(x2);
     x39=_AString_5(x34);
     x40=_AString_4(x34);
     x41=_AString_2(x39,x40);
     r=_AStringFold_3(x1,x38,x41);}}}}
 return r;}

extern OBJ _AStringFold_3(register OBJ x1,register OBJ x2,register OBJ x3) /* ifoldl */
{OBJ r;
 for(;;){
  if(ISPRM(x3)){
   FRCLS(x1,1);
   r=x2;
  }else{
   CPCLS(x1,1);
   CPPRD(x3,1);
   {OBJ x18;OBJ x19;OBJ x20;
    x18=_AString_4(x3);
    x19=_AString_5(x3);
    x20=(*(OBJ(*)(OBJ,OBJ,OBJ))METHOD(x1,2))(x1,x2,x19);
    x2=x20;x3=x18;continue;}}
  break;}
 return r;}

init_AStringFold()
{
 static int visited=0; if(visited) return; visited=1;
 init_AString();
 init_AChar();
 init_ANat();
 init_ASeq();
 init_AOption();
 CLS(3,_AStringFold_3,__AStringFold_3);
 CLS(2,_AStringFold_2,__AStringFold_2);
 CLS(2,_AStringFold_1,__AStringFold_1);}

