array A_nextFree196 integer A_firstFree154 integer A_maxIndex102 array A_typeId251 integer A_firstFree154 = 0 integer A_maxIndex102 = 0 function initGlobals974() { A_firstFree_154 = 0; A_maxIndex_102 = 0; } function main157() { initGlobals974(); init_Test806(); } function config186() { } function init_Test806() { local integer a134 local integer e826 local integer count1658 local integer count2208 a_134 = new_A393(); new_A393(); new_A393(); new_A393(); e_826 = new_A393(); count1_658 = instanceCount122(1); dispatch_A_destroyA892(a_134); dispatch_A_destroyA892(e_826); count2_208 = instanceCount122(1); if ((count1_658 == 5) and (count2_208 == 3)) { testSuccess114(); } else { }; } IS_NATIVE function testSuccess114() { } function A_init182(integer this128) { } function new_A393() returns integer { local integer this567 this_567 = alloc_A178(); construct_A747(this_567); return this_567; } function construct_A747(integer this175) { A_init182(this_175); } function A_onDestroy181(integer this188) { } function destroyA159(integer this140) { A_onDestroy181(this_140); dealloc_A210(this_140); } function instanceCount122(integer typeId446) returns integer { return (A_maxIndex_102 - A_firstFree_154); return 0; } function alloc_A178() returns integer { local integer this185 if (A_firstFree_154 == 0) { if (A_maxIndex_102 < 32768) { A_maxIndex_102 = (A_maxIndex_102 + 1); this_185 = A_maxIndex_102; A_typeId_251[this_185] = 1; } else { error133("Out of memory: Could not create A."); this_185 = 0; }; } else { A_firstFree_154 = (A_firstFree_154 - 1); this_185 = A_nextFree_196[A_firstFree_154]; A_typeId_251[this_185] = 1; }; return this_185; } function error133(string msg118) { $debugPrint105((msg_118 + (" " + #getStackTrace()))); } function dealloc_A210(integer obj204) { if (A_typeId_251[obj_204] == 0) { error133("Double free: object of type A"); } else { A_nextFree_196[A_firstFree_154] = obj_204; A_firstFree_154 = (A_firstFree_154 + 1); A_typeId_251[obj_204] = 0; }; } function dispatch_A_destroyA892(integer this214) { if (A_typeId_251[this_214] == 0) { if (this_214 == 0) { error133("Nullpointer exception when calling A.A"); } else { error133("Called A.A on invalid object."); }; } else { }; destroyA159(this_214); }