string test_s574 array C_nextFree535 integer C_firstFree126 integer C_maxIndex176 array C_typeId428 string test_s574 = "" integer C_firstFree126 = 0 integer C_maxIndex176 = 0 function initGlobals743() { } function main207() { initGlobals743(); init_test112(); } function config870() { } function init_test112() { test_s_574 = ""; dispatch_C_destroyC156(new_C212()); if (test_s_574 != "ABCcba") { testFail160(("fail, result = " + test_s_574)); } else { }; testSuccess117(); } IS_NATIVE function testFail160(string msg948) { } IS_NATIVE function testSuccess117() { } function C_init216(integer this187) { construct_C_B202(this_187); } function construct_C_B202(integer this142) { construct_C_B_A108(this_142); test_s_574 = (test_s_574 + "B"); } function construct_C_B_A108(integer this832) { test_s_574 = (test_s_574 + "A"); } function new_C212() returns integer { local integer this231 this_231 = alloc_C485(); construct_C120(this_231); return this_231; } function construct_C120(integer this181) { C_init216(this_181); test_s_574 = (test_s_574 + "C"); } function C_onDestroy806(integer this137) { test_s_574 = (((test_s_574 + "c") + "b") + "a"); } function destroyC209(integer this987) { C_onDestroy806(this_987); dealloc_C141(this_987); } function alloc_C485() returns integer { local integer this123 if (C_firstFree_126 == 0) { if (C_maxIndex_176 < 32768) { C_maxIndex_176 = (C_maxIndex_176 + 1); this_123 = C_maxIndex_176; C_typeId_428[this_123] = 1; } else { error125("Out of memory: Could not create C."); this_123 = 0; }; } else { C_firstFree_126 = (C_firstFree_126 - 1); this_123 = C_nextFree_535[C_firstFree_126]; C_typeId_428[this_123] = 1; }; return this_123; } function error125(string msg159) { $debugPrint207((msg_159 + (" " + #getStackTrace()))); } function dealloc_C141(integer obj138) { if (C_typeId_428[obj_138] == 0) { error125("Double free: object of type C"); } else { C_nextFree_535[C_firstFree_126] = obj_138; C_firstFree_126 = (C_firstFree_126 + 1); C_typeId_428[obj_138] = 0; }; } function dispatch_C_destroyC156(integer this426) { if (C_typeId_428[this_426] == 0) { if (this_426 == 0) { error125("Nullpointer exception when calling C.C"); } else { error125("Called C.C on invalid object."); }; } else { }; destroyC209(this_426); }