integer test_x474 array B_nextFree164 integer B_firstFree392 integer B_maxIndex124 array B_typeId209 integer test_x474 = 2 integer B_firstFree392 = 0 integer B_maxIndex124 = 0 function initGlobals673() { B_firstFree_392 = 0; B_maxIndex_124 = 0; } function main979() { initGlobals673(); init_test111(); } function config194() { } function init_test111() { local integer a519 test_x_474 = 2; a_519 = new_X136(); dispatch_X_destroyX115(a_519); if (test_x_474 == 6) { testSuccess150(); } else { }; } IS_NATIVE function testSuccess150() { } function A_init211(integer this115) { } function construct_A104(integer this129) { construct_B164(this_129); A_init211(this_129); } function A_onDestroy345(integer this631) { local integer z141 z_141 = 1; test_x_474 = (test_x_474 + z_141); B_onDestroy147(this_631); } function B_init145(integer this128) { } function construct_B164(integer this866) { B_init145(this_866); } function B_onDestroy147(integer this775) { local integer y188 y_188 = 2; test_x_474 = (test_x_474 * y_188); } function destroyX204(integer this198) { X_onDestroy939(this_198); dealloc_X108(this_198); } function X_init117(integer this153) { } function new_X136() returns integer { local integer this141 this_141 = alloc_X195(); construct_X171(this_141); return this_141; } function construct_X171(integer this145) { construct_A104(this_145); X_init117(this_145); } function X_onDestroy939(integer this189) { A_onDestroy345(this_189); } function error406(string msg155) { $debugPrint157((msg_155 + (" " + #getStackTrace()))); } function alloc_X195() returns integer { local integer this102 if (B_firstFree_392 == 0) { if (B_maxIndex_124 < 32768) { B_maxIndex_124 = (B_maxIndex_124 + 1); this_102 = B_maxIndex_124; B_typeId_209[this_102] = 3; } else { error406("Out of memory: Could not create X."); this_102 = 0; }; } else { B_firstFree_392 = (B_firstFree_392 - 1); this_102 = B_nextFree_164[B_firstFree_392]; B_typeId_209[this_102] = 3; }; return this_102; } function dealloc_X108(integer obj855) { if (B_typeId_209[obj_855] == 0) { error406("Double free: object of type X"); } else { B_nextFree_164[B_firstFree_392] = obj_855; B_firstFree_392 = (B_firstFree_392 + 1); B_typeId_209[obj_855] = 0; }; } function dispatch_X_destroyX115(integer this143) { if (B_typeId_209[this_143] == 0) { if (this_143 == 0) { error406("Nullpointer exception when calling X.X"); } else { error406("Called X.X on invalid object."); }; } else { }; destroyX204(this_143); }