array C_nextFree142 integer C_firstFree519 integer C_maxIndex525 array C_typeId146 integer C_firstFree519 = 0 integer C_maxIndex525 = 0 function initGlobals191() { } function main190() { initGlobals191(); init_test695(); } function config135() { } function init_test695() { local array cs126 local integer i358 i_358 = 0; loop { exitwhen (i_358 > 6000); cs_126[i_358] = new_C102(); i_358 = (i_358 + 1); }; i_358 = 0; loop { exitwhen (i_358 > 6000); dispatch_C_destroyC199(cs_126[i_358]); i_358 = (i_358 + 1); }; i_358 = 0; loop { exitwhen (i_358 > 6000); cs_126[i_358] = new_C102(); i_358 = (i_358 + 1); }; if ((cs_126[6000] castTo integer) <= 6001) { testSuccess243(); } else { }; } IS_NATIVE function testSuccess243() { } function new_C102() returns integer { local integer this110 if (C_firstFree_519 == 0) { if (C_maxIndex_525 < 32768) { C_maxIndex_525 = (C_maxIndex_525 + 1); this_110 = C_maxIndex_525; C_typeId_146[this_110] = 1; } else { error383("Out of memory: Could not create C."); this_110 = 0; }; } else { C_firstFree_519 = (C_firstFree_519 - 1); this_110 = C_nextFree_142[C_firstFree_519]; C_typeId_146[this_110] = 1; }; return this_110; } function error383(string msg118) { $debugPrint202((msg_118 + (" " + #getStackTrace()))); } function dispatch_C_destroyC199(integer this158) { if (C_typeId_146[this_158] == 0) { if (this_158 == 0) { error383("Nullpointer exception when calling C.C"); } else { error383("Called C.C on invalid object."); }; } else { }; if (C_typeId_146[this_158] == 0) { error383("Double free: object of type C"); } else { C_nextFree_142[C_firstFree_519] = this_158; C_firstFree_519 = (C_firstFree_519 + 1); C_typeId_146[this_158] = 0; }; }