array C_nextFree143 integer C_firstFree275 integer C_maxIndex543 array C_typeId167 array C_i214 integer C_firstFree275 = 0 integer C_maxIndex543 = 0 function initGlobals417() { } function main187() { initGlobals417(); init_test954(); } function config140() { } function init_test954() { dispatch_C_destroyC444(new_C209()); } IS_NATIVE function testSuccess130() { } function C_init434(integer this100) { C_i_214[this_100] = 3; } function new_C209() returns integer { local integer this213 this_213 = alloc_C213(); construct_C121(this_213); return this_213; } function construct_C121(integer this284) { C_init434(this_284); } function C_onDestroy890(integer this430) { C_i_214[this_430] = (C_i_214[this_430] + 1); testSuccess130(); } function destroyC138(integer this131) { C_onDestroy890(this_131); dealloc_C100(this_131); } function alloc_C213() returns integer { local integer this382 if (C_firstFree_275 == 0) { if (C_maxIndex_543 < 32768) { C_maxIndex_543 = (C_maxIndex_543 + 1); this_382 = C_maxIndex_543; C_typeId_167[this_382] = 1; } else { error130("Out of memory: Could not create C."); this_382 = 0; }; } else { C_firstFree_275 = (C_firstFree_275 - 1); this_382 = C_nextFree_143[C_firstFree_275]; C_typeId_167[this_382] = 1; }; return this_382; } function error130(string msg199) { $debugPrint165((msg_199 + (" " + #getStackTrace()))); } function dealloc_C100(integer obj149) { if (C_typeId_167[obj_149] == 0) { error130("Double free: object of type C"); } else { C_nextFree_143[C_firstFree_275] = obj_149; C_firstFree_275 = (C_firstFree_275 + 1); C_typeId_167[obj_149] = 0; }; } function dispatch_C_destroyC444(integer this185) { if (C_typeId_167[this_185] == 0) { if (this_185 == 0) { error130("Nullpointer exception when calling C.C"); } else { error130("Called C.C on invalid object."); }; } else { }; destroyC138(this_185); }