integer test_x248 array B_nextFree902 integer B_firstFree124 integer B_maxIndex188 array B_typeId188 integer test_x248 = 2 integer B_firstFree124 = 0 integer B_maxIndex188 = 0 function initGlobals206() { B_firstFree_124 = 0; B_maxIndex_188 = 0; } function main188() { initGlobals206(); init_test145(); } function config121() { } function init_test145() { local integer a129 test_x_248 = 2; a_129 = new_X847(); dispatch_B_destroyB143(a_129); if (test_x_248 == 6) { testSuccess203(); } else { }; } IS_NATIVE function testSuccess203() { } function A_init170(integer this197) { } function construct_A164(integer this300) { construct_B293(this_300); A_init170(this_300); } function A_onDestroy118(integer this185) { B_onDestroy239(this_185); } function B_init182(integer this117) { } function construct_B293(integer this554) { B_init182(this_554); } function B_onDestroy239(integer this111) { test_x_248 = (test_x_248 * 2); } function destroyB187(integer this897) { B_onDestroy239(this_897); dealloc_B477(this_897); } function destroyX255(integer this661) { X_onDestroy880(this_661); dealloc_X137(this_661); } function X_init176(integer this830) { } function new_X847() returns integer { local integer this209 this_209 = alloc_X328(); construct_X242(this_209); return this_209; } function construct_X242(integer this137) { construct_A164(this_137); X_init176(this_137); } function X_onDestroy880(integer this195) { test_x_248 = (test_x_248 + 1); A_onDestroy118(this_195); } function error821(string msg149) { $debugPrint173((msg_149 + (" " + #getStackTrace()))); } function dealloc_B477(integer obj197) { if (B_typeId_188[obj_197] == 0) { error821("Double free: object of type B"); } else { B_nextFree_902[B_firstFree_124] = obj_197; B_firstFree_124 = (B_firstFree_124 + 1); B_typeId_188[obj_197] = 0; }; } function alloc_X328() returns integer { local integer this180 if (B_firstFree_124 == 0) { if (B_maxIndex_188 < 32768) { B_maxIndex_188 = (B_maxIndex_188 + 1); this_180 = B_maxIndex_188; B_typeId_188[this_180] = 3; } else { error821("Out of memory: Could not create X."); this_180 = 0; }; } else { B_firstFree_124 = (B_firstFree_124 - 1); this_180 = B_nextFree_902[B_firstFree_124]; B_typeId_188[this_180] = 3; }; return this_180; } function dealloc_X137(integer obj139) { if (B_typeId_188[obj_139] == 0) { error821("Double free: object of type X"); } else { B_nextFree_902[B_firstFree_124] = obj_139; B_firstFree_124 = (B_firstFree_124 + 1); B_typeId_188[obj_139] = 0; }; } function dispatch_B_destroyB143(integer this207) { if (B_typeId_188[this_207] == 0) { if (this_207 == 0) { error821("Nullpointer exception when calling B.B"); } else { error821("Called B.B on invalid object."); }; } else { }; if (B_typeId_188[this_207] <= 2) { destroyB187(this_207); } else { destroyX255(this_207); }; }