array C_nextFree342 integer C_firstFree774 integer C_maxIndex211 array C_typeId386 array C_i102 integer C_firstFree774 = 0 integer C_maxIndex211 = 0 function initGlobals215() { C_firstFree_774 = 0; C_maxIndex_211 = 0; } function main995() { initGlobals215(); init_test103(); } function config529() { } function init_test103() { dispatch_C_destroyC557(new_C176()); } IS_NATIVE function testSuccess429() { } function C_init735(integer this102) { C_i_102[this_102] = 3; } function new_C176() returns integer { local integer this318 this_318 = alloc_C149(); construct_C678(this_318); return this_318; } function construct_C678(integer this345) { C_init735(this_345); } function C_onDestroy168(integer this467) { C_i_102[this_467] = (C_i_102[this_467] + 1); testSuccess429(); } function destroyC825(integer this126) { C_onDestroy168(this_126); dealloc_C229(this_126); } function alloc_C149() returns integer { local integer this542 if (C_firstFree_774 == 0) { if (C_maxIndex_211 < 32768) { C_maxIndex_211 = (C_maxIndex_211 + 1); this_542 = C_maxIndex_211; C_typeId_386[this_542] = 1; } else { error195("Out of memory: Could not create C."); this_542 = 0; }; } else { C_firstFree_774 = (C_firstFree_774 - 1); this_542 = C_nextFree_342[C_firstFree_774]; C_typeId_386[this_542] = 1; }; return this_542; } function error195(string msg129) { $debugPrint165((msg_129 + (" " + #getStackTrace()))); } function dealloc_C229(integer obj105) { if (C_typeId_386[obj_105] == 0) { error195("Double free: object of type C"); } else { C_nextFree_342[C_firstFree_774] = obj_105; C_firstFree_774 = (C_firstFree_774 + 1); C_typeId_386[obj_105] = 0; }; } function dispatch_C_destroyC557(integer this713) { if (C_typeId_386[this_713] == 0) { if (this_713 == 0) { error195("Nullpointer exception when calling C.C"); } else { error195("Called C.C on invalid object."); }; } else { }; destroyC825(this_713); }