integer test_x161 array B_nextFree681 integer B_firstFree168 integer B_maxIndex552 array B_typeId456 integer test_x161 = 2 integer B_firstFree168 = 0 integer B_maxIndex552 = 0 function initGlobals125() { } function main201() { initGlobals125(); init_test136(); } function config148() { } function init_test136() { test_x_161 = 2; dispatch_B_destroyB898(new_X213()); if (test_x_161 == 6) { testSuccess202(); } else { }; } IS_NATIVE function testSuccess202() { } function A_init200(integer this202) { } function construct_A780(integer this208) { construct_B101(this_208); A_init200(this_208); } function A_onDestroy151(integer this157) { B_onDestroy118(this_157); } function B_init363(integer this179) { } function construct_B101(integer this187) { B_init363(this_187); } function B_onDestroy118(integer this141) { test_x_161 = (test_x_161 * 2); } function destroyB190(integer this117) { B_onDestroy118(this_117); dealloc_B607(this_117); } function destroyX107(integer this101) { X_onDestroy166(this_101); dealloc_X174(this_101); } function X_init149(integer this138) { } function new_X213() returns integer { local integer this203 this_203 = alloc_X118(); construct_X134(this_203); return this_203; } function construct_X134(integer this882) { construct_A780(this_882); X_init149(this_882); } function X_onDestroy166(integer this334) { test_x_161 = (test_x_161 + 1); A_onDestroy151(this_334); } function error112(string msg131) { $debugPrint133((msg_131 + (" " + #getStackTrace()))); } function dealloc_B607(integer obj521) { if (B_typeId_456[obj_521] == 0) { error112("Double free: object of type B"); } else { B_nextFree_681[B_firstFree_168] = obj_521; B_firstFree_168 = (B_firstFree_168 + 1); B_typeId_456[obj_521] = 0; }; } function alloc_X118() returns integer { local integer this366 if (B_firstFree_168 == 0) { if (B_maxIndex_552 < 32768) { B_maxIndex_552 = (B_maxIndex_552 + 1); this_366 = B_maxIndex_552; B_typeId_456[this_366] = 3; } else { error112("Out of memory: Could not create X."); this_366 = 0; }; } else { B_firstFree_168 = (B_firstFree_168 - 1); this_366 = B_nextFree_681[B_firstFree_168]; B_typeId_456[this_366] = 3; }; return this_366; } function dealloc_X174(integer obj187) { if (B_typeId_456[obj_187] == 0) { error112("Double free: object of type X"); } else { B_nextFree_681[B_firstFree_168] = obj_187; B_firstFree_168 = (B_firstFree_168 + 1); B_typeId_456[obj_187] = 0; }; } function dispatch_B_destroyB898(integer this198) { if (B_typeId_456[this_198] == 0) { if (this_198 == 0) { error112("Nullpointer exception when calling B.B"); } else { error112("Called B.B on invalid object."); }; } else { }; if (B_typeId_456[this_198] <= 2) { destroyB190(this_198); } else { destroyX107(this_198); }; }