integer test_x804 array B_nextFree184 integer B_firstFree114 integer B_maxIndex166 array B_typeId187 integer test_x804 = 2 integer B_firstFree114 = 0 integer B_maxIndex166 = 0 function initGlobals492() { B_firstFree_114 = 0; B_maxIndex_166 = 0; } function main148() { initGlobals492(); init_test277(); } function config163() { } function init_test277() { local integer a114 test_x_804 = 2; a_114 = new_A173(); dispatch_A_destroyA183(a_114); if (test_x_804 == 6) { testSuccess171(); } else { }; } IS_NATIVE function testSuccess171() { } function destroyA150(integer this123) { A_onDestroy182(this_123); dealloc_A154(this_123); } function A_init231(integer this134) { } function new_A173() returns integer { local integer this451 this_451 = alloc_A139(); construct_A721(this_451); return this_451; } function construct_A721(integer this570) { construct_B117(this_570); A_init231(this_570); } function A_onDestroy182(integer this761) { test_x_804 = (test_x_804 + 1); B_onDestroy130(this_761); } function B_init159(integer this135) { } function construct_B117(integer this137) { B_init159(this_137); } function B_onDestroy130(integer this454) { test_x_804 = (test_x_804 * 2); } function alloc_A139() returns integer { local integer this123 if (B_firstFree_114 == 0) { if (B_maxIndex_166 < 32768) { B_maxIndex_166 = (B_maxIndex_166 + 1); this_123 = B_maxIndex_166; B_typeId_187[this_123] = 2; } else { error793("Out of memory: Could not create A."); this_123 = 0; }; } else { B_firstFree_114 = (B_firstFree_114 - 1); this_123 = B_nextFree_184[B_firstFree_114]; B_typeId_187[this_123] = 2; }; return this_123; } function error793(string msg153) { $debugPrint187((msg_153 + (" " + #getStackTrace()))); } function dealloc_A154(integer obj858) { if (B_typeId_187[obj_858] == 0) { error793("Double free: object of type A"); } else { B_nextFree_184[B_firstFree_114] = obj_858; B_firstFree_114 = (B_firstFree_114 + 1); B_typeId_187[obj_858] = 0; }; } function dispatch_A_destroyA183(integer this140) { if (B_typeId_187[this_140] == 0) { if (this_140 == 0) { error793("Nullpointer exception when calling A.A"); } else { error793("Called A.A on invalid object."); }; } else { }; destroyA150(this_140); }