array A_nextFree202 integer A_firstFree106 integer A_maxIndex773 array A_typeId164 integer A_firstFree106 = 0 integer A_maxIndex773 = 0 function initGlobals935() { } function main142() { initGlobals935(); init_Test126(); } function config173() { } function init_Test126() { local integer a124 local integer e287 local integer count1425 a_124 = new_A340(); new_A340(); new_A340(); new_A340(); e_287 = new_A340(); count1_425 = instanceCount136(1); dispatch_A_destroyA106(a_124); dispatch_A_destroyA106(e_287); e_287 = instanceCount136(1); if ((count1_425 == 5) and (e_287 == 3)) { testSuccess433(); } else { }; } IS_NATIVE function testSuccess433() { } function A_init138(integer this737) { } function new_A340() returns integer { local integer this190 this_190 = alloc_A201(); construct_A119(this_190); return this_190; } function construct_A119(integer this154) { A_init138(this_154); } function A_onDestroy381(integer this168) { } function destroyA384(integer this138) { A_onDestroy381(this_138); dealloc_A185(this_138); } function instanceCount136(integer typeId108) returns integer { return (A_maxIndex_773 - A_firstFree_106); } function alloc_A201() returns integer { local integer this185 if (A_firstFree_106 == 0) { if (A_maxIndex_773 < 32768) { A_maxIndex_773 = (A_maxIndex_773 + 1); this_185 = A_maxIndex_773; A_typeId_164[this_185] = 1; } else { error554("Out of memory: Could not create A."); this_185 = 0; }; } else { A_firstFree_106 = (A_firstFree_106 - 1); this_185 = A_nextFree_202[A_firstFree_106]; A_typeId_164[this_185] = 1; }; return this_185; } function error554(string msg368) { $debugPrint632((msg_368 + (" " + #getStackTrace()))); } function dealloc_A185(integer obj628) { if (A_typeId_164[obj_628] == 0) { error554("Double free: object of type A"); } else { A_nextFree_202[A_firstFree_106] = obj_628; A_firstFree_106 = (A_firstFree_106 + 1); A_typeId_164[obj_628] = 0; }; } function dispatch_A_destroyA106(integer this190) { if (A_typeId_164[this_190] == 0) { if (this_190 == 0) { error554("Nullpointer exception when calling A.A"); } else { error554("Called A.A on invalid object."); }; } else { }; destroyA384(this_190); }