array C_nextFree169 integer C_firstFree173 integer C_maxIndex217 array C_typeId151 integer C_firstFree173 = 0 integer C_maxIndex217 = 0 function initGlobals896() { } function main190() { initGlobals896(); init_test147(); } function config415() { } function init_test147() { local array cs111 local integer i696 local integer j448 local integer k126 i_696 = 0; loop { exitwhen (i_696 > 6000); cs_111[i_696] = new_C974(); i_696 = (i_696 + 1); }; j_448 = 0; loop { exitwhen (j_448 > 6000); dispatch_C_destroyC230(cs_111[j_448]); j_448 = (j_448 + 1); }; k_126 = 0; loop { exitwhen (k_126 > 6000); cs_111[k_126] = new_C974(); k_126 = (k_126 + 1); }; if ((cs_111[6000] castTo integer) <= 6001) { testSuccess856(); } else { }; } IS_NATIVE function testSuccess856() { } function new_C974() returns integer { local integer this154 local integer this918 if (C_firstFree_173 == 0) { if (C_maxIndex_217 < 32768) { C_maxIndex_217 = (C_maxIndex_217 + 1); this_918 = C_maxIndex_217; C_typeId_151[this_918] = 1; } else { error140("Out of memory: Could not create C."); this_918 = 0; }; } else { C_firstFree_173 = (C_firstFree_173 - 1); this_918 = C_nextFree_169[C_firstFree_173]; C_typeId_151[this_918] = 1; }; this_154 = this_918; return this_154; } function error140(string msg217) { $debugPrint923((msg_217 + (" " + #getStackTrace()))); } function dispatch_C_destroyC230(integer this640) { local integer this648 local integer obj188 if (C_typeId_151[this_640] == 0) { if (this_640 == 0) { error140("Nullpointer exception when calling C.C"); } else { error140("Called C.C on invalid object."); }; } else { }; this_648 = this_640; obj_188 = this_648; if (C_typeId_151[obj_188] == 0) { error140("Double free: object of type C"); } else { C_nextFree_169[C_firstFree_173] = obj_188; C_firstFree_173 = (C_firstFree_173 + 1); C_typeId_151[obj_188] = 0; }; }