#include "cdefs.h"
#include "mem.h"
extern cptr object_methods[meth_max];
extern cptr boolean_methods[meth_max];
extern cptr strpool_methods[meth_max];
extern cptr set_methods[meth_max];
extern cptr sset_methods[meth_max];
extern cptr scope_methods[meth_max];
extern cptr powset_methods[meth_max];
extern cptr abstract_methods[meth_max];
extern cptr listset_methods[meth_max];
#include "cprocess.h"
#include "cint.h"
extern cptr debug_methods[meth_max];
extern cptr selector_methods[meth_max];

extern cint boolean_True;
extern cint object_Undefined;
extern cint strpool_str_32;
extern cint strpool_str_70;
extern cint strpool_str_71;
extern cint strpool_str_72;
extern cint strpool_str_59;


cptr variable_methods[meth_max];

cint variable_alloc(cint variable_self, cint variable_typ, cint variable_flg){
  cint variable_result;
  cint t1, t2;
  t2 = object_alloc((cint)variable_self);
  variable_result = t2;
  ((cptr)variable_self)[4] /* class_of*/ = strpool_str_70;
  ((cptr)variable_self)[8] /* value*/ = object_Undefined;
  ((cptr)variable_self)[7] /* type*/ = variable_typ;
  ((cptr)variable_self)[6] /* name_space*/ = ((cptr)variable_typ)[6] /* name_space*/;
  ((cptr)variable_self)[9] /* flag*/ = variable_flg;
  t1 = variable_result;
  goto t1_label;
  t1_label: return t1;
}

cint variable_reclaim(cint variable_self){
  cint t3;
  object_Dec_ref(((cptr)variable_self)[7] /* type*/);
  object_Dec_ref(((cptr)variable_self)[8] /* value*/);
  object_reclaim((cint)variable_self);
  t3_label: return t3;
}

cint variable_Contains(cint variable_self, cint variable_val){
  cint variable_result;
  cint t4, t5, t6, t7;
  ((cptr)((cptr)variable_self)[8] /* value*/)[1] += 1;
  t5 = ((cptr)(((cptr)((cptr)variable_self)[8] /* value*/)[0]))[20];
  t6 = ((f0)t5)((cint)((cptr)variable_self)[8] /* value*/, (cint)variable_val); /* Contains*/
  variable_result = t6;
  object_Dec_ref(variable_self);
  t4 = variable_result;
  goto t4_label;
  t4_label: return t4;
}

cint variable_Eval(cint variable_self){
  cint variable_result;
  cint t8;
  ((cptr)((cptr)variable_self)[8] /* value*/)[1] += 1;
  variable_result = ((cptr)variable_self)[8] /* value*/;
  object_Dec_ref(variable_self);
  t8 = variable_result;
  goto t8_label;
  t8_label: return t8;
}

cint variable_Expanded_with(cint variable_self, cint variable_ob){
  cint variable_result;
  cint t9, t10, t11, t12;
  ((cptr)variable_ob)[1] += 1;
  t10 = ((cptr)(((cptr)((cptr)variable_self)[8] /* value*/)[0]))[7];
  t11 = ((f0)t10)((cint)((cptr)variable_self)[8] /* value*/, (cint)variable_ob); /* Append*/
  ((cptr)variable_self)[8] /* value*/ = t11;
  t9 = variable_self;
  goto t9_label;
  t9_label: return t9;
}

cint variable_List_of(cint variable_self){
  cint variable_result;
  cint t13, t14, t15;
  t14 = mem_malloc(32); ((cptr)t14)[0] = listset_methods;
  t15 = listset_alloc((cint)t14, (cint)variable_self);
  t13 = t15;
  goto t13_label;
  t13_label: return t13;
}

cint variable_Make_parameter(cint variable_self, cint variable_ob){
  cint variable_result;
  cint t16, t17, t18, t19;
  ((cptr)((cptr)variable_self)[8] /* value*/)[1] += 1;
  t17 = ((cptr)(((cptr)((cptr)variable_self)[8] /* value*/)[0]))[77];
  t18 = ((f0)t17)((cint)((cptr)variable_self)[8] /* value*/, (cint)variable_ob); /* Make_parameter*/
  variable_result = t18;
  object_Dec_ref(variable_self);
  t16 = variable_result;
  goto t16_label;
  t16_label: return t16;
}

cint variable_Make_parameterless(cint variable_self){
  cint variable_result;
  cint t20, t21, t22, t23;
  ((cptr)((cptr)variable_self)[8] /* value*/)[1] += 1;
  t21 = ((cptr)(((cptr)((cptr)variable_self)[8] /* value*/)[0]))[78];
  t22 = ((f0)t21)((cint)((cptr)variable_self)[8] /* value*/); /* Make_parameterless*/
  variable_result = t22;
  object_Dec_ref(variable_self);
  t20 = variable_result;
  goto t20_label;
  t20_label: return t20;
}

cint variable_Make_selector(cint variable_self, cint variable_ob){
  cint variable_result;
  cint t24, t25, t26;
  t25 = mem_malloc(36); ((cptr)t25)[0] = selector_methods;
  t26 = selector_alloc((cint)t25, (cint)variable_self, (cint)variable_ob);
  t24 = t26;
  goto t24_label;
  t24_label: return t24;
}

cint variable_Mkstr(cint variable_self){
  cint variable_result;
  cint t27, t28, t29, t30;
  ((cptr)((cptr)variable_self)[8] /* value*/)[1] += 1;
  t28 = ((cptr)(((cptr)((cptr)variable_self)[8] /* value*/)[0]))[88];
  t29 = ((f0)t28)((cint)((cptr)variable_self)[8] /* value*/); /* Mkstr*/
  variable_result = t29;
  object_Dec_ref(variable_self);
  t27 = variable_result;
  goto t27_label;
  t27_label: return t27;
}

cint variable_New(cint variable_self){
  cint variable_result;
  cint t31, t32, t33, t34, t35, t36;
  t32 = mem_malloc(28); ((cptr)t32)[0] = abstract_methods;
  t33 = abstract_alloc((cint)t32);
  variable_result = t33;
  ((cptr)variable_result)[1] += 1;
  t34 = ((cptr)(((cptr)((cptr)variable_self)[8] /* value*/)[0]))[7];
  t35 = ((f0)t34)((cint)((cptr)variable_self)[8] /* value*/, (cint)variable_result); /* Append*/
  ((cptr)variable_self)[8] /* value*/ = t35;
  object_Dec_ref(variable_self);
  t31 = variable_result;
  goto t31_label;
  t31_label: return t31;
}

cint variable_OpAssign(cint variable_self, cint variable_val, cint variable_op){
  cint t37, t38, t39, t40, t41, t42, t43, t44, t45, t46, t47, t48, t49, t50, t51, t52, t53, t54, t55, t56, t57, t58, t59, t60, t61, t62, t63, t64, t65, t66, t67, t68, t69, t70, t71;
  t38 = ((cptr)variable_self)[9] /* flag*/ == 0;
  if (t38){
    ((cptr)strpool_str_71)[1] += 1;
    debug_message((cint)strpool_str_71);
    debug_interact();
  };
  t39 = variable_op == 0;
  if (t39){
    object_Dec_ref(((cptr)variable_self)[8] /* value*/);
  };
  t40 = variable_op == 1;
  if (t40){
    t41 = ((cptr)(((cptr)((cptr)variable_self)[8] /* value*/)[0]))[31];
    t42 = ((f0)t41)((cint)((cptr)variable_self)[8] /* value*/, (cint)variable_val); /* Divide*/
    variable_val = t42;
  };
  t44 = variable_op == 2;
  if (t44){
    t45 = ((cptr)(((cptr)((cptr)variable_self)[8] /* value*/)[0]))[83];
    t46 = ((f0)t45)((cint)((cptr)variable_self)[8] /* value*/, (cint)variable_val); /* Minus*/
    variable_val = t46;
  };
  t48 = variable_op == 3;
  if (t48){
    t49 = ((cptr)(((cptr)((cptr)variable_self)[8] /* value*/)[0]))[89];
    t50 = ((f0)t49)((cint)((cptr)variable_self)[8] /* value*/, (cint)variable_val); /* Multiply*/
    variable_val = t50;
  };
  t52 = variable_op == 4;
  if (t52){
    t53 = ((cptr)(((cptr)((cptr)variable_self)[8] /* value*/)[0]))[97];
    t54 = ((f0)t53)((cint)((cptr)variable_self)[8] /* value*/, (cint)variable_val); /* Plus*/
    variable_val = t54;
  };
  ((cptr)variable_self)[8] /* value*/ = variable_val;
  ((cptr)((cptr)variable_self)[7] /* type*/)[1] += 1;
  ((cptr)variable_val)[1] += 1;
  t56 = ((cptr)(((cptr)((cptr)variable_self)[7] /* type*/)[0]))[20];
  t57 = ((f0)t56)((cint)((cptr)variable_self)[7] /* type*/, (cint)variable_val); /* Contains*/
  t58 = t57 == boolean_True;
  if (t58){
    ((cptr)variable_self)[8] /* value*/ = variable_val;
  }else{
  t59 = variable_val == object_Undefined;
  if (t59){
    ((cptr)variable_self)[8] /* value*/ = object_Undefined;
  }else{
  t60 = ((cptr)variable_val)[4] /* class_of*/ == strpool_str_32;
  t61 = t60;
  if (t61){
    t62 = ((cptr)variable_val)[3] /* len*/ == 0;
    t61 = t62;
  };
  t63 = t61;
  if (t63){
    t64 = ((cptr)((cptr)variable_self)[7] /* type*/)[5] /* representation*/ == strpool_str_59;
    t63 = t64;
  };
  if (t63){
    object_Dec_ref(variable_val);
    ((cptr)variable_self)[8] /* value*/ = object_Undefined;
  }else{
    ((cptr)strpool_str_72)[1] += 1;
    debug_message((cint)strpool_str_72);
    ((cptr)((cptr)variable_self)[7] /* type*/)[1] += 1;
    t65 = ((cptr)(((cptr)((cptr)variable_self)[7] /* type*/)[0]))[38];
    t66 = ((f0)t65)((cint)((cptr)variable_self)[7] /* type*/); /* Eval*/
    t68 = ((cptr)(((cptr)t66)[0]))[88];
    t69 = ((f0)t68)((cint)t66); /* Mkstr*/
    debug_message((cint)t69);
    ((cptr)variable_val)[1] += 1;
    t70 = ((cptr)(((cptr)variable_val)[0]))[88];
    t71 = ((f0)t70)((cint)variable_val); /* Mkstr*/
    debug_message((cint)t71);
    debug_interact();
    object_Dec_ref(variable_val);
    ((cptr)variable_self)[8] /* value*/ = object_Undefined;
  };};};
  object_Dec_ref(variable_self);
  t37_label: return t37;
}

cint variable_Powerset(cint variable_self){
  cint variable_result;
  cint t72, t73, t74;
  t73 = mem_malloc(32); ((cptr)t73)[0] = powset_methods;
  t74 = powset_alloc((cint)t73, (cint)variable_self);
  t72 = t74;
  goto t72_label;
  t72_label: return t72;
}

cint variable_Subset(cint variable_self, cint variable_val){
  cint variable_result;
  cint t75, t76, t77, t78, t79, t80, t81;
  ((cptr)((cptr)variable_self)[8] /* value*/)[1] += 1;
  t76 = ((cptr)(((cptr)variable_val)[0]))[38];
  t77 = ((f0)t76)((cint)variable_val); /* Eval*/
  t78 = ((cptr)(((cptr)((cptr)variable_self)[8] /* value*/)[0]))[104];
  t79 = ((f0)t78)((cint)((cptr)variable_self)[8] /* value*/, (cint)t77); /* Subset*/
  variable_result = t79;
  object_Dec_ref(variable_self);
  t75 = variable_result;
  goto t75_label;
  t75_label: return t75;
}

void init_variable(){
  copy_meth_table(variable_methods, object_methods);
  variable_methods[0] = 40;
  variable_methods[3] = variable_alloc;
  variable_methods[4] = variable_reclaim;
  variable_methods[20] = variable_Contains;
  variable_methods[38] = variable_Eval;
  variable_methods[41] = variable_Expanded_with;
  variable_methods[61] = variable_List_of;
  variable_methods[77] = variable_Make_parameter;
  variable_methods[78] = variable_Make_parameterless;
  variable_methods[73] = variable_Make_selector;
  variable_methods[88] = variable_Mkstr;
  variable_methods[93] = variable_New;
  variable_methods[96] = variable_OpAssign;
  variable_methods[99] = variable_Powerset;
  variable_methods[104] = variable_Subset;
}
