integer test_x983 array B_nextFree150 integer B_firstFree203 integer B_maxIndex185 array B_typeId175 array B_y197 integer test_x983 = 2 integer B_firstFree203 = 0 integer B_maxIndex185 = 0 function initGlobals933() { B_firstFree_203 = 0; B_maxIndex_185 = 0; } function main277() { initGlobals933(); init_test157(); } function config105() { } function init_test157() { local integer a209 test_x_983 = 2; a_209 = new_A538(); dispatch_A_destroyA164(a_209); if (test_x_983 == 8) { testSuccess630(); } else { }; } IS_NATIVE function testSuccess630() { } function destroyA139(integer this197) { A_onDestroy333(this_197); dealloc_A208(this_197); } function A_init791(integer this197) { } function new_A538() returns integer { local integer this271 this_271 = alloc_A430(); construct_A384(this_271); return this_271; } function construct_A384(integer this813) { construct_B110(this_813); A_init791(this_813); } function A_onDestroy333(integer this141) { test_x_983 = (test_x_983 + B_y_197[this_141]); B_onDestroy160(this_141); } function B_init135(integer this908) { B_y_197[this_908] = 2; } function construct_B110(integer this966) { B_init135(this_966); } function B_onDestroy160(integer this119) { test_x_983 = (test_x_983 * B_y_197[this_119]); } function alloc_A430() returns integer { local integer this434 if (B_firstFree_203 == 0) { if (B_maxIndex_185 < 32768) { B_maxIndex_185 = (B_maxIndex_185 + 1); this_434 = B_maxIndex_185; B_typeId_175[this_434] = 2; } else { error115("Out of memory: Could not create A."); this_434 = 0; }; } else { B_firstFree_203 = (B_firstFree_203 - 1); this_434 = B_nextFree_150[B_firstFree_203]; B_typeId_175[this_434] = 2; }; return this_434; } function error115(string msg207) { $debugPrint127((msg_207 + (" " + #getStackTrace()))); } function dealloc_A208(integer obj105) { if (B_typeId_175[obj_105] == 0) { error115("Double free: object of type A"); } else { B_nextFree_150[B_firstFree_203] = obj_105; B_firstFree_203 = (B_firstFree_203 + 1); B_typeId_175[obj_105] = 0; }; } function dispatch_A_destroyA164(integer this105) { if (B_typeId_175[this_105] == 0) { if (this_105 == 0) { error115("Nullpointer exception when calling A.A"); } else { error115("Called A.A on invalid object."); }; } else { }; destroyA139(this_105); }