integer test_x861 array B_nextFree521 integer B_firstFree133 integer B_maxIndex172 array B_typeId125 integer test_x861 = 2 integer B_firstFree133 = 0 integer B_maxIndex172 = 0 function initGlobals400() { B_firstFree_133 = 0; B_maxIndex_172 = 0; } function main184() { initGlobals400(); init_test164(); } function config153() { } function init_test164() { local integer a404 test_x_861 = 2; a_404 = new_A683(); dispatch_A_destroyA117(a_404); if (test_x_861 == 6) { testSuccess569(); } else { }; } IS_NATIVE function testSuccess569() { } function destroyA151(integer this190) { A_onDestroy105(this_190); dealloc_A111(this_190); } function A_init106(integer this117) { } function new_A683() returns integer { local integer this135 this_135 = alloc_A117(); construct_A170(this_135); return this_135; } function construct_A170(integer this366) { construct_B162(this_366); A_init106(this_366); } function A_onDestroy105(integer this167) { test_x_861 = (test_x_861 + 1); B_onDestroy439(this_167); } function B_init181(integer this720) { } function construct_B162(integer this615) { B_init181(this_615); } function B_onDestroy439(integer this142) { test_x_861 = (test_x_861 * 2); } function alloc_A117() returns integer { local integer this739 if (B_firstFree_133 == 0) { if (B_maxIndex_172 < 32768) { B_maxIndex_172 = (B_maxIndex_172 + 1); this_739 = B_maxIndex_172; B_typeId_125[this_739] = 2; } else { error678("Out of memory: Could not create A."); this_739 = 0; }; } else { B_firstFree_133 = (B_firstFree_133 - 1); this_739 = B_nextFree_521[B_firstFree_133]; B_typeId_125[this_739] = 2; }; return this_739; } function error678(string msg921) { $debugPrint362((msg_921 + (" " + #getStackTrace()))); } function dealloc_A111(integer obj212) { if (B_typeId_125[obj_212] == 0) { error678("Double free: object of type A"); } else { B_nextFree_521[B_firstFree_133] = obj_212; B_firstFree_133 = (B_firstFree_133 + 1); B_typeId_125[obj_212] = 0; }; } function dispatch_A_destroyA117(integer this320) { if (B_typeId_125[this_320] == 0) { if (this_320 == 0) { error678("Nullpointer exception when calling A.A"); } else { error678("Called A.A on invalid object."); }; } else { }; destroyA151(this_320); }