array C_nextFree151 integer C_firstFree322 integer C_maxIndex138 array C_typeId163 integer C_firstFree322 = 0 integer C_maxIndex138 = 0 function initGlobals123() { } function main181() { initGlobals123(); init_test210(); } function config115() { } function init_test210() { local integer a181 local integer b136 a_181 = new_C114(); dispatch_C_destroyC110(a_181); a_181 = new_C114(); dispatch_C_destroyC110(a_181); a_181 = new_C114(); b_136 = new_C114(); if (a_181 != b_136) { testSuccess338(); } else { }; } IS_NATIVE function testSuccess338() { } function new_C114() returns integer { local integer this152 local integer this791 if (C_firstFree_322 == 0) { if (C_maxIndex_138 < 32768) { C_maxIndex_138 = (C_maxIndex_138 + 1); this_791 = C_maxIndex_138; C_typeId_163[this_791] = 1; } else { error163("Out of memory: Could not create C."); this_791 = 0; }; } else { C_firstFree_322 = (C_firstFree_322 - 1); this_791 = C_nextFree_151[C_firstFree_322]; C_typeId_163[this_791] = 1; }; this_152 = this_791; return this_152; } function error163(string msg188) { $debugPrint123((msg_188 + (" " + #getStackTrace()))); } function dispatch_C_destroyC110(integer this157) { local integer this505 local integer obj147 if (C_typeId_163[this_157] == 0) { if (this_157 == 0) { error163("Nullpointer exception when calling C.C"); } else { error163("Called C.C on invalid object."); }; } else { }; this_505 = this_157; obj_147 = this_505; if (C_typeId_163[obj_147] == 0) { error163("Double free: object of type C"); } else { C_nextFree_151[C_firstFree_322] = obj_147; C_firstFree_322 = (C_firstFree_322 + 1); C_typeId_163[obj_147] = 0; }; }