string test_s308 array T_nextFree111 integer T_firstFree181 integer T_maxIndex184 array T_typeId107 string test_s308 = "" integer T_firstFree181 = 0 integer T_maxIndex184 = 0 function initGlobals213() { } function main171() { initGlobals213(); init_test155(); } function config240() { } function init_test155() { test_s_308 = ""; dispatch_T_destroyT958(new_A138()); if (test_s_308 == "C") { testSuccess156(); } else { }; } IS_NATIVE function testSuccess156() { } function destroyA204(integer this198) { A_onDestroy183(this_198); dealloc_A207(this_198); } function A_init342(integer this168) { } function new_A138() returns integer { local integer this109 this_109 = alloc_A493(); construct_A411(this_109); return this_109; } function construct_A411(integer this879) { construct_C487(this_879); A_init342(this_879); } function A_onDestroy183(integer this185) { C_onDestroy205(this_185); } function destroyB201(integer this875) { B_onDestroy230(this_875); dealloc_B104(this_875); } function B_onDestroy230(integer this205) { test_s_308 = (test_s_308 + "B"); C_onDestroy205(this_205); } function C_init160(integer this986) { } function construct_C487(integer this600) { C_init160(this_600); } function C_onDestroy205(integer this234) { test_s_308 = (test_s_308 + "C"); } function destroyT108(integer this132) { dealloc_T192(this_132); } function alloc_A493() returns integer { local integer this748 if (T_firstFree_181 == 0) { if (T_maxIndex_184 < 32768) { T_maxIndex_184 = (T_maxIndex_184 + 1); this_748 = T_maxIndex_184; T_typeId_107[this_748] = 2; } else { error185("Out of memory: Could not create A."); this_748 = 0; }; } else { T_firstFree_181 = (T_firstFree_181 - 1); this_748 = T_nextFree_111[T_firstFree_181]; T_typeId_107[this_748] = 2; }; return this_748; } function error185(string msg209) { $debugPrint198((msg_209 + (" " + #getStackTrace()))); } function dealloc_A207(integer obj208) { if (T_typeId_107[obj_208] == 0) { error185("Double free: object of type A"); } else { T_nextFree_111[T_firstFree_181] = obj_208; T_firstFree_181 = (T_firstFree_181 + 1); T_typeId_107[obj_208] = 0; }; } function dealloc_B104(integer obj503) { if (T_typeId_107[obj_503] == 0) { error185("Double free: object of type B"); } else { T_nextFree_111[T_firstFree_181] = obj_503; T_firstFree_181 = (T_firstFree_181 + 1); T_typeId_107[obj_503] = 0; }; } function dealloc_T192(integer obj123) { if (T_typeId_107[obj_123] == 0) { error185("Double free: object of type T"); } else { T_nextFree_111[T_firstFree_181] = obj_123; T_firstFree_181 = (T_firstFree_181 + 1); T_typeId_107[obj_123] = 0; }; } function dispatch_T_destroyT958(integer this110) { if (T_typeId_107[this_110] == 0) { if (this_110 == 0) { error185("Nullpointer exception when calling T.T"); } else { error185("Called T.T on invalid object."); }; } else { }; if (T_typeId_107[this_110] <= 3) { if (T_typeId_107[this_110] <= 2) { destroyA204(this_110); } else { destroyB201(this_110); }; } else { destroyT108(this_110); }; }