integer test_x214 array B_nextFree163 integer B_firstFree169 integer B_maxIndex184 array B_typeId861 integer test_x214 = 2 integer B_firstFree169 = 0 integer B_maxIndex184 = 0 function initGlobals112() { B_firstFree_169 = 0; B_maxIndex_184 = 0; } function main206() { initGlobals112(); init_test857(); } function config171() { } function init_test857() { local integer a101 test_x_214 = 2; a_101 = new_X147(); dispatch_X_destroyX160(a_101); if (test_x_214 == 6) { testSuccess129(); } else { }; } IS_NATIVE function testSuccess129() { } function A_init797(integer this170) { } function construct_A168(integer this514) { construct_B129(this_514); A_init797(this_514); } function A_onDestroy161(integer this160) { test_x_214 = (test_x_214 + 1); B_onDestroy104(this_160); } function B_init101(integer this140) { } function construct_B129(integer this273) { B_init101(this_273); } function B_onDestroy104(integer this567) { test_x_214 = (test_x_214 * 2); } function destroyX102(integer this345) { X_onDestroy189(this_345); dealloc_X156(this_345); } function X_init210(integer this164) { } function new_X147() returns integer { local integer this188 this_188 = alloc_X828(); construct_X602(this_188); return this_188; } function construct_X602(integer this167) { construct_A168(this_167); X_init210(this_167); } function X_onDestroy189(integer this780) { A_onDestroy161(this_780); } function error142(string msg298) { $debugPrint833((msg_298 + (" " + #getStackTrace()))); } function alloc_X828() returns integer { local integer this165 if (B_firstFree_169 == 0) { if (B_maxIndex_184 < 32768) { B_maxIndex_184 = (B_maxIndex_184 + 1); this_165 = B_maxIndex_184; B_typeId_861[this_165] = 3; } else { error142("Out of memory: Could not create X."); this_165 = 0; }; } else { B_firstFree_169 = (B_firstFree_169 - 1); this_165 = B_nextFree_163[B_firstFree_169]; B_typeId_861[this_165] = 3; }; return this_165; } function dealloc_X156(integer obj643) { if (B_typeId_861[obj_643] == 0) { error142("Double free: object of type X"); } else { B_nextFree_163[B_firstFree_169] = obj_643; B_firstFree_169 = (B_firstFree_169 + 1); B_typeId_861[obj_643] = 0; }; } function dispatch_X_destroyX160(integer this891) { if (B_typeId_861[this_891] == 0) { if (this_891 == 0) { error142("Nullpointer exception when calling X.X"); } else { error142("Called X.X on invalid object."); }; } else { }; destroyX102(this_891); }