integer test_x166 array B_nextFree752 integer B_firstFree135 integer B_maxIndex304 array B_typeId167 integer test_x166 = 2 integer B_firstFree135 = 0 integer B_maxIndex304 = 0 function initGlobals174() { } function main197() { initGlobals174(); init_test207(); } function config151() { } function init_test207() { test_x_166 = 2; dispatch_B_destroyB136(new_X966()); if (test_x_166 == 6) { testSuccess311(); } else { }; } IS_NATIVE function testSuccess311() { } function destroyA277(integer this182) { A_onDestroy199(this_182); dealloc_A313(this_182); } function A_init127(integer this208) { } function construct_A151(integer this180) { construct_B112(this_180); A_init127(this_180); } function A_onDestroy199(integer this151) { test_x_166 = (test_x_166 + 1); B_onDestroy921(this_151); } function B_init109(integer this126) { } function construct_B112(integer this132) { B_init109(this_132); } function B_onDestroy921(integer this208) { test_x_166 = (test_x_166 * 2); } function destroyB200(integer this176) { B_onDestroy921(this_176); dealloc_B297(this_176); } function destroyX150(integer this287) { X_onDestroy890(this_287); dealloc_X186(this_287); } function X_init175(integer this193) { } function new_X966() returns integer { local integer this190 this_190 = alloc_X185(); construct_X158(this_190); return this_190; } function construct_X158(integer this178) { construct_A151(this_178); X_init175(this_178); } function X_onDestroy890(integer this512) { A_onDestroy199(this_512); } function error144(string msg471) { $debugPrint124((msg_471 + (" " + #getStackTrace()))); } function dealloc_A313(integer obj161) { if (B_typeId_167[obj_161] == 0) { error144("Double free: object of type A"); } else { B_nextFree_752[B_firstFree_135] = obj_161; B_firstFree_135 = (B_firstFree_135 + 1); B_typeId_167[obj_161] = 0; }; } function dealloc_B297(integer obj168) { if (B_typeId_167[obj_168] == 0) { error144("Double free: object of type B"); } else { B_nextFree_752[B_firstFree_135] = obj_168; B_firstFree_135 = (B_firstFree_135 + 1); B_typeId_167[obj_168] = 0; }; } function alloc_X185() returns integer { local integer this254 if (B_firstFree_135 == 0) { if (B_maxIndex_304 < 32768) { B_maxIndex_304 = (B_maxIndex_304 + 1); this_254 = B_maxIndex_304; B_typeId_167[this_254] = 3; } else { error144("Out of memory: Could not create X."); this_254 = 0; }; } else { B_firstFree_135 = (B_firstFree_135 - 1); this_254 = B_nextFree_752[B_firstFree_135]; B_typeId_167[this_254] = 3; }; return this_254; } function dealloc_X186(integer obj821) { if (B_typeId_167[obj_821] == 0) { error144("Double free: object of type X"); } else { B_nextFree_752[B_firstFree_135] = obj_821; B_firstFree_135 = (B_firstFree_135 + 1); B_typeId_167[obj_821] = 0; }; } function dispatch_B_destroyB136(integer this426) { if (B_typeId_167[this_426] == 0) { if (this_426 == 0) { error144("Nullpointer exception when calling B.B"); } else { error144("Called B.B on invalid object."); }; } else { }; if (B_typeId_167[this_426] <= 2) { if (B_typeId_167[this_426] <= 1) { destroyB200(this_426); } else { destroyA277(this_426); }; } else { destroyX150(this_426); }; }