integer test_x462 array B_nextFree114 integer B_firstFree661 integer B_maxIndex348 array B_typeId131 integer test_x462 = 2 integer B_firstFree661 = 0 integer B_maxIndex348 = 0 function initGlobals437() { B_firstFree_661 = 0; B_maxIndex_348 = 0; } function main123() { initGlobals437(); init_test159(); } function config108() { } function init_test159() { local integer a770 test_x_462 = 2; a_770 = new_A193(); dispatch_B_destroyB397(a_770); if (test_x_462 == 6) { testSuccess152(); } else { }; } IS_NATIVE function testSuccess152() { } function destroyA331(integer this118) { A_onDestroy112(this_118); dealloc_A915(this_118); } function A_init979(integer this119) { } function new_A193() returns integer { local integer this209 this_209 = alloc_A200(); construct_A160(this_209); return this_209; } function construct_A160(integer this425) { construct_B101(this_425); A_init979(this_425); } function A_onDestroy112(integer this178) { test_x_462 = (test_x_462 + 1); B_onDestroy169(this_178); } function B_init184(integer this120) { } function construct_B101(integer this496) { B_init184(this_496); } function B_onDestroy169(integer this110) { test_x_462 = (test_x_462 * 2); } function destroyB198(integer this576) { B_onDestroy169(this_576); dealloc_B168(this_576); } function alloc_A200() returns integer { local integer this151 if (B_firstFree_661 == 0) { if (B_maxIndex_348 < 32768) { B_maxIndex_348 = (B_maxIndex_348 + 1); this_151 = B_maxIndex_348; B_typeId_131[this_151] = 2; } else { error557("Out of memory: Could not create A."); this_151 = 0; }; } else { B_firstFree_661 = (B_firstFree_661 - 1); this_151 = B_nextFree_114[B_firstFree_661]; B_typeId_131[this_151] = 2; }; return this_151; } function error557(string msg194) { $debugPrint971((msg_194 + (" " + #getStackTrace()))); } function dealloc_A915(integer obj176) { if (B_typeId_131[obj_176] == 0) { error557("Double free: object of type A"); } else { B_nextFree_114[B_firstFree_661] = obj_176; B_firstFree_661 = (B_firstFree_661 + 1); B_typeId_131[obj_176] = 0; }; } function dealloc_B168(integer obj204) { if (B_typeId_131[obj_204] == 0) { error557("Double free: object of type B"); } else { B_nextFree_114[B_firstFree_661] = obj_204; B_firstFree_661 = (B_firstFree_661 + 1); B_typeId_131[obj_204] = 0; }; } function dispatch_B_destroyB397(integer this838) { if (B_typeId_131[this_838] == 0) { if (this_838 == 0) { error557("Nullpointer exception when calling B.B"); } else { error557("Called B.B on invalid object."); }; } else { }; if (B_typeId_131[this_838] <= 1) { destroyB198(this_838); } else { destroyA331(this_838); }; }