string test_s504 array T_nextFree145 integer T_firstFree180 integer T_maxIndex585 array T_typeId137 string test_s504 = "" integer T_firstFree180 = 0 integer T_maxIndex585 = 0 function initGlobals120() { } function main378() { initGlobals120(); init_test140(); } function config166() { } function init_test140() { test_s_504 = ""; dispatch_T_destroyT160(new_A127()); if (test_s_504 == "C") { testSuccess112(); } else { }; } IS_NATIVE function testSuccess112() { } function destroyA110(integer this181) { A_onDestroy110(this_181); dealloc_A810(this_181); } function A_init135(integer this109) { } function new_A127() returns integer { local integer this591 this_591 = alloc_A339(); construct_A171(this_591); return this_591; } function construct_A171(integer this110) { construct_C750(this_110); A_init135(this_110); } function A_onDestroy110(integer this207) { C_onDestroy148(this_207); } function destroyB152(integer this180) { B_onDestroy791(this_180); dealloc_B141(this_180); } function B_onDestroy791(integer this322) { test_s_504 = (test_s_504 + "B"); C_onDestroy148(this_322); } function C_init214(integer this186) { } function construct_C750(integer this170) { C_init214(this_170); } function C_onDestroy148(integer this221) { test_s_504 = (test_s_504 + "C"); } function destroyT227(integer this179) { dealloc_T678(this_179); } function alloc_A339() returns integer { local integer this159 if (T_firstFree_180 == 0) { if (T_maxIndex_585 < 32768) { T_maxIndex_585 = (T_maxIndex_585 + 1); this_159 = T_maxIndex_585; T_typeId_137[this_159] = 2; } else { error115("Out of memory: Could not create A."); this_159 = 0; }; } else { T_firstFree_180 = (T_firstFree_180 - 1); this_159 = T_nextFree_145[T_firstFree_180]; T_typeId_137[this_159] = 2; }; return this_159; } function error115(string msg131) { $debugPrint122((msg_131 + (" " + #getStackTrace()))); } function dealloc_A810(integer obj195) { if (T_typeId_137[obj_195] == 0) { error115("Double free: object of type A"); } else { T_nextFree_145[T_firstFree_180] = obj_195; T_firstFree_180 = (T_firstFree_180 + 1); T_typeId_137[obj_195] = 0; }; } function dealloc_B141(integer obj411) { if (T_typeId_137[obj_411] == 0) { error115("Double free: object of type B"); } else { T_nextFree_145[T_firstFree_180] = obj_411; T_firstFree_180 = (T_firstFree_180 + 1); T_typeId_137[obj_411] = 0; }; } function dealloc_T678(integer obj341) { if (T_typeId_137[obj_341] == 0) { error115("Double free: object of type T"); } else { T_nextFree_145[T_firstFree_180] = obj_341; T_firstFree_180 = (T_firstFree_180 + 1); T_typeId_137[obj_341] = 0; }; } function dispatch_T_destroyT160(integer this359) { if (T_typeId_137[this_359] == 0) { if (this_359 == 0) { error115("Nullpointer exception when calling T.T"); } else { error115("Called T.T on invalid object."); }; } else { }; if (T_typeId_137[this_359] <= 3) { if (T_typeId_137[this_359] <= 2) { destroyA110(this_359); } else { destroyB152(this_359); }; } else { destroyT227(this_359); }; }