array A_nextFree436 integer A_firstFree192 integer A_maxIndex979 array A_typeId100 integer A_firstFree192 = 0 integer A_maxIndex979 = 0 function initGlobals342() { A_firstFree_192 = 0; A_maxIndex_979 = 0; } function main120() { initGlobals342(); init_test153(); } function config158() { } function init_test153() { local integer b152 b_152 = new_B108(); dispatch_A_destroyA667(b_152); } IS_NATIVE function testSuccess922() { } function A_init198(integer this372) { } function construct_A400(integer this814) { A_init198(this_814); } function A_onDestroy977(integer this591) { } function destroyA149(integer this147) { A_onDestroy977(this_147); dealloc_A168(this_147); } function destroyB179(integer this100) { B_onDestroy177(this_100); dealloc_B172(this_100); } function B_init105(integer this585) { construct_B_OnDestroy175(this_585); } function construct_B_OnDestroy175(integer this127) { } function new_B108() returns integer { local integer this110 this_110 = alloc_B714(); construct_B137(this_110); return this_110; } function construct_B137(integer this174) { construct_A400(this_174); B_init105(this_174); } function B_onDestroy177(integer this586) { testSuccess922(); A_onDestroy977(this_586); } function error715(string msg693) { $debugPrint108((msg_693 + (" " + #getStackTrace()))); } function dealloc_A168(integer obj164) { if (A_typeId_100[obj_164] == 0) { error715("Double free: object of type A"); } else { A_nextFree_436[A_firstFree_192] = obj_164; A_firstFree_192 = (A_firstFree_192 + 1); A_typeId_100[obj_164] = 0; }; } function alloc_B714() returns integer { local integer this753 if (A_firstFree_192 == 0) { if (A_maxIndex_979 < 32768) { A_maxIndex_979 = (A_maxIndex_979 + 1); this_753 = A_maxIndex_979; A_typeId_100[this_753] = 2; } else { error715("Out of memory: Could not create B."); this_753 = 0; }; } else { A_firstFree_192 = (A_firstFree_192 - 1); this_753 = A_nextFree_436[A_firstFree_192]; A_typeId_100[this_753] = 2; }; return this_753; } function dealloc_B172(integer obj638) { if (A_typeId_100[obj_638] == 0) { error715("Double free: object of type B"); } else { A_nextFree_436[A_firstFree_192] = obj_638; A_firstFree_192 = (A_firstFree_192 + 1); A_typeId_100[obj_638] = 0; }; } function dispatch_A_destroyA667(integer this500) { if (A_typeId_100[this_500] == 0) { if (this_500 == 0) { error715("Nullpointer exception when calling A.A"); } else { error715("Called A.A on invalid object."); }; } else { }; if (A_typeId_100[this_500] <= 1) { destroyA149(this_500); } else { destroyB179(this_500); }; }