array A_nextFree104 integer A_firstFree127 integer A_maxIndex120 array A_typeId118 integer A_firstFree127 = 0 integer A_maxIndex120 = 0 function initGlobals935() { } function main244() { initGlobals935(); init_Test148(); } function config504() { } function init_Test148() { local integer a179 local integer e533 local integer count1146 a_179 = new_A141(); new_A141(); new_A141(); new_A141(); e_533 = new_A141(); count1_146 = maxInstanceCount161(1); dispatch_A_destroyA102(a_179); dispatch_A_destroyA102(e_533); e_533 = maxInstanceCount161(1); if ((count1_146 == 5) and (e_533 == 5)) { testSuccess649(); } else { }; } IS_NATIVE function testSuccess649() { } function A_init619(integer this119) { } function new_A141() returns integer { local integer this181 this_181 = alloc_A823(); construct_A354(this_181); return this_181; } function construct_A354(integer this128) { A_init619(this_128); } function A_onDestroy732(integer this114) { } function destroyA189(integer this187) { A_onDestroy732(this_187); dealloc_A971(this_187); } function maxInstanceCount161(integer typeId638) returns integer { return A_maxIndex_120; } function alloc_A823() returns integer { local integer this737 if (A_firstFree_127 == 0) { if (A_maxIndex_120 < 32768) { A_maxIndex_120 = (A_maxIndex_120 + 1); this_737 = A_maxIndex_120; A_typeId_118[this_737] = 1; } else { error443("Out of memory: Could not create A."); this_737 = 0; }; } else { A_firstFree_127 = (A_firstFree_127 - 1); this_737 = A_nextFree_104[A_firstFree_127]; A_typeId_118[this_737] = 1; }; return this_737; } function error443(string msg427) { $debugPrint625((msg_427 + (" " + #getStackTrace()))); } function dealloc_A971(integer obj787) { if (A_typeId_118[obj_787] == 0) { error443("Double free: object of type A"); } else { A_nextFree_104[A_firstFree_127] = obj_787; A_firstFree_127 = (A_firstFree_127 + 1); A_typeId_118[obj_787] = 0; }; } function dispatch_A_destroyA102(integer this156) { if (A_typeId_118[this_156] == 0) { if (this_156 == 0) { error443("Nullpointer exception when calling A.A"); } else { error443("Called A.A on invalid object."); }; } else { }; destroyA189(this_156); }