integer test_x184 array B_nextFree146 integer B_firstFree124 integer B_maxIndex783 array B_typeId325 integer test_x184 = 2 integer B_firstFree124 = 0 integer B_maxIndex783 = 0 function initGlobals196() { B_firstFree_124 = 0; B_maxIndex_783 = 0; } function main143() { initGlobals196(); init_test132(); } function config166() { } function init_test132() { local integer a142 test_x_184 = 2; a_142 = new_A428(); dispatch_B_destroyB151(a_142); if (test_x_184 == 6) { testSuccess145(); } else { }; } IS_NATIVE function testSuccess145() { } function destroyA114(integer this131) { A_onDestroy203(this_131); dealloc_A133(this_131); } function A_init143(integer this216) { } function new_A428() returns integer { local integer this753 this_753 = alloc_A200(); construct_A901(this_753); return this_753; } function construct_A901(integer this700) { construct_B170(this_700); A_init143(this_700); } function A_onDestroy203(integer this172) { test_x_184 = (test_x_184 + 1); B_onDestroy518(this_172); } function B_init185(integer this803) { } function construct_B170(integer this867) { B_init185(this_867); } function B_onDestroy518(integer this125) { test_x_184 = (test_x_184 * 2); } function destroyB261(integer this196) { B_onDestroy518(this_196); dealloc_B611(this_196); } function alloc_A200() returns integer { local integer this123 if (B_firstFree_124 == 0) { if (B_maxIndex_783 < 32768) { B_maxIndex_783 = (B_maxIndex_783 + 1); this_123 = B_maxIndex_783; B_typeId_325[this_123] = 2; } else { error102("Out of memory: Could not create A."); this_123 = 0; }; } else { B_firstFree_124 = (B_firstFree_124 - 1); this_123 = B_nextFree_146[B_firstFree_124]; B_typeId_325[this_123] = 2; }; return this_123; } function error102(string msg714) { $debugPrint138((msg_714 + (" " + #getStackTrace()))); } function dealloc_A133(integer obj652) { if (B_typeId_325[obj_652] == 0) { error102("Double free: object of type A"); } else { B_nextFree_146[B_firstFree_124] = obj_652; B_firstFree_124 = (B_firstFree_124 + 1); B_typeId_325[obj_652] = 0; }; } function dealloc_B611(integer obj995) { if (B_typeId_325[obj_995] == 0) { error102("Double free: object of type B"); } else { B_nextFree_146[B_firstFree_124] = obj_995; B_firstFree_124 = (B_firstFree_124 + 1); B_typeId_325[obj_995] = 0; }; } function dispatch_B_destroyB151(integer this263) { if (B_typeId_325[this_263] == 0) { if (this_263 == 0) { error102("Nullpointer exception when calling B.B"); } else { error102("Called B.B on invalid object."); }; } else { }; if (B_typeId_325[this_263] <= 1) { destroyB261(this_263); } else { destroyA114(this_263); }; }