array A_nextFree200 integer A_firstFree100 integer A_maxIndex312 array A_typeId153 integer A_firstFree100 = 0 integer A_maxIndex312 = 0 function initGlobals140() { } function main157() { initGlobals140(); init_Test745(); } function config513() { } function init_Test745() { local integer a258 local integer e190 local integer count1266 a_258 = new_A807(); new_A807(); new_A807(); new_A807(); e_190 = new_A807(); count1_266 = maxInstanceCount193(1); dispatch_A_destroyA205(a_258); dispatch_A_destroyA205(e_190); e_190 = maxInstanceCount193(1); if ((count1_266 == 5) and (e_190 == 5)) { testSuccess176(); } else { }; } IS_NATIVE function testSuccess176() { } function A_init851(integer this322) { } function new_A807() returns integer { local integer this617 this_617 = alloc_A959(); construct_A102(this_617); return this_617; } function construct_A102(integer this879) { A_init851(this_879); } function A_onDestroy328(integer this123) { } function destroyA107(integer this197) { A_onDestroy328(this_197); dealloc_A111(this_197); } function maxInstanceCount193(integer typeId170) returns integer { return A_maxIndex_312; } function alloc_A959() returns integer { local integer this618 if (A_firstFree_100 == 0) { if (A_maxIndex_312 < 32768) { A_maxIndex_312 = (A_maxIndex_312 + 1); this_618 = A_maxIndex_312; A_typeId_153[this_618] = 1; } else { error142("Out of memory: Could not create A."); this_618 = 0; }; } else { A_firstFree_100 = (A_firstFree_100 - 1); this_618 = A_nextFree_200[A_firstFree_100]; A_typeId_153[this_618] = 1; }; return this_618; } function error142(string msg209) { $debugPrint911((msg_209 + (" " + #getStackTrace()))); } function dealloc_A111(integer obj800) { if (A_typeId_153[obj_800] == 0) { error142("Double free: object of type A"); } else { A_nextFree_200[A_firstFree_100] = obj_800; A_firstFree_100 = (A_firstFree_100 + 1); A_typeId_153[obj_800] = 0; }; } function dispatch_A_destroyA205(integer this765) { if (A_typeId_153[this_765] == 0) { if (this_765 == 0) { error142("Nullpointer exception when calling A.A"); } else { error142("Called A.A on invalid object."); }; } else { }; destroyA107(this_765); }