array A_nextFree250 integer A_firstFree379 integer A_maxIndex192 array A_typeId157 integer A_firstFree379 = 0 integer A_maxIndex192 = 0 function initGlobals212() { } function main899() { initGlobals212(); init_Test823(); } function config128() { } function init_Test823() { local integer a129 local integer e122 local integer count1212 a_129 = new_A116(); new_A116(); new_A116(); new_A116(); e_122 = new_A116(); count1_212 = instanceCount175(1); dispatch_A_destroyA110(a_129); dispatch_A_destroyA110(e_122); e_122 = instanceCount175(1); if ((count1_212 == 5) and (e_122 == 3)) { testSuccess106(); } else { }; } IS_NATIVE function testSuccess106() { } function A_init200(integer this135) { } function new_A116() returns integer { local integer this202 this_202 = alloc_A158(); construct_A873(this_202); return this_202; } function construct_A873(integer this129) { A_init200(this_129); } function A_onDestroy185(integer this201) { } function destroyA867(integer this824) { A_onDestroy185(this_824); dealloc_A136(this_824); } function instanceCount175(integer typeId124) returns integer { return (A_maxIndex_192 - A_firstFree_379); } function alloc_A158() returns integer { local integer this149 if (A_firstFree_379 == 0) { if (A_maxIndex_192 < 32768) { A_maxIndex_192 = (A_maxIndex_192 + 1); this_149 = A_maxIndex_192; A_typeId_157[this_149] = 1; } else { error110("Out of memory: Could not create A."); this_149 = 0; }; } else { A_firstFree_379 = (A_firstFree_379 - 1); this_149 = A_nextFree_250[A_firstFree_379]; A_typeId_157[this_149] = 1; }; return this_149; } function error110(string msg741) { $debugPrint789((msg_741 + (" " + #getStackTrace()))); } function dealloc_A136(integer obj477) { if (A_typeId_157[obj_477] == 0) { error110("Double free: object of type A"); } else { A_nextFree_250[A_firstFree_379] = obj_477; A_firstFree_379 = (A_firstFree_379 + 1); A_typeId_157[obj_477] = 0; }; } function dispatch_A_destroyA110(integer this368) { if (A_typeId_157[this_368] == 0) { if (this_368 == 0) { error110("Nullpointer exception when calling A.A"); } else { error110("Called A.A on invalid object."); }; } else { }; destroyA867(this_368); }