integer test_x426 array B_nextFree806 integer B_firstFree971 integer B_maxIndex183 array B_typeId832 integer test_x426 = 2 integer B_firstFree971 = 0 integer B_maxIndex183 = 0 function initGlobals191() { } function main116() { initGlobals191(); init_test103(); } function config449() { } function init_test103() { test_x_426 = 2; dispatch_B_destroyB126(new_X117()); if (test_x_426 == 6) { testSuccess421(); } else { }; } IS_NATIVE function testSuccess421() { } function A_init131(integer this206) { } function construct_A117(integer this740) { construct_B131(this_740); A_init131(this_740); } function A_onDestroy108(integer this176) { B_onDestroy199(this_176); } function B_init207(integer this425) { } function construct_B131(integer this138) { B_init207(this_138); } function B_onDestroy199(integer this701) { test_x_426 = (test_x_426 * 2); } function destroyB873(integer this206) { B_onDestroy199(this_206); dealloc_B182(this_206); } function destroyX131(integer this902) { X_onDestroy212(this_902); dealloc_X792(this_902); } function X_init150(integer this906) { } function new_X117() returns integer { local integer this172 this_172 = alloc_X127(); construct_X166(this_172); return this_172; } function construct_X166(integer this156) { construct_A117(this_156); X_init150(this_156); } function X_onDestroy212(integer this181) { test_x_426 = (test_x_426 + 1); A_onDestroy108(this_181); } function error162(string msg131) { $debugPrint147((msg_131 + (" " + #getStackTrace()))); } function dealloc_B182(integer obj112) { if (B_typeId_832[obj_112] == 0) { error162("Double free: object of type B"); } else { B_nextFree_806[B_firstFree_971] = obj_112; B_firstFree_971 = (B_firstFree_971 + 1); B_typeId_832[obj_112] = 0; }; } function alloc_X127() returns integer { local integer this119 if (B_firstFree_971 == 0) { if (B_maxIndex_183 < 32768) { B_maxIndex_183 = (B_maxIndex_183 + 1); this_119 = B_maxIndex_183; B_typeId_832[this_119] = 3; } else { error162("Out of memory: Could not create X."); this_119 = 0; }; } else { B_firstFree_971 = (B_firstFree_971 - 1); this_119 = B_nextFree_806[B_firstFree_971]; B_typeId_832[this_119] = 3; }; return this_119; } function dealloc_X792(integer obj169) { if (B_typeId_832[obj_169] == 0) { error162("Double free: object of type X"); } else { B_nextFree_806[B_firstFree_971] = obj_169; B_firstFree_971 = (B_firstFree_971 + 1); B_typeId_832[obj_169] = 0; }; } function dispatch_B_destroyB126(integer this202) { if (B_typeId_832[this_202] == 0) { if (this_202 == 0) { error162("Nullpointer exception when calling B.B"); } else { error162("Called B.B on invalid object."); }; } else { }; if (B_typeId_832[this_202] <= 2) { destroyB873(this_202); } else { destroyX131(this_202); }; }