array C_nextFree835 integer C_firstFree172 integer C_maxIndex862 array C_typeId179 integer C_firstFree172 = 0 integer C_maxIndex862 = 0 function initGlobals550() { } function main179() { initGlobals550(); init_test472(); } function config193() { } function init_test472() { local integer a835 a_835 = new_C890(); dispatch_C_destroyC883(a_835); a_835 = new_C890(); dispatch_C_destroyC883(a_835); a_835 = new_C890(); if (a_835 != new_C890()) { testSuccess777(); } else { }; } IS_NATIVE function testSuccess777() { } function new_C890() returns integer { local integer this112 if (C_firstFree_172 == 0) { if (C_maxIndex_862 < 32768) { C_maxIndex_862 = (C_maxIndex_862 + 1); this_112 = C_maxIndex_862; C_typeId_179[this_112] = 1; } else { error317("Out of memory: Could not create C."); this_112 = 0; }; } else { C_firstFree_172 = (C_firstFree_172 - 1); this_112 = C_nextFree_835[C_firstFree_172]; C_typeId_179[this_112] = 1; }; return this_112; } function error317(string msg176) { $debugPrint142((msg_176 + (" " + #getStackTrace()))); } function dispatch_C_destroyC883(integer this140) { if (C_typeId_179[this_140] == 0) { if (this_140 == 0) { error317("Nullpointer exception when calling C.C"); } else { error317("Called C.C on invalid object."); }; } else { }; if (C_typeId_179[this_140] == 0) { error317("Double free: object of type C"); } else { C_nextFree_835[C_firstFree_172] = this_140; C_firstFree_172 = (C_firstFree_172 + 1); C_typeId_179[this_140] = 0; }; }