integer test_x127 array I_nextFree196 integer I_firstFree186 integer I_maxIndex180 array I_typeId137 integer test_x127 = 0 integer I_firstFree186 = 0 integer I_maxIndex180 = 0 function initGlobals118() { } function main977() { initGlobals118(); init_test783(); } function config187() { } function init_test783() { dispatch_I_destroyI641(new_C170()); if (test_x_127 == 2) { testSuccess168(); } else { }; } IS_NATIVE function testSuccess168() { } function destroyB140(integer this178) { B_onDestroy128(this_178); dealloc_B580(this_178); } function B_onDestroy128(integer this695) { test_x_127 = 1; } function destroyC135(integer this121) { C_onDestroy888(this_121); dealloc_C144(this_121); } function C_init140(integer this212) { } function new_C170() returns integer { local integer this724 this_724 = alloc_C446(); construct_C201(this_724); return this_724; } function construct_C201(integer this119) { C_init140(this_119); } function C_onDestroy888(integer this942) { test_x_127 = 2; } function destroyI210(integer this116) { dealloc_I589(this_116); } function error961(string msg148) { $debugPrint192((msg_148 + (" " + #getStackTrace()))); } function dealloc_B580(integer obj106) { if (I_typeId_137[obj_106] == 0) { error961("Double free: object of type B"); } else { I_nextFree_196[I_firstFree_186] = obj_106; I_firstFree_186 = (I_firstFree_186 + 1); I_typeId_137[obj_106] = 0; }; } function alloc_C446() returns integer { local integer this155 if (I_firstFree_186 == 0) { if (I_maxIndex_180 < 32768) { I_maxIndex_180 = (I_maxIndex_180 + 1); this_155 = I_maxIndex_180; I_typeId_137[this_155] = 3; } else { error961("Out of memory: Could not create C."); this_155 = 0; }; } else { I_firstFree_186 = (I_firstFree_186 - 1); this_155 = I_nextFree_196[I_firstFree_186]; I_typeId_137[this_155] = 3; }; return this_155; } function dealloc_C144(integer obj173) { if (I_typeId_137[obj_173] == 0) { error961("Double free: object of type C"); } else { I_nextFree_196[I_firstFree_186] = obj_173; I_firstFree_186 = (I_firstFree_186 + 1); I_typeId_137[obj_173] = 0; }; } function dealloc_I589(integer obj148) { if (I_typeId_137[obj_148] == 0) { error961("Double free: object of type I"); } else { I_nextFree_196[I_firstFree_186] = obj_148; I_firstFree_186 = (I_firstFree_186 + 1); I_typeId_137[obj_148] = 0; }; } function dispatch_I_destroyI641(integer this191) { if (I_typeId_137[this_191] == 0) { if (this_191 == 0) { error961("Nullpointer exception when calling I.I"); } else { error961("Called I.I on invalid object."); }; } else { }; if (I_typeId_137[this_191] <= 2) { if (I_typeId_137[this_191] <= 1) { destroyI210(this_191); } else { destroyB140(this_191); }; } else { destroyC135(this_191); }; }