array C_nextFree157 integer C_firstFree514 integer C_maxIndex499 array C_typeId117 integer C_firstFree514 = 0 integer C_maxIndex499 = 0 function initGlobals141() { } function main110() { initGlobals141(); init_test805(); } function config178() { } function init_test805() { local array cs111 local integer i207 local integer j211 local integer k127 i_207 = 0; loop { exitwhen (i_207 > 6000); cs_111[i_207] = new_C803(); i_207 = (i_207 + 1); }; j_211 = 0; loop { exitwhen (j_211 > 6000); dispatch_C_destroyC394(cs_111[j_211]); j_211 = (j_211 + 1); }; k_127 = 0; loop { exitwhen (k_127 > 6000); cs_111[k_127] = new_C803(); k_127 = (k_127 + 1); }; if ((cs_111[6000] castTo integer) <= 6001) { testSuccess204(); } else { }; } IS_NATIVE function testSuccess204() { } function new_C803() returns integer { local integer this113 local integer this256 if (C_firstFree_514 == 0) { if (C_maxIndex_499 < 32768) { C_maxIndex_499 = (C_maxIndex_499 + 1); this_256 = C_maxIndex_499; C_typeId_117[this_256] = 1; } else { error128("Out of memory: Could not create C."); this_256 = 0; }; } else { C_firstFree_514 = (C_firstFree_514 - 1); this_256 = C_nextFree_157[C_firstFree_514]; C_typeId_117[this_256] = 1; }; this_113 = this_256; return this_113; } function error128(string msg677) { $debugPrint155((msg_677 + (" " + #getStackTrace()))); } function dispatch_C_destroyC394(integer this167) { local integer this139 local integer obj181 if (C_typeId_117[this_167] == 0) { if (this_167 == 0) { error128("Nullpointer exception when calling C.C"); } else { error128("Called C.C on invalid object."); }; } else { }; this_139 = this_167; obj_181 = this_139; if (C_typeId_117[obj_181] == 0) { error128("Double free: object of type C"); } else { C_nextFree_157[C_firstFree_514] = obj_181; C_firstFree_514 = (C_firstFree_514 + 1); C_typeId_117[obj_181] = 0; }; }