array A_nextFree142 integer A_firstFree400 integer A_maxIndex582 array A_typeId727 integer A_firstFree400 = 0 integer A_maxIndex582 = 0 function initGlobals915() { A_firstFree_400 = 0; A_maxIndex_582 = 0; } function main121() { initGlobals915(); init_test112(); } function config584() { } function init_test112() { local integer b195 b_195 = new_B181(); dispatch_A_destroyA353(b_195); } IS_NATIVE function testSuccess145() { } function A_init167(integer this687) { } function construct_A166(integer this174) { A_init167(this_174); } function A_onDestroy877(integer this200) { } function destroyA647(integer this171) { A_onDestroy877(this_171); dealloc_A135(this_171); } function destroyB184(integer this286) { B_onDestroy120(this_286); dealloc_B793(this_286); } function B_init314(integer this750) { construct_B_OnDestroy886(this_750); } function construct_B_OnDestroy886(integer this623) { } function new_B181() returns integer { local integer this115 this_115 = alloc_B202(); construct_B111(this_115); return this_115; } function construct_B111(integer this452) { construct_A166(this_452); B_init314(this_452); } function B_onDestroy120(integer this138) { testSuccess145(); A_onDestroy877(this_138); } function error180(string msg190) { $debugPrint231((msg_190 + (" " + #getStackTrace()))); } function dealloc_A135(integer obj767) { if (A_typeId_727[obj_767] == 0) { error180("Double free: object of type A"); } else { A_nextFree_142[A_firstFree_400] = obj_767; A_firstFree_400 = (A_firstFree_400 + 1); A_typeId_727[obj_767] = 0; }; } function alloc_B202() returns integer { local integer this133 if (A_firstFree_400 == 0) { if (A_maxIndex_582 < 32768) { A_maxIndex_582 = (A_maxIndex_582 + 1); this_133 = A_maxIndex_582; A_typeId_727[this_133] = 2; } else { error180("Out of memory: Could not create B."); this_133 = 0; }; } else { A_firstFree_400 = (A_firstFree_400 - 1); this_133 = A_nextFree_142[A_firstFree_400]; A_typeId_727[this_133] = 2; }; return this_133; } function dealloc_B793(integer obj860) { if (A_typeId_727[obj_860] == 0) { error180("Double free: object of type B"); } else { A_nextFree_142[A_firstFree_400] = obj_860; A_firstFree_400 = (A_firstFree_400 + 1); A_typeId_727[obj_860] = 0; }; } function dispatch_A_destroyA353(integer this183) { if (A_typeId_727[this_183] == 0) { if (this_183 == 0) { error180("Nullpointer exception when calling A.A"); } else { error180("Called A.A on invalid object."); }; } else { }; if (A_typeId_727[this_183] <= 1) { destroyA647(this_183); } else { destroyB184(this_183); }; }