array A_nextFree150 integer A_firstFree201 integer A_maxIndex200 array A_typeId104 integer A_firstFree201 = 0 integer A_maxIndex200 = 0 function initGlobals194() { } function main752() { initGlobals194(); init_Test191(); } function config207() { } function init_Test191() { local integer a961 local integer e188 local integer count1180 a_961 = new_A121(); new_A121(); new_A121(); new_A121(); e_188 = new_A121(); count1_180 = instanceCount125(1); dispatch_A_destroyA316(a_961); dispatch_A_destroyA316(e_188); e_188 = instanceCount125(1); if ((count1_180 == 5) and (e_188 == 3)) { testSuccess188(); } else { }; } IS_NATIVE function testSuccess188() { } function new_A121() returns integer { local integer this197 if (A_firstFree_201 == 0) { if (A_maxIndex_200 < 32768) { A_maxIndex_200 = (A_maxIndex_200 + 1); this_197 = A_maxIndex_200; A_typeId_104[this_197] = 1; } else { error201("Out of memory: Could not create A."); this_197 = 0; }; } else { A_firstFree_201 = (A_firstFree_201 - 1); this_197 = A_nextFree_150[A_firstFree_201]; A_typeId_104[this_197] = 1; }; return this_197; } function instanceCount125(integer typeId840) returns integer { return (A_maxIndex_200 - A_firstFree_201); } function error201(string msg593) { $debugPrint200((msg_593 + (" " + #getStackTrace()))); } function dispatch_A_destroyA316(integer this598) { if (A_typeId_104[this_598] == 0) { if (this_598 == 0) { error201("Nullpointer exception when calling A.A"); } else { error201("Called A.A on invalid object."); }; } else { }; if (A_typeId_104[this_598] == 0) { error201("Double free: object of type A"); } else { A_nextFree_150[A_firstFree_201] = this_598; A_firstFree_201 = (A_firstFree_201 + 1); A_typeId_104[this_598] = 0; }; }