integer test_x191 array B_nextFree131 integer B_firstFree487 integer B_maxIndex147 array B_typeId152 integer test_x191 = 2 integer B_firstFree487 = 0 integer B_maxIndex147 = 0 function initGlobals595() { B_firstFree_487 = 0; B_maxIndex_147 = 0; } function main208() { initGlobals595(); init_test431(); } function config148() { } function init_test431() { local integer a177 test_x_191 = 2; a_177 = new_A165(); dispatch_B_destroyB100(a_177); if (test_x_191 == 6) { testSuccess202(); } else { }; } IS_NATIVE function testSuccess202() { } function destroyA989(integer this736) { A_onDestroy864(this_736); dealloc_A196(this_736); } function A_init114(integer this429) { } function new_A165() returns integer { local integer this532 this_532 = alloc_A179(); construct_A159(this_532); return this_532; } function construct_A159(integer this138) { construct_B104(this_138); A_init114(this_138); } function A_onDestroy864(integer this122) { test_x_191 = (test_x_191 + 1); B_onDestroy147(this_122); } function B_init181(integer this156) { } function construct_B104(integer this146) { B_init181(this_146); } function B_onDestroy147(integer this181) { test_x_191 = (test_x_191 * 2); } function destroyB347(integer this191) { B_onDestroy147(this_191); dealloc_B904(this_191); } function alloc_A179() returns integer { local integer this244 if (B_firstFree_487 == 0) { if (B_maxIndex_147 < 32768) { B_maxIndex_147 = (B_maxIndex_147 + 1); this_244 = B_maxIndex_147; B_typeId_152[this_244] = 2; } else { error142("Out of memory: Could not create A."); this_244 = 0; }; } else { B_firstFree_487 = (B_firstFree_487 - 1); this_244 = B_nextFree_131[B_firstFree_487]; B_typeId_152[this_244] = 2; }; return this_244; } function error142(string msg980) { $debugPrint864((msg_980 + (" " + #getStackTrace()))); } function dealloc_A196(integer obj199) { if (B_typeId_152[obj_199] == 0) { error142("Double free: object of type A"); } else { B_nextFree_131[B_firstFree_487] = obj_199; B_firstFree_487 = (B_firstFree_487 + 1); B_typeId_152[obj_199] = 0; }; } function dealloc_B904(integer obj184) { if (B_typeId_152[obj_184] == 0) { error142("Double free: object of type B"); } else { B_nextFree_131[B_firstFree_487] = obj_184; B_firstFree_487 = (B_firstFree_487 + 1); B_typeId_152[obj_184] = 0; }; } function dispatch_B_destroyB100(integer this121) { if (B_typeId_152[this_121] == 0) { if (this_121 == 0) { error142("Nullpointer exception when calling B.B"); } else { error142("Called B.B on invalid object."); }; } else { }; if (B_typeId_152[this_121] <= 1) { destroyB347(this_121); } else { destroyA989(this_121); }; }