array C_nextFree193 integer C_firstFree140 integer C_maxIndex173 array C_typeId588 integer C_firstFree140 = 0 integer C_maxIndex173 = 0 function initGlobals135() { C_firstFree_140 = 0; C_maxIndex_173 = 0; } function main388() { initGlobals135(); init_test893(); } function config484() { } function init_test893() { local integer a130 local integer b336 a_130 = new_C676(); dispatch_C_destroyC177(a_130); a_130 = new_C676(); dispatch_C_destroyC177(a_130); a_130 = new_C676(); b_336 = new_C676(); if (a_130 != b_336) { testSuccess139(); } else { }; } IS_NATIVE function testSuccess139() { } function C_init161(integer this211) { } function new_C676() returns integer { local integer this668 this_668 = alloc_C607(); construct_C118(this_668); return this_668; } function construct_C118(integer this135) { C_init161(this_135); } function C_onDestroy645(integer this915) { } function destroyC278(integer this153) { C_onDestroy645(this_153); dealloc_C122(this_153); } function alloc_C607() returns integer { local integer this708 if (C_firstFree_140 == 0) { if (C_maxIndex_173 < 32768) { C_maxIndex_173 = (C_maxIndex_173 + 1); this_708 = C_maxIndex_173; C_typeId_588[this_708] = 1; } else { error157("Out of memory: Could not create C."); this_708 = 0; }; } else { C_firstFree_140 = (C_firstFree_140 - 1); this_708 = C_nextFree_193[C_firstFree_140]; C_typeId_588[this_708] = 1; }; return this_708; } function error157(string msg214) { $debugPrint145((msg_214 + (" " + #getStackTrace()))); } function dealloc_C122(integer obj894) { if (C_typeId_588[obj_894] == 0) { error157("Double free: object of type C"); } else { C_nextFree_193[C_firstFree_140] = obj_894; C_firstFree_140 = (C_firstFree_140 + 1); C_typeId_588[obj_894] = 0; }; } function dispatch_C_destroyC177(integer this257) { if (C_typeId_588[this_257] == 0) { if (this_257 == 0) { error157("Nullpointer exception when calling C.C"); } else { error157("Called C.C on invalid object."); }; } else { }; destroyC278(this_257); }