array C_nextFree417 integer C_firstFree107 integer C_maxIndex205 array C_typeId188 integer C_firstFree107 = 0 integer C_maxIndex205 = 0 function initGlobals155() { } function main114() { initGlobals155(); init_test523(); } function config203() { } function init_test523() { local integer a169 local integer b202 a_169 = new_C751(); dispatch_C_destroyC145(a_169); a_169 = new_C751(); dispatch_C_destroyC145(a_169); a_169 = new_C751(); b_202 = new_C751(); if (a_169 != b_202) { testSuccess135(); } else { }; } IS_NATIVE function testSuccess135() { } function new_C751() returns integer { local integer this105 local integer this525 if (C_firstFree_107 == 0) { if (C_maxIndex_205 < 32768) { C_maxIndex_205 = (C_maxIndex_205 + 1); this_525 = C_maxIndex_205; C_typeId_188[this_525] = 1; } else { error556("Out of memory: Could not create C."); this_525 = 0; }; } else { C_firstFree_107 = (C_firstFree_107 - 1); this_525 = C_nextFree_417[C_firstFree_107]; C_typeId_188[this_525] = 1; }; this_105 = this_525; return this_105; } function error556(string msg170) { $debugPrint870((msg_170 + (" " + #getStackTrace()))); } function dispatch_C_destroyC145(integer this125) { local integer this183 local integer obj732 if (C_typeId_188[this_125] == 0) { if (this_125 == 0) { error556("Nullpointer exception when calling C.C"); } else { error556("Called C.C on invalid object."); }; } else { }; this_183 = this_125; obj_732 = this_183; if (C_typeId_188[obj_732] == 0) { error556("Double free: object of type C"); } else { C_nextFree_417[C_firstFree_107] = obj_732; C_firstFree_107 = (C_firstFree_107 + 1); C_typeId_188[obj_732] = 0; }; }