integer test_x752 array B_nextFree734 integer B_firstFree135 integer B_maxIndex179 array B_typeId835 integer test_x752 = 2 integer B_firstFree135 = 0 integer B_maxIndex179 = 0 function initGlobals204() { B_firstFree_135 = 0; B_maxIndex_179 = 0; } function main409() { initGlobals204(); init_test172(); } function config406() { } function init_test172() { local integer a194 test_x_752 = 2; a_194 = new_X168(); dispatch_B_destroyB439(a_194); if (test_x_752 == 6) { testSuccess853(); } else { }; } IS_NATIVE function testSuccess853() { } function destroyA367(integer this194) { A_onDestroy481(this_194); dealloc_A726(this_194); } function A_init112(integer this911) { } function construct_A203(integer this118) { construct_B408(this_118); A_init112(this_118); } function A_onDestroy481(integer this142) { test_x_752 = (test_x_752 + 1); B_onDestroy104(this_142); } function B_init123(integer this315) { } function construct_B408(integer this838) { B_init123(this_838); } function B_onDestroy104(integer this195) { test_x_752 = (test_x_752 * 2); } function destroyB654(integer this426) { B_onDestroy104(this_426); dealloc_B145(this_426); } function destroyX831(integer this808) { X_onDestroy696(this_808); dealloc_X200(this_808); } function X_init321(integer this195) { } function new_X168() returns integer { local integer this148 this_148 = alloc_X160(); construct_X113(this_148); return this_148; } function construct_X113(integer this171) { construct_A203(this_171); X_init321(this_171); } function X_onDestroy696(integer this209) { A_onDestroy481(this_209); } function error588(string msg429) { $debugPrint184((msg_429 + (" " + #getStackTrace()))); } function dealloc_A726(integer obj174) { if (B_typeId_835[obj_174] == 0) { error588("Double free: object of type A"); } else { B_nextFree_734[B_firstFree_135] = obj_174; B_firstFree_135 = (B_firstFree_135 + 1); B_typeId_835[obj_174] = 0; }; } function dealloc_B145(integer obj847) { if (B_typeId_835[obj_847] == 0) { error588("Double free: object of type B"); } else { B_nextFree_734[B_firstFree_135] = obj_847; B_firstFree_135 = (B_firstFree_135 + 1); B_typeId_835[obj_847] = 0; }; } function alloc_X160() returns integer { local integer this188 if (B_firstFree_135 == 0) { if (B_maxIndex_179 < 32768) { B_maxIndex_179 = (B_maxIndex_179 + 1); this_188 = B_maxIndex_179; B_typeId_835[this_188] = 3; } else { error588("Out of memory: Could not create X."); this_188 = 0; }; } else { B_firstFree_135 = (B_firstFree_135 - 1); this_188 = B_nextFree_734[B_firstFree_135]; B_typeId_835[this_188] = 3; }; return this_188; } function dealloc_X200(integer obj174) { if (B_typeId_835[obj_174] == 0) { error588("Double free: object of type X"); } else { B_nextFree_734[B_firstFree_135] = obj_174; B_firstFree_135 = (B_firstFree_135 + 1); B_typeId_835[obj_174] = 0; }; } function dispatch_B_destroyB439(integer this349) { if (B_typeId_835[this_349] == 0) { if (this_349 == 0) { error588("Nullpointer exception when calling B.B"); } else { error588("Called B.B on invalid object."); }; } else { }; if (B_typeId_835[this_349] <= 2) { if (B_typeId_835[this_349] <= 1) { destroyB654(this_349); } else { destroyA367(this_349); }; } else { destroyX831(this_349); }; }