array C_nextFree922 integer C_firstFree144 integer C_maxIndex929 array C_typeId623 integer C_firstFree144 = 0 integer C_maxIndex929 = 0 function initGlobals183() { } function main155() { initGlobals183(); init_test103(); } function config206() { } function init_test103() { local integer a192 a_192 = new_C299(); dispatch_C_destroyC191(a_192); a_192 = new_C299(); dispatch_C_destroyC191(a_192); a_192 = new_C299(); if (a_192 != new_C299()) { testSuccess140(); } else { }; } IS_NATIVE function testSuccess140() { } function C_init209(integer this891) { } function new_C299() returns integer { local integer this156 this_156 = alloc_C271(); construct_C135(this_156); return this_156; } function construct_C135(integer this264) { C_init209(this_264); } function C_onDestroy767(integer this508) { } function destroyC135(integer this199) { C_onDestroy767(this_199); dealloc_C700(this_199); } function alloc_C271() returns integer { local integer this391 if (C_firstFree_144 == 0) { if (C_maxIndex_929 < 32768) { C_maxIndex_929 = (C_maxIndex_929 + 1); this_391 = C_maxIndex_929; C_typeId_623[this_391] = 1; } else { error211("Out of memory: Could not create C."); this_391 = 0; }; } else { C_firstFree_144 = (C_firstFree_144 - 1); this_391 = C_nextFree_922[C_firstFree_144]; C_typeId_623[this_391] = 1; }; return this_391; } function error211(string msg387) { $debugPrint168((msg_387 + (" " + #getStackTrace()))); } function dealloc_C700(integer obj202) { if (C_typeId_623[obj_202] == 0) { error211("Double free: object of type C"); } else { C_nextFree_922[C_firstFree_144] = obj_202; C_firstFree_144 = (C_firstFree_144 + 1); C_typeId_623[obj_202] = 0; }; } function dispatch_C_destroyC191(integer this121) { if (C_typeId_623[this_121] == 0) { if (this_121 == 0) { error211("Nullpointer exception when calling C.C"); } else { error211("Called C.C on invalid object."); }; } else { }; destroyC135(this_121); }