integer test_x186 array B_nextFree162 integer B_firstFree172 integer B_maxIndex689 array B_typeId135 integer test_x186 = 2 integer B_firstFree172 = 0 integer B_maxIndex689 = 0 function initGlobals254() { B_firstFree_172 = 0; B_maxIndex_689 = 0; } function main161() { initGlobals254(); init_test192(); } function config616() { } function init_test192() { local integer a106 test_x_186 = 2; a_106 = new_X685(); dispatch_B_destroyB177(a_106); if (test_x_186 == 6) { testSuccess136(); } else { }; } IS_NATIVE function testSuccess136() { } function A_init854(integer this180) { } function construct_A521(integer this562) { construct_B178(this_562); A_init854(this_562); } function A_onDestroy412(integer this525) { B_onDestroy209(this_525); } function B_init154(integer this125) { } function construct_B178(integer this205) { B_init154(this_205); } function B_onDestroy209(integer this392) { test_x_186 = (test_x_186 * 2); } function destroyB957(integer this987) { B_onDestroy209(this_987); dealloc_B120(this_987); } function destroyX474(integer this880) { X_onDestroy111(this_880); dealloc_X705(this_880); } function X_init199(integer this687) { } function new_X685() returns integer { local integer this271 this_271 = alloc_X383(); construct_X130(this_271); return this_271; } function construct_X130(integer this916) { construct_A521(this_916); X_init199(this_916); } function X_onDestroy111(integer this881) { test_x_186 = (test_x_186 + 1); A_onDestroy412(this_881); } function error203(string msg698) { $debugPrint200((msg_698 + (" " + #getStackTrace()))); } function dealloc_B120(integer obj983) { if (B_typeId_135[obj_983] == 0) { error203("Double free: object of type B"); } else { B_nextFree_162[B_firstFree_172] = obj_983; B_firstFree_172 = (B_firstFree_172 + 1); B_typeId_135[obj_983] = 0; }; } function alloc_X383() returns integer { local integer this238 if (B_firstFree_172 == 0) { if (B_maxIndex_689 < 32768) { B_maxIndex_689 = (B_maxIndex_689 + 1); this_238 = B_maxIndex_689; B_typeId_135[this_238] = 3; } else { error203("Out of memory: Could not create X."); this_238 = 0; }; } else { B_firstFree_172 = (B_firstFree_172 - 1); this_238 = B_nextFree_162[B_firstFree_172]; B_typeId_135[this_238] = 3; }; return this_238; } function dealloc_X705(integer obj685) { if (B_typeId_135[obj_685] == 0) { error203("Double free: object of type X"); } else { B_nextFree_162[B_firstFree_172] = obj_685; B_firstFree_172 = (B_firstFree_172 + 1); B_typeId_135[obj_685] = 0; }; } function dispatch_B_destroyB177(integer this182) { if (B_typeId_135[this_182] == 0) { if (this_182 == 0) { error203("Nullpointer exception when calling B.B"); } else { error203("Called B.B on invalid object."); }; } else { }; if (B_typeId_135[this_182] <= 2) { destroyB957(this_182); } else { destroyX474(this_182); }; }