array A_nextFree604 integer A_firstFree914 integer A_maxIndex169 array A_typeId181 integer A_firstFree914 = 0 integer A_maxIndex169 = 0 function initGlobals182() { } function main987() { initGlobals182(); init_Test178(); } function config110() { } function init_Test178() { local integer a185 local integer e826 local integer count1181 a_185 = new_A962(); new_A962(); new_A962(); new_A962(); e_826 = new_A962(); count1_181 = instanceCount120(1); dispatch_A_destroyA430(a_185); dispatch_A_destroyA430(e_826); e_826 = instanceCount120(1); if ((count1_181 == 5) and (e_826 == 3)) { testSuccess806(); } else { }; } IS_NATIVE function testSuccess806() { } function new_A962() returns integer { local integer this743 if (A_firstFree_914 == 0) { if (A_maxIndex_169 < 32768) { A_maxIndex_169 = (A_maxIndex_169 + 1); this_743 = A_maxIndex_169; A_typeId_181[this_743] = 1; } else { error814("Out of memory: Could not create A."); this_743 = 0; }; } else { A_firstFree_914 = (A_firstFree_914 - 1); this_743 = A_nextFree_604[A_firstFree_914]; A_typeId_181[this_743] = 1; }; return this_743; } function instanceCount120(integer typeId147) returns integer { return (A_maxIndex_169 - A_firstFree_914); } function error814(string msg607) { $debugPrint848((msg_607 + (" " + #getStackTrace()))); } function dispatch_A_destroyA430(integer this751) { if (A_typeId_181[this_751] == 0) { if (this_751 == 0) { error814("Nullpointer exception when calling A.A"); } else { error814("Called A.A on invalid object."); }; } else { }; if (A_typeId_181[this_751] == 0) { error814("Double free: object of type A"); } else { A_nextFree_604[A_firstFree_914] = this_751; A_firstFree_914 = (A_firstFree_914 + 1); A_typeId_181[this_751] = 0; }; }