array A_nextFree187 integer A_firstFree213 integer A_maxIndex618 array A_typeId346 integer A_firstFree213 = 0 integer A_maxIndex618 = 0 function initGlobals211() { } function main433() { initGlobals211(); init_Test119(); } function config874() { } function init_Test119() { local integer a626 local integer e138 local integer count1590 local integer count2141 a_626 = new_A863(); new_A863(); new_A863(); new_A863(); e_138 = new_A863(); count1_590 = instanceCount278(1); dispatch_A_destroyA879(a_626); dispatch_A_destroyA879(e_138); count2_141 = instanceCount278(1); if ((count1_590 == 5) and (count2_141 == 3)) { testSuccess405(); } else { }; } IS_NATIVE function testSuccess405() { } function new_A863() returns integer { local integer this415 local integer this459 if (A_firstFree_213 == 0) { if (A_maxIndex_618 < 32768) { A_maxIndex_618 = (A_maxIndex_618 + 1); this_459 = A_maxIndex_618; A_typeId_346[this_459] = 1; } else { error563("Out of memory: Could not create A."); this_459 = 0; }; } else { A_firstFree_213 = (A_firstFree_213 - 1); this_459 = A_nextFree_187[A_firstFree_213]; A_typeId_346[this_459] = 1; }; this_415 = this_459; return this_415; } function instanceCount278(integer typeId708) returns integer { return (A_maxIndex_618 - A_firstFree_213); return 0; } function error563(string msg140) { $debugPrint826((msg_140 + (" " + #getStackTrace()))); } function dispatch_A_destroyA879(integer this288) { local integer this962 local integer obj998 if (A_typeId_346[this_288] == 0) { if (this_288 == 0) { error563("Nullpointer exception when calling A.A"); } else { error563("Called A.A on invalid object."); }; } else { }; this_962 = this_288; obj_998 = this_962; if (A_typeId_346[obj_998] == 0) { error563("Double free: object of type A"); } else { A_nextFree_187[A_firstFree_213] = obj_998; A_firstFree_213 = (A_firstFree_213 + 1); A_typeId_346[obj_998] = 0; }; }