array C_nextFree147 integer C_firstFree160 integer C_maxIndex230 array C_typeId905 array C_i130 integer C_firstFree160 = 0 integer C_maxIndex230 = 0 function initGlobals336() { C_firstFree_160 = 0; C_maxIndex_230 = 0; } function main180() { initGlobals336(); init_test771(); } function config649() { } function init_test771() { dispatch_C_destroyC174(new_C871()); } IS_NATIVE function testSuccess138() { } function C_init705(integer this155) { C_i_130[this_155] = 3; } function new_C871() returns integer { local integer this790 this_790 = alloc_C121(); construct_C148(this_790); return this_790; } function construct_C148(integer this622) { C_init705(this_622); } function C_onDestroy124(integer this162) { C_i_130[this_162] = (C_i_130[this_162] + 1); testSuccess138(); } function destroyC869(integer this508) { C_onDestroy124(this_508); dealloc_C571(this_508); } function alloc_C121() returns integer { local integer this109 if (C_firstFree_160 == 0) { if (C_maxIndex_230 < 32768) { C_maxIndex_230 = (C_maxIndex_230 + 1); this_109 = C_maxIndex_230; C_typeId_905[this_109] = 1; } else { error209("Out of memory: Could not create C."); this_109 = 0; }; } else { C_firstFree_160 = (C_firstFree_160 - 1); this_109 = C_nextFree_147[C_firstFree_160]; C_typeId_905[this_109] = 1; }; return this_109; } function error209(string msg911) { $debugPrint203((msg_911 + (" " + #getStackTrace()))); } function dealloc_C571(integer obj139) { if (C_typeId_905[obj_139] == 0) { error209("Double free: object of type C"); } else { C_nextFree_147[C_firstFree_160] = obj_139; C_firstFree_160 = (C_firstFree_160 + 1); C_typeId_905[obj_139] = 0; }; } function dispatch_C_destroyC174(integer this767) { if (C_typeId_905[this_767] == 0) { if (this_767 == 0) { error209("Nullpointer exception when calling C.C"); } else { error209("Called C.C on invalid object."); }; } else { }; destroyC869(this_767); }