integer test_x514 array B_nextFree132 integer B_firstFree904 integer B_maxIndex850 array B_typeId176 integer test_x514 = 2 integer B_firstFree904 = 0 integer B_maxIndex850 = 0 function initGlobals916() { } function main110() { initGlobals916(); init_test666(); } function config339() { } function init_test666() { local integer a152 local integer this183 test_x_514 = 2; a_152 = new_X675(); this_183 = a_152; if (B_typeId_176[this_183] == 0) { if (this_183 == 0) { error157("Nullpointer exception when calling X.X"); } else { error157("Called X.X on invalid object."); }; } else { }; destroyX213(this_183); if (test_x_514 == 6) { testSuccess647(); } else { }; } IS_NATIVE function testSuccess647() { } function destroyX213(integer this185) { local integer obj208 test_x_514 = (test_x_514 + 1); test_x_514 = (test_x_514 * 2); obj_208 = this_185; if (B_typeId_176[obj_208] == 0) { error157("Double free: object of type X"); } else { B_nextFree_132[B_firstFree_904] = obj_208; B_firstFree_904 = (B_firstFree_904 + 1); B_typeId_176[obj_208] = 0; }; } function new_X675() returns integer { local integer this205 local integer this150 local integer this185 if (B_firstFree_904 == 0) { if (B_maxIndex_850 < 32768) { B_maxIndex_850 = (B_maxIndex_850 + 1); this_150 = B_maxIndex_850; B_typeId_176[this_150] = 3; } else { error157("Out of memory: Could not create X."); this_150 = 0; }; } else { B_firstFree_904 = (B_firstFree_904 - 1); this_150 = B_nextFree_132[B_firstFree_904]; B_typeId_176[this_150] = 3; }; this_205 = this_150; this_185 = this_205; return this_205; } function error157(string msg192) { $debugPrint279((msg_192 + (" " + #getStackTrace()))); }