#include "cdefs.h"
#include "mem.h"
extern cptr object_methods[meth_max];
extern cptr list_methods[meth_max];
extern cptr slist_methods[meth_max];
extern cptr strpool_methods[meth_max];

extern cint strpool_str_77;


cptr parameter_methods[meth_max];

cint parameter_alloc(cint parameter_self, cint parameter_v, cint parameter_i){
  cint parameter_result;
  cint t1, t2, t3, t4, t5, t6, t7, t8;
  t2 = object_alloc((cint)parameter_self);
  parameter_result = t2;
  ((cptr)parameter_self)[4] /* class_of*/ = strpool_str_77;
  ((cptr)parameter_self)[7] /* value*/ = parameter_v;
  t3 = mem_malloc(40); ((cptr)t3)[0] = slist_methods;
  t4 = slist_alloc((cint)t3, (cint)3);
  ((cptr)parameter_self)[8] /* indices*/ = t4;
  t5 = parameter_i != 0;
  if (t5){
    t6 = ((cptr)(((cptr)((cptr)parameter_self)[8] /* indices*/)[0]))[7];
    t7 = ((f0)t6)((cint)((cptr)parameter_self)[8] /* indices*/, (cint)parameter_i); /* Append*/
    ((cptr)parameter_self)[8] /* indices*/ = t7;
  };
  t1 = parameter_result;
  goto t1_label;
  t1_label: return t1;
}

cint parameter_reclaim(cint parameter_self){
  cint t9;
  object_Dec_ref(((cptr)parameter_self)[7] /* value*/);
  object_Dec_ref(((cptr)parameter_self)[8] /* indices*/);
  object_reclaim((cint)parameter_self);
  t9_label: return t9;
}

cint parameter_Apply(cint parameter_self, cint parameter_params){
  cint parameter_result;
  cint t10, t11, t12, t13, t14, t15, t16;
  t11 = ((cptr)(((cptr)parameter_self)[0]))[38];
  t12 = ((f0)t11)((cint)parameter_self); /* Eval*/
  t14 = ((cptr)(((cptr)t12)[0]))[9];
  t15 = ((f0)t14)((cint)t12, (cint)parameter_params); /* Apply*/
  t10 = t15;
  goto t10_label;
  t10_label: return t10;
}

cint parameter_End_parlist(cint parameter_self){
  cint parameter_result;
  cint t17, t18, t19, t20, t21;
  t18 = mem_malloc(36); ((cptr)t18)[0] = parameter_methods;
  t19 = object_alloc((cint)t18);
  parameter_result = t19;
  ((cptr)parameter_result)[4] /* class_of*/ = strpool_str_77;
  ((cptr)parameter_result)[7] /* value*/ = parameter_self;
  t20 = mem_malloc(40); ((cptr)t20)[0] = slist_methods;
  t21 = slist_alloc((cint)t20, (cint)3);
  ((cptr)parameter_result)[8] /* indices*/ = t21;
  t17 = parameter_result;
  goto t17_label;
  t17_label: return t17;
}

cint parameter_Eval(cint parameter_self){
  cint parameter_result;
  cint t22, t23, t24, t25;
  ((cptr)((cptr)parameter_self)[7] /* value*/)[1] += 1;
  ((cptr)((cptr)parameter_self)[8] /* indices*/)[1] += 1;
  t23 = ((cptr)(((cptr)((cptr)parameter_self)[7] /* value*/)[0]))[9];
  t24 = ((f0)t23)((cint)((cptr)parameter_self)[7] /* value*/, (cint)((cptr)parameter_self)[8] /* indices*/); /* Apply*/
  parameter_result = t24;
  object_Dec_ref(parameter_self);
  t22 = parameter_result;
  goto t22_label;
  t22_label: return t22;
}

cint parameter_Make_parameter(cint parameter_self, cint parameter_ob){
  cint parameter_result;
  cint t26, t27, t28, t29;
  t27 = ((cptr)(((cptr)((cptr)parameter_self)[8] /* indices*/)[0]))[7];
  t28 = ((f0)t27)((cint)((cptr)parameter_self)[8] /* indices*/, (cint)parameter_ob); /* Append*/
  ((cptr)parameter_self)[8] /* indices*/ = t28;
  t26 = parameter_self;
  goto t26_label;
  t26_label: return t26;
}

void init_parameter(){
  copy_meth_table(parameter_methods, object_methods);
  parameter_methods[0] = 36;
  parameter_methods[3] = parameter_alloc;
  parameter_methods[4] = parameter_reclaim;
  parameter_methods[9] = parameter_Apply;
  parameter_methods[35] = parameter_End_parlist;
  parameter_methods[38] = parameter_Eval;
  parameter_methods[77] = parameter_Make_parameter;
}
