#include "cdefs.h"
#include "mem.h"
extern cptr object_methods[meth_max];
extern cptr boolean_methods[meth_max];
#include "cint.h"
#include "cobarray.h"
extern cptr strpool_methods[meth_max];
extern cptr string_methods[meth_max];
extern cptr sset_methods[meth_max];
extern cptr slist_methods[meth_max];
extern cptr integer_methods[meth_max];
extern cptr set_methods[meth_max];
extern cptr list_methods[meth_max];
extern cptr map_methods[meth_max];
extern cptr parameter_methods[meth_max];

extern cint strpool_str_5;
extern cint boolean_True;
extern cint strpool_str_6;
extern cint object_Undefined;
extern cint boolean_False;
extern cint strpool_str_30;
extern cint strpool_str_31;
extern cint strpool_str_32;
extern cint strpool_str_12;
extern cint strpool_str_37;
extern cint strpool_str_87;


cptr collection_methods[meth_max];

cint collection_alloc(cint collection_self){
  cint collection_result;
  cint t1, t2;
  t2 = object_alloc((cint)collection_self);
  collection_result = t2;
  ((cptr)collection_result)[7] /* elemtype*/ = object_Undefined;
  t1 = collection_result;
  goto t1_label;
  t1_label: return t1;
}

cint collection_reclaim(cint collection_self){
  cint t3;
  object_Dec_ref(((cptr)collection_self)[7] /* elemtype*/);
  object_reclaim((cint)collection_self);
  t3_label: return t3;
}

cint collection_Append(cint collection_self, cint collection_item){
  cint collection_result;
  cint t4, t5, t6, t7, t8, t9, t10, t11, t12;
  t5 = mem_malloc(40); ((cptr)t5)[0] = slist_methods;
  t6 = slist_alloc((cint)t5, (cint)1);
  t7 = ((cptr)(((cptr)t6)[0]))[7];
  t8 = ((f0)t7)((cint)t6, (cint)collection_item); /* Append*/
  t9 = ((cptr)(((cptr)collection_self)[0]))[97];
  t10 = ((f0)t9)((cint)collection_self, (cint)t8); /* Plus*/
  t4 = t10;
  goto t4_label;
  t4_label: return t4;
}

cint collection_Apply(cint collection_self, cint collection_params){
  cint collection_result, collection_indx;
  cint t13, t14, t15, t16, t17, t18, t19, t20, t21, t22, t23, t24, t25, t26, t27, t28, t29, t30, t31, t32;
  collection_indx = collection_params;
  t14 = ((cptr)collection_params)[4] /* class_of*/ == strpool_str_30;
  if (t14){
    t15 = ((cptr)(((cptr)collection_params)[0]))[62];
    t16 = ((f0)t15)((cint)collection_params, (cint)1); /* lookup*/
    collection_indx = t16;
  };
  t18 = ((cptr)collection_indx)[4] /* class_of*/ != strpool_str_5;
  t19 = t18;
  if (!t19){    t20 = ((cptr)collection_indx)[2] /* hashval*/ < 1;
    t19 = t20;
  };
  t21 = t19;
  if (!t21){    t22 = ((cptr)collection_indx)[2] /* hashval*/ > ((cptr)collection_self)[3] /* len*/;
    t21 = t22;
  };
  if (t21){
    object_Dec_ref(collection_self);
    object_Dec_ref(collection_params);
    t13 = object_Undefined;
    goto t13_label;
  };
  t25 = ((cptr)(((cptr)collection_self)[0]))[62];
  t24 = ((f0)t25)((cint)collection_self, (cint)((cptr)collection_indx)[2] /* hashval*/); /* lookup*/
  ((cptr)t24)[1] += 1;
  collection_result = t24;
  object_Dec_ref(collection_self);
  t26 = ((cptr)collection_params)[3] /* len*/ > 1;
  if (t26){
    t27 = ((cptr)(((cptr)collection_params)[0]))[106];
    t28 = ((f0)t27)((cint)collection_params); /* Tail*/
    t29 = ((cptr)(((cptr)collection_result)[0]))[9];
    t30 = ((f0)t29)((cint)collection_result, (cint)t28); /* Apply*/
    t13 = t30;
    goto t13_label;
  };
  object_Dec_ref(collection_params);
  t13 = collection_result;
  goto t13_label;
  t13_label: return t13;
}

cint collection_as_array(cint collection_self){
  cint collection_result, collection_siz, collection_r, collection_i;
  cint t33, t34, t35, t37, t38, t39, t40;
  collection_siz = ((cptr)collection_self)[3] /* len*/;
  t34 = collection_siz + 1;
  t35 = t34 * 4;
  collection_r = cobarray_mem_malloc((cint)t35);
  for (collection_i = 1; collection_i <= collection_siz; collection_i++){
    t37 = collection_i - 1;
    t38 = ((cptr)(((cptr)collection_self)[0]))[62];
    t39 = ((f0)t38)((cint)collection_self, (cint)collection_i); /* lookup*/
    ((cptr)(collection_r))[t37] = t39;
  };t36:;
  ((cptr)(collection_r))[collection_siz] = 0;
  t33 = collection_r;
  goto t33_label;
  t33_label: return t33;
}

cint collection_Contains(cint collection_self, cint collection_ob){
  cint collection_result, collection_i;
  cint t41, t43, t44, t45, t46, t47;
  for (collection_i = 1; collection_i <= ((cptr)collection_self)[3] /* len*/; collection_i++){
    t43 = ((cptr)(((cptr)collection_self)[0]))[62];
    t44 = ((f0)t43)((cint)collection_self, (cint)collection_i); /* lookup*/
    t45 = ((cptr)(((cptr)collection_ob)[0]))[37];
    t46 = ((f0)t45)((cint)collection_ob, (cint)t44); /* equal*/
    t47 = t46 == 1;
    if (t47){
      object_Dec_ref(collection_self);
      object_Dec_ref(collection_ob);
      t41 = boolean_True;
      goto t41_label;
    };
  };t42:;
  object_Dec_ref(collection_self);
  object_Dec_ref(collection_ob);
  t41 = boolean_False;
  goto t41_label;
  t41_label: return t41;
}

cint collection_equal(cint collection_self, cint collection_other){
  cint collection_result, collection_i;
  cint t48, t49, t50, t51, t53, t54, t55, t56, t57, t58, t59, t60;
  t49 = collection_self == collection_other;
  if (t49){
    t48 = 1;
    goto t48_label;
  };
  t50 = ((cptr)collection_self)[2] /* hashval*/ != ((cptr)collection_other)[2] /* hashval*/;
  if (t50){
    t48 = 0;
    goto t48_label;
  };
  t51 = ((cptr)collection_self)[3] /* len*/ != ((cptr)collection_other)[3] /* len*/;
  if (t51){
    t48 = 0;
    goto t48_label;
  };
  for (collection_i = 1; collection_i <= ((cptr)collection_self)[3] /* len*/; collection_i++){
    t53 = ((cptr)(((cptr)collection_self)[0]))[62];
    t54 = ((f0)t53)((cint)collection_self, (cint)collection_i); /* lookup*/
    t55 = ((cptr)(((cptr)collection_other)[0]))[62];
    t56 = ((f0)t55)((cint)collection_other, (cint)collection_i); /* lookup*/
    t58 = ((cptr)(((cptr)t54)[0]))[37];
    t59 = ((f0)t58)((cint)t54, (cint)t56); /* equal*/
    t60 = t59 == 0;
    if (t60){
      t48 = 0;
      goto t48_label;
    };
  };t52:;
  t48 = 1;
  goto t48_label;
  t48_label: return t48;
}

cint collection_get_index(cint collection_self, cint collection_ob){
  cint collection_result, collection_i, collection_j;
  cint t61, t64, t65, t66, t67, t68, t69, t70, t71, t72, t73, t74;
  for (collection_i = 1; collection_i <= ((cptr)collection_ob)[3] /* len*/; collection_i++){
    collection_result = 1;
    for (collection_j = 1; collection_j <= ((cptr)collection_self)[3] /* len*/; collection_j++){
      t64 = ((cptr)(((cptr)collection_self)[0]))[62];
      t65 = ((f0)t64)((cint)collection_self, (cint)collection_j); /* lookup*/
      t66 = collection_i + collection_j;
      t67 = t66 - 1;
      t68 = ((cptr)(((cptr)collection_ob)[0]))[62];
      t69 = ((f0)t68)((cint)collection_ob, (cint)t67); /* lookup*/
      t71 = ((cptr)(((cptr)t65)[0]))[37];
      t72 = ((f0)t71)((cint)t65, (cint)t69); /* equal*/
      t73 = t72 == 0;
      if (t73){
        collection_result = 0;
        goto t63;
      };
    };t63:;
    t74 = collection_result != 0;
    if (t74){
      t61 = collection_i;
      goto t61_label;
    };
  };t62:;
  t61 = 0;
  goto t61_label;
  t61_label: return t61;
}

cint collection_Indexed(cint collection_self){
  cint collection_result, collection_i, collection_t;
  cint t75, t76, t77, t78, t80, t81, t82, t83, t84, t85, t86, t87, t88, t89, t90, t91, t92, t93, t94, t95;
  t76 = ((cptr)collection_self)[3] /* len*/ < 0;
  if (t76){
    object_Dec_ref(collection_self);
    t75 = object_Undefined;
    goto t75_label;
  };
  t77 = mem_malloc(48); ((cptr)t77)[0] = sset_methods;
  t78 = sset_alloc((cint)t77);
  collection_result = t78;
  for (collection_i = 1; collection_i <= ((cptr)collection_self)[3] /* len*/; collection_i++){
    t80 = mem_malloc(40); ((cptr)t80)[0] = slist_methods;
    t81 = slist_alloc((cint)t80, (cint)2);
    collection_t = t81;
    t82 = mem_malloc(28); ((cptr)t82)[0] = integer_methods;
    t83 = integer_ialloc((cint)t82, (cint)collection_i);
    t84 = ((cptr)(((cptr)collection_t)[0]))[7];
    t85 = ((f0)t84)((cint)collection_t, (cint)t83); /* Append*/
    collection_t = t85;
    t89 = ((cptr)(((cptr)collection_self)[0]))[62];
    t88 = ((f0)t89)((cint)collection_self, (cint)collection_i); /* lookup*/
    ((cptr)t88)[1] += 1;
    t90 = ((cptr)(((cptr)collection_t)[0]))[7];
    t91 = ((f0)t90)((cint)collection_t, (cint)t88); /* Append*/
    collection_t = t91;
    t93 = ((cptr)(((cptr)collection_result)[0]))[7];
    t94 = ((f0)t93)((cint)collection_result, (cint)collection_t); /* Append*/
    collection_result = t94;
  };t79:;
  t75 = collection_result;
  goto t75_label;
  t75_label: return t75;
}

cint collection_Make_list(cint collection_self){
  cint collection_result, collection_i;
  cint t96, t97, t98, t99, t101, t102, t103, t104, t105, t106;
  t97 = ((cptr)collection_self)[3] /* len*/ < 0;
  if (t97){
    object_Dec_ref(collection_self);
    t96 = object_Undefined;
    goto t96_label;
  };
  t98 = mem_malloc(40); ((cptr)t98)[0] = slist_methods;
  t99 = slist_alloc((cint)t98, (cint)0);
  collection_result = t99;
  for (collection_i = 1; collection_i <= ((cptr)collection_self)[3] /* len*/; collection_i++){
    t103 = ((cptr)(((cptr)collection_self)[0]))[62];
    t102 = ((f0)t103)((cint)collection_self, (cint)collection_i); /* lookup*/
    ((cptr)t102)[1] += 1;
    t104 = ((cptr)(((cptr)collection_result)[0]))[7];
    t105 = ((f0)t104)((cint)collection_result, (cint)t102); /* Append*/
    collection_result = t105;
  };t100:;
  object_Dec_ref(collection_self);
  t96 = collection_result;
  goto t96_label;
  t96_label: return t96;
}

cint collection_Make_parameter(cint collection_self, cint collection_ob){
  cint collection_result;
  cint t107, t108, t109;
  t108 = mem_malloc(36); ((cptr)t108)[0] = parameter_methods;
  t109 = parameter_alloc((cint)t108, (cint)collection_self, (cint)collection_ob);
  t107 = t109;
  goto t107_label;
  t107_label: return t107;
}

cint collection_Make_set(cint collection_self){
  cint collection_result, collection_i;
  cint t110, t111, t112, t113, t115, t116, t117, t118, t119, t120;
  t111 = ((cptr)collection_self)[3] /* len*/ < 0;
  if (t111){
    object_Dec_ref(collection_self);
    t110 = object_Undefined;
    goto t110_label;
  };
  t112 = mem_malloc(48); ((cptr)t112)[0] = sset_methods;
  t113 = sset_alloc((cint)t112);
  collection_result = t113;
  for (collection_i = 1; collection_i <= ((cptr)collection_self)[3] /* len*/; collection_i++){
    t117 = ((cptr)(((cptr)collection_self)[0]))[62];
    t116 = ((f0)t117)((cint)collection_self, (cint)collection_i); /* lookup*/
    ((cptr)t116)[1] += 1;
    t118 = ((cptr)(((cptr)collection_result)[0]))[7];
    t119 = ((f0)t118)((cint)collection_result, (cint)t116); /* Append*/
    collection_result = t119;
  };t114:;
  object_Dec_ref(collection_self);
  t110 = collection_result;
  goto t110_label;
  t110_label: return t110;
}

cint collection_Mapped(cint collection_self, cint collection_ob){
  cint collection_result, collection_i, collection_elem;
  cint t121, t122, t123, t125, t126, t127, t128, t129, t130, t131, t132, t133, t134, t135, t136, t137, t138, t139, t140, t141;
  t122 = mem_malloc(40); ((cptr)t122)[0] = slist_methods;
  t123 = slist_alloc((cint)t122, (cint)0);
  collection_result = t123;
  for (collection_i = 1; collection_i <= ((cptr)collection_self)[3] /* len*/; collection_i++){
    t125 = ((cptr)(((cptr)collection_self)[0]))[62];
    t126 = ((f0)t125)((cint)collection_self, (cint)collection_i); /* lookup*/
    collection_elem = t126;
    ((cptr)collection_ob)[1] += 1;
    t128 = mem_malloc(40); ((cptr)t128)[0] = slist_methods;
    t129 = slist_alloc((cint)t128, (cint)1);
    ((cptr)t129)[1] += 1;
    ((cptr)collection_elem)[1] += 1;
    t130 = ((cptr)(((cptr)t129)[0]))[7];
    t131 = ((f0)t130)((cint)t129, (cint)collection_elem); /* Append*/
    t132 = ((cptr)(((cptr)collection_ob)[0]))[9];
    t133 = ((f0)t132)((cint)collection_ob, (cint)t131); /* Apply*/
    t134 = ((cptr)(((cptr)collection_result)[0]))[7];
    t135 = ((f0)t134)((cint)collection_result, (cint)t133); /* Append*/
    collection_result = t135;
  };t124:;
  t139 = ((cptr)(((cptr)collection_result)[0]))[107];
  t140 = ((f0)t139)((cint)collection_result); /* Trim_trailing_undefineds*/
  collection_result = t140;
  object_Dec_ref(collection_self);
  object_Dec_ref(collection_ob);
  t121 = collection_result;
  goto t121_label;
  t121_label: return t121;
}

cint collection_Max(cint collection_self, cint collection_ob){
  cint collection_result, collection_i, collection_e, collection_rv, collection_ev;
  cint t142, t143, t144, t145, t146, t147, t149, t150, t151, t152, t153, t154, t155, t156, t157, t158, t159, t160, t161, t162, t163, t164, t165, t166, t167, t168, t169, t170, t171, t173, t174, t175, t176, t177, t178, t179, t180, t181, t182, t183, t184, t185, t186, t187, t188, t189, t190, t191, t192;
  t143 = ((cptr)collection_self)[3] /* len*/ <= 0;
  if (t143){
    object_Dec_ref(collection_self);
    object_Dec_ref(collection_ob);
    t142 = object_Undefined;
    goto t142_label;
  };
  t144 = collection_ob == object_Undefined;
  if (t144){
    t145 = ((cptr)(((cptr)collection_self)[0]))[62];
    t146 = ((f0)t145)((cint)collection_self, (cint)1); /* lookup*/
    collection_result = t146;
    for (collection_i = 2; collection_i <= ((cptr)collection_self)[3] /* len*/; collection_i++){
      t149 = ((cptr)(((cptr)collection_self)[0]))[62];
      t150 = ((f0)t149)((cint)collection_self, (cint)collection_i); /* lookup*/
      collection_e = t150;
      t152 = ((cptr)(((cptr)collection_result)[0]))[60];
      t153 = ((f0)t152)((cint)collection_result, (cint)collection_e); /* less_than*/
      t154 = t153 == 1;
      if (t154){
        collection_result = collection_e;
      };
    };t148:;
  }else{
    t155 = ((cptr)(((cptr)collection_self)[0]))[62];
    t156 = ((f0)t155)((cint)collection_self, (cint)1); /* lookup*/
    collection_result = t156;
    t158 = ((cptr)collection_ob)[4] /* class_of*/ == strpool_str_37;
    t159 = t158;
    if (!t159){      t160 = ((cptr)collection_ob)[4] /* class_of*/ == strpool_str_87;
      t159 = t160;
    };
    if (t159){
      ((cptr)collection_ob)[1] += 1;
      t161 = mem_malloc(40); ((cptr)t161)[0] = slist_methods;
      t162 = slist_alloc((cint)t161, (cint)1);
      ((cptr)t162)[1] += 1;
      ((cptr)collection_result)[1] += 1;
      t163 = ((cptr)(((cptr)t162)[0]))[7];
      t164 = ((f0)t163)((cint)t162, (cint)collection_result); /* Append*/
      t165 = ((cptr)(((cptr)collection_ob)[0]))[9];
      t166 = ((f0)t165)((cint)collection_ob, (cint)t164); /* Apply*/
      collection_rv = t166;
    }else{
      ((cptr)collection_ob)[1] += 1;
      ((cptr)collection_result)[1] += 1;
      t169 = ((cptr)(((cptr)collection_ob)[0]))[9];
      t170 = ((f0)t169)((cint)collection_ob, (cint)collection_result); /* Apply*/
      collection_rv = t170;
    };
    for (collection_i = 2; collection_i <= ((cptr)collection_self)[3] /* len*/; collection_i++){
      t173 = ((cptr)(((cptr)collection_self)[0]))[62];
      t174 = ((f0)t173)((cint)collection_self, (cint)collection_i); /* lookup*/
      collection_e = t174;
      t176 = ((cptr)collection_ob)[4] /* class_of*/ == strpool_str_37;
      t177 = t176;
      if (!t177){        t178 = ((cptr)collection_ob)[4] /* class_of*/ == strpool_str_87;
        t177 = t178;
      };
      if (t177){
        ((cptr)collection_ob)[1] += 1;
        t179 = mem_malloc(40); ((cptr)t179)[0] = slist_methods;
        t180 = slist_alloc((cint)t179, (cint)1);
        ((cptr)t180)[1] += 1;
        ((cptr)collection_e)[1] += 1;
        t181 = ((cptr)(((cptr)t180)[0]))[7];
        t182 = ((f0)t181)((cint)t180, (cint)collection_e); /* Append*/
        t183 = ((cptr)(((cptr)collection_ob)[0]))[9];
        t184 = ((f0)t183)((cint)collection_ob, (cint)t182); /* Apply*/
        collection_ev = t184;
      }else{
        ((cptr)collection_ob)[1] += 1;
        ((cptr)collection_e)[1] += 1;
        t187 = ((cptr)(((cptr)collection_ob)[0]))[9];
        t188 = ((f0)t187)((cint)collection_ob, (cint)collection_e); /* Apply*/
        collection_ev = t188;
      };
      t190 = ((cptr)(((cptr)collection_rv)[0]))[60];
      t191 = ((f0)t190)((cint)collection_rv, (cint)collection_ev); /* less_than*/
      t192 = t191 == 1;
      if (t192){
        object_Dec_ref(collection_rv);
        collection_rv = collection_ev;
        collection_result = collection_e;
      }else{
        object_Dec_ref(collection_ev);
      };
    };t172:;
    object_Dec_ref(collection_rv);
  };
  object_Dec_ref(collection_self);
  object_Dec_ref(collection_ob);
  ((cptr)collection_result)[1] += 1;
  t142 = collection_result;
  goto t142_label;
  t142_label: return t142;
}

cint collection_Min(cint collection_self, cint collection_ob){
  cint collection_result, collection_i, collection_e, collection_rv, collection_ev;
  cint t193, t194, t195, t196, t197, t198, t200, t201, t202, t203, t204, t205, t206, t207, t208, t209, t210, t211, t212, t213, t214, t215, t216, t217, t218, t219, t220, t221, t222, t224, t225, t226, t227, t228, t229, t230, t231, t232, t233, t234, t235, t236, t237, t238, t239, t240, t241, t242, t243;
  t194 = ((cptr)collection_self)[3] /* len*/ <= 0;
  if (t194){
    object_Dec_ref(collection_self);
    object_Dec_ref(collection_ob);
    t193 = object_Undefined;
    goto t193_label;
  };
  t195 = collection_ob == object_Undefined;
  if (t195){
    t196 = ((cptr)(((cptr)collection_self)[0]))[62];
    t197 = ((f0)t196)((cint)collection_self, (cint)1); /* lookup*/
    collection_result = t197;
    for (collection_i = 2; collection_i <= ((cptr)collection_self)[3] /* len*/; collection_i++){
      t200 = ((cptr)(((cptr)collection_self)[0]))[62];
      t201 = ((f0)t200)((cint)collection_self, (cint)collection_i); /* lookup*/
      collection_e = t201;
      t203 = ((cptr)(((cptr)collection_e)[0]))[60];
      t204 = ((f0)t203)((cint)collection_e, (cint)collection_result); /* less_than*/
      t205 = t204 == 1;
      if (t205){
        collection_result = collection_e;
      };
    };t199:;
  }else{
    t206 = ((cptr)(((cptr)collection_self)[0]))[62];
    t207 = ((f0)t206)((cint)collection_self, (cint)1); /* lookup*/
    collection_result = t207;
    t209 = ((cptr)collection_ob)[4] /* class_of*/ == strpool_str_37;
    t210 = t209;
    if (!t210){      t211 = ((cptr)collection_ob)[4] /* class_of*/ == strpool_str_87;
      t210 = t211;
    };
    if (t210){
      ((cptr)collection_ob)[1] += 1;
      t212 = mem_malloc(40); ((cptr)t212)[0] = slist_methods;
      t213 = slist_alloc((cint)t212, (cint)1);
      ((cptr)t213)[1] += 1;
      ((cptr)collection_result)[1] += 1;
      t214 = ((cptr)(((cptr)t213)[0]))[7];
      t215 = ((f0)t214)((cint)t213, (cint)collection_result); /* Append*/
      t216 = ((cptr)(((cptr)collection_ob)[0]))[9];
      t217 = ((f0)t216)((cint)collection_ob, (cint)t215); /* Apply*/
      collection_rv = t217;
    }else{
      ((cptr)collection_ob)[1] += 1;
      ((cptr)collection_result)[1] += 1;
      t220 = ((cptr)(((cptr)collection_ob)[0]))[9];
      t221 = ((f0)t220)((cint)collection_ob, (cint)collection_result); /* Apply*/
      collection_rv = t221;
    };
    for (collection_i = 2; collection_i <= ((cptr)collection_self)[3] /* len*/; collection_i++){
      t224 = ((cptr)(((cptr)collection_self)[0]))[62];
      t225 = ((f0)t224)((cint)collection_self, (cint)collection_i); /* lookup*/
      collection_e = t225;
      t227 = ((cptr)collection_ob)[4] /* class_of*/ == strpool_str_37;
      t228 = t227;
      if (!t228){        t229 = ((cptr)collection_ob)[4] /* class_of*/ == strpool_str_87;
        t228 = t229;
      };
      if (t228){
        ((cptr)collection_ob)[1] += 1;
        t230 = mem_malloc(40); ((cptr)t230)[0] = slist_methods;
        t231 = slist_alloc((cint)t230, (cint)1);
        ((cptr)t231)[1] += 1;
        ((cptr)collection_e)[1] += 1;
        t232 = ((cptr)(((cptr)t231)[0]))[7];
        t233 = ((f0)t232)((cint)t231, (cint)collection_e); /* Append*/
        t234 = ((cptr)(((cptr)collection_ob)[0]))[9];
        t235 = ((f0)t234)((cint)collection_ob, (cint)t233); /* Apply*/
        collection_ev = t235;
      }else{
        ((cptr)collection_ob)[1] += 1;
        ((cptr)collection_e)[1] += 1;
        t238 = ((cptr)(((cptr)collection_ob)[0]))[9];
        t239 = ((f0)t238)((cint)collection_ob, (cint)collection_e); /* Apply*/
        collection_ev = t239;
      };
      t241 = ((cptr)(((cptr)collection_ev)[0]))[60];
      t242 = ((f0)t241)((cint)collection_ev, (cint)collection_rv); /* less_than*/
      t243 = t242 == 1;
      if (t243){
        object_Dec_ref(collection_rv);
        collection_rv = collection_ev;
        collection_result = collection_e;
      }else{
        object_Dec_ref(collection_ev);
      };
    };t223:;
    object_Dec_ref(collection_rv);
  };
  object_Dec_ref(collection_self);
  object_Dec_ref(collection_ob);
  ((cptr)collection_result)[1] += 1;
  t193 = collection_result;
  goto t193_label;
  t193_label: return t193;
}

cint collection_Mkmap(cint collection_self){
  cint collection_result, collection_e1, collection_i, collection_elem;
  cint t244, t245, t246, t247, t248, t249, t250, t251, t252, t253, t254, t255, t256, t257, t258, t260, t261, t262, t263, t264, t265, t266, t267, t268, t269, t270, t271;
  t245 = ((cptr)(((cptr)collection_self)[0]))[62];
  t246 = ((f0)t245)((cint)collection_self, (cint)1); /* lookup*/
  collection_e1 = t246;
  t248 = ((cptr)collection_self)[3] /* len*/ < 1;
  t249 = t248;
  if (!t249){    t250 = ((cptr)collection_e1)[3] /* len*/ < 2;
    t249 = t250;
  };
  if (t249){
    object_Dec_ref(collection_self);
    t244 = object_Undefined;
    goto t244_label;
  };
  t251 = mem_malloc(48); ((cptr)t251)[0] = map_methods;
  t252 = map_alloc((cint)t251);
  collection_result = t252;
  t253 = ((cptr)(((cptr)collection_self)[0]))[111];
  t254 = ((f0)t253)((cint)collection_self); /* extract_domains*/
  ((cptr)collection_result)[7] /* domains*/ = t254;
  t256 = ((cptr)(((cptr)collection_self)[0]))[110];
  t257 = ((f0)t256)((cint)collection_self); /* extract_codomain*/
  ((cptr)collection_result)[8] /* codomain*/ = t257;
  for (collection_i = 1; collection_i <= ((cptr)collection_self)[3] /* len*/; collection_i++){
    t260 = ((cptr)(((cptr)collection_self)[0]))[62];
    t261 = ((f0)t260)((cint)collection_self, (cint)collection_i); /* lookup*/
    collection_elem = t261;
    ((cptr)collection_elem)[1] += 1;
    t263 = ((cptr)(((cptr)collection_elem)[0]))[6];
    t264 = ((f0)t263)((cint)collection_elem); /* All_but_last*/
    t267 = ((cptr)(((cptr)collection_elem)[0]))[62];
    t266 = ((f0)t267)((cint)collection_elem, (cint)((cptr)collection_elem)[3] /* len*/); /* lookup*/
    ((cptr)t266)[1] += 1;
    t268 = ((cptr)(((cptr)collection_result)[0]))[15];
    t269 = ((f0)t268)((cint)collection_result, (cint)t264, (cint)t266, (cint)0); /* Assign_to_component*/
    collection_result = t269;
  };t259:;
  object_Dec_ref(collection_self);
  t244 = collection_result;
  goto t244_label;
  t244_label: return t244;
}

cint collection_extract_codomain(cint collection_self){
  cint collection_result, collection_i, collection_tuple, collection_l;
  cint t272, t273, t274, t276, t277, t278, t279, t280, t281, t282, t283, t284;
  t273 = mem_malloc(48); ((cptr)t273)[0] = sset_methods;
  t274 = sset_alloc((cint)t273);
  collection_result = t274;
  for (collection_i = 1; collection_i <= ((cptr)collection_self)[3] /* len*/; collection_i++){
    t276 = ((cptr)(((cptr)collection_self)[0]))[62];
    t277 = ((f0)t276)((cint)collection_self, (cint)collection_i); /* lookup*/
    collection_tuple = t277;
    collection_l = ((cptr)collection_tuple)[3] /* len*/;
    t281 = ((cptr)(((cptr)collection_tuple)[0]))[62];
    t280 = ((f0)t281)((cint)collection_tuple, (cint)collection_l); /* lookup*/
    ((cptr)t280)[1] += 1;
    t282 = ((cptr)(((cptr)collection_result)[0]))[7];
    t283 = ((f0)t282)((cint)collection_result, (cint)t280); /* Append*/
    collection_result = t283;
  };t275:;
  t272 = collection_result;
  goto t272_label;
  t272_label: return t272;
}

cint collection_extract_domains(cint collection_self){
  cint collection_result, collection_e1, collection_i, collection_tuple, collection_j;
  cint t285, t286, t287, t288, t289, t290, t291, t293, t294, t295, t296, t297, t298, t300, t301, t302, t304, t305, t306, t307, t308, t309, t310;
  t286 = ((cptr)(((cptr)collection_self)[0]))[62];
  t287 = ((f0)t286)((cint)collection_self, (cint)1); /* lookup*/
  collection_e1 = t287;
  t289 = mem_malloc(40); ((cptr)t289)[0] = slist_methods;
  t290 = ((cptr)collection_e1)[3] /* len*/ - 1;
  t291 = slist_alloc((cint)t289, (cint)t290);
  collection_result = t291;
  t293 = ((cptr)collection_e1)[3] /* len*/ - 1;
  for (collection_i = 1; collection_i <= t293; collection_i++){
    t294 = mem_malloc(48); ((cptr)t294)[0] = sset_methods;
    t295 = sset_alloc((cint)t294);
    t296 = ((cptr)(((cptr)collection_result)[0]))[130];
    t297 = ((f0)t296)((cint)collection_result, (cint)collection_i, (cint)t295, (cint)0); /* update*/
    collection_result = t297;
  };t292:;
  for (collection_i = 1; collection_i <= ((cptr)collection_self)[3] /* len*/; collection_i++){
    t300 = ((cptr)(((cptr)collection_self)[0]))[62];
    t301 = ((f0)t300)((cint)collection_self, (cint)collection_i); /* lookup*/
    collection_tuple = t301;
    t304 = ((cptr)collection_e1)[3] /* len*/ - 1;
    for (collection_j = 1; collection_j <= t304; collection_j++){
      t307 = ((cptr)(((cptr)collection_tuple)[0]))[62];
      t306 = ((f0)t307)((cint)collection_tuple, (cint)collection_j); /* lookup*/
      ((cptr)t306)[1] += 1;
      t308 = ((cptr)(((cptr)collection_result)[0]))[130];
      t309 = ((f0)t308)((cint)collection_result, (cint)collection_j, (cint)t306, (cint)5); /* update*/
      collection_result = t309;
    };t303:;
  };t299:;
  t285 = collection_result;
  goto t285_label;
  t285_label: return t285;
}

cint collection_Sort(cint collection_self, cint collection_ord){
  cint collection_result;
  cint t311, t312, t313, t314, t315;
  t312 = collection_Make_list((cint)collection_self);
  t313 = ((cptr)(((cptr)t312)[0]))[103];
  t314 = ((f0)t313)((cint)t312, (cint)collection_ord); /* Sort*/
  t311 = t314;
  goto t311_label;
  t311_label: return t311;
}

cint collection_Subset(cint collection_self, cint collection_ob){
  cint collection_result, collection_i;
  cint t316, t317, t318, t319, t320, t321, t322, t323, t324, t325, t326, t327, t328, t329, t330, t331, t333, t334, t335, t336, t337, t338;
  t317 = ((cptr)collection_ob)[5] /* representation*/ == strpool_str_31;
  t318 = t317;
  if (!t318){    t319 = ((cptr)collection_self)[3] /* len*/ == 0;
    t318 = t319;
  };
  t320 = t318;
  if (!t320){    t321 = collection_self == collection_ob;
    t320 = t321;
  };
  if (t320){
    object_Dec_ref(collection_self);
    object_Dec_ref(collection_ob);
    t316 = boolean_True;
    goto t316_label;
  }else{
  t322 = ((cptr)collection_self)[3] /* len*/ < 0;
  if (t322){
    object_Dec_ref(collection_self);
    object_Dec_ref(collection_ob);
    t316 = boolean_False;
    goto t316_label;
  }else{
  t323 = ((cptr)collection_ob)[4] /* class_of*/ == strpool_str_32;
  t324 = t323;
  if (!t324){    t325 = ((cptr)collection_ob)[4] /* class_of*/ == strpool_str_30;
    t324 = t325;
  };
  t326 = t324;
  if (!t326){    t327 = ((cptr)collection_ob)[4] /* class_of*/ == strpool_str_6;
    t326 = t327;
  };
  t328 = t326;
  if (t328){
    t329 = ((cptr)collection_self)[3] /* len*/ <= ((cptr)collection_ob)[3] /* len*/;
    t330 = t329;
    if (!t330){      t331 = ((cptr)collection_ob)[3] /* len*/ < 0;
      t330 = t331;
    };
    t328 = t330;
  };
  if (t328){
    collection_result = boolean_True;
    for (collection_i = 1; collection_i <= ((cptr)collection_self)[3] /* len*/; collection_i++){
      ((cptr)collection_ob)[1] += 1;
      t335 = ((cptr)(((cptr)collection_self)[0]))[62];
      t334 = ((f0)t335)((cint)collection_self, (cint)collection_i); /* lookup*/
      ((cptr)t334)[1] += 1;
      t336 = ((cptr)(((cptr)collection_ob)[0]))[20];
      t337 = ((f0)t336)((cint)collection_ob, (cint)t334); /* Contains*/
      t338 = t337 == boolean_False;
      if (t338){
        object_Dec_ref(collection_self);
        object_Dec_ref(collection_ob);
        t316 = boolean_False;
        goto t316_label;
      };
    };t332:;
  }else{
    collection_result = boolean_False;
  };};};
  object_Dec_ref(collection_self);
  object_Dec_ref(collection_ob);
  t316 = collection_result;
  goto t316_label;
  t316_label: return t316;
}

cint collection_ubstr(cint collection_self){
  cint collection_result, collection_i;
  cint t339, t340, t341, t342, t343, t344, t345, t347, t348, t349, t350, t351, t352, t353, t354, t355, t356, t357, t358;
  t342 = ((cptr)(((cptr)collection_self)[0]))[62];
  t341 = ((f0)t342)((cint)collection_self, (cint)1); /* lookup*/
  ((cptr)t341)[1] += 1;
  t343 = ((cptr)(((cptr)t341)[0]))[88];
  t344 = ((f0)t343)((cint)t341); /* Mkstr*/
  collection_result = t344;
  for (collection_i = 2; collection_i <= ((cptr)collection_self)[3] /* len*/; collection_i++){
    ((cptr)strpool_str_12)[1] += 1;
    t347 = ((cptr)(((cptr)collection_result)[0]))[97];
    t348 = ((f0)t347)((cint)collection_result, (cint)strpool_str_12); /* Plus*/
    t351 = ((cptr)(((cptr)collection_self)[0]))[62];
    t350 = ((f0)t351)((cint)collection_self, (cint)collection_i); /* lookup*/
    ((cptr)t350)[1] += 1;
    t352 = ((cptr)(((cptr)t350)[0]))[88];
    t353 = ((f0)t352)((cint)t350); /* Mkstr*/
    t355 = ((cptr)(((cptr)t348)[0]))[97];
    t356 = ((f0)t355)((cint)t348, (cint)t353); /* Plus*/
    collection_result = t356;
  };t346:;
  t339 = collection_result;
  goto t339_label;
  t339_label: return t339;
}

void init_collection(){
  copy_meth_table(collection_methods, object_methods);
  collection_methods[0] = 32;
  collection_methods[3] = collection_alloc;
  collection_methods[4] = collection_reclaim;
  collection_methods[7] = collection_Append;
  collection_methods[9] = collection_Apply;
  collection_methods[365] = collection_as_array;
  collection_methods[20] = collection_Contains;
  collection_methods[37] = collection_equal;
  collection_methods[47] = collection_get_index;
  collection_methods[51] = collection_Indexed;
  collection_methods[68] = collection_Make_list;
  collection_methods[77] = collection_Make_parameter;
  collection_methods[74] = collection_Make_set;
  collection_methods[79] = collection_Mapped;
  collection_methods[80] = collection_Max;
  collection_methods[82] = collection_Min;
  collection_methods[86] = collection_Mkmap;
  collection_methods[110] = collection_extract_codomain;
  collection_methods[111] = collection_extract_domains;
  collection_methods[103] = collection_Sort;
  collection_methods[104] = collection_Subset;
  collection_methods[112] = collection_ubstr;
}
