array C_nextFree114 integer C_firstFree112 integer C_maxIndex974 array C_typeId325 integer C_firstFree112 = 0 integer C_maxIndex974 = 0 function initGlobals566() { C_firstFree_112 = 0; C_maxIndex_974 = 0; } function main198() { initGlobals566(); init_test505(); } function config101() { } function init_test505() { local integer a168 local integer b237 a_168 = new_C137(); dispatch_C_destroyC152(a_168); a_168 = new_C137(); dispatch_C_destroyC152(a_168); a_168 = new_C137(); b_237 = new_C137(); if (a_168 != b_237) { testSuccess147(); } else { }; } IS_NATIVE function testSuccess147() { } function C_init209(integer this203) { } function new_C137() returns integer { local integer this149 this_149 = alloc_C327(); construct_C987(this_149); return this_149; } function construct_C987(integer this170) { C_init209(this_170); } function C_onDestroy118(integer this151) { } function destroyC202(integer this972) { C_onDestroy118(this_972); dealloc_C816(this_972); } function alloc_C327() returns integer { local integer this177 if (C_firstFree_112 == 0) { if (C_maxIndex_974 < 32768) { C_maxIndex_974 = (C_maxIndex_974 + 1); this_177 = C_maxIndex_974; C_typeId_325[this_177] = 1; } else { error120("Out of memory: Could not create C."); this_177 = 0; }; } else { C_firstFree_112 = (C_firstFree_112 - 1); this_177 = C_nextFree_114[C_firstFree_112]; C_typeId_325[this_177] = 1; }; return this_177; } function error120(string msg147) { $debugPrint498((msg_147 + (" " + #getStackTrace()))); } function dealloc_C816(integer obj681) { if (C_typeId_325[obj_681] == 0) { error120("Double free: object of type C"); } else { C_nextFree_114[C_firstFree_112] = obj_681; C_firstFree_112 = (C_firstFree_112 + 1); C_typeId_325[obj_681] = 0; }; } function dispatch_C_destroyC152(integer this175) { if (C_typeId_325[this_175] == 0) { if (this_175 == 0) { error120("Nullpointer exception when calling C.C"); } else { error120("Called C.C on invalid object."); }; } else { }; destroyC202(this_175); }