integer test_x104 array B_nextFree133 integer B_firstFree107 integer B_maxIndex653 array B_typeId248 integer test_x104 = 2 integer B_firstFree107 = 0 integer B_maxIndex653 = 0 function initGlobals986() { B_firstFree_107 = 0; B_maxIndex_653 = 0; } function main829() { initGlobals986(); init_test486(); } function config164() { } function init_test486() { local integer a379 test_x_104 = 2; a_379 = new_A873(); dispatch_A_destroyA198(a_379); if (test_x_104 == 6) { testSuccess557(); } else { }; } IS_NATIVE function testSuccess557() { } function destroyA189(integer this125) { A_onDestroy364(this_125); dealloc_A156(this_125); } function A_init194(integer this168) { } function new_A873() returns integer { local integer this700 this_700 = alloc_A143(); construct_A493(this_700); return this_700; } function construct_A493(integer this547) { construct_B176(this_547); A_init194(this_547); } function A_onDestroy364(integer this148) { test_x_104 = (test_x_104 + 1); B_onDestroy403(this_148); } function B_init180(integer this210) { } function construct_B176(integer this344) { B_init180(this_344); } function B_onDestroy403(integer this200) { test_x_104 = (test_x_104 * 2); } function alloc_A143() returns integer { local integer this210 if (B_firstFree_107 == 0) { if (B_maxIndex_653 < 32768) { B_maxIndex_653 = (B_maxIndex_653 + 1); this_210 = B_maxIndex_653; B_typeId_248[this_210] = 2; } else { error116("Out of memory: Could not create A."); this_210 = 0; }; } else { B_firstFree_107 = (B_firstFree_107 - 1); this_210 = B_nextFree_133[B_firstFree_107]; B_typeId_248[this_210] = 2; }; return this_210; } function error116(string msg160) { $debugPrint151((msg_160 + (" " + #getStackTrace()))); } function dealloc_A156(integer obj129) { if (B_typeId_248[obj_129] == 0) { error116("Double free: object of type A"); } else { B_nextFree_133[B_firstFree_107] = obj_129; B_firstFree_107 = (B_firstFree_107 + 1); B_typeId_248[obj_129] = 0; }; } function dispatch_A_destroyA198(integer this191) { if (B_typeId_248[this_191] == 0) { if (this_191 == 0) { error116("Nullpointer exception when calling A.A"); } else { error116("Called A.A on invalid object."); }; } else { }; destroyA189(this_191); }