string test_s581 array T_nextFree255 integer T_firstFree108 integer T_maxIndex163 array T_typeId912 string test_s581 = "" integer T_firstFree108 = 0 integer T_maxIndex163 = 0 function initGlobals140() { } function main201() { initGlobals140(); test_s_581 = ""; dispatch_T_destroyT120(new_A188()); if (test_s_581 == "") { testSuccess201(); } else { }; } function config231() { } IS_NATIVE function testSuccess201() { } function new_A188() returns integer { local integer this981 if (T_firstFree_108 == 0) { if (T_maxIndex_163 < 32768) { T_maxIndex_163 = (T_maxIndex_163 + 1); this_981 = T_maxIndex_163; T_typeId_912[this_981] = 2; } else { error199("Out of memory: Could not create A."); this_981 = 0; }; } else { T_firstFree_108 = (T_firstFree_108 - 1); this_981 = T_nextFree_255[T_firstFree_108]; T_typeId_912[this_981] = 2; }; return this_981; } function destroyB719(integer this149) { test_s_581 = (test_s_581 + "B"); if (T_typeId_912[this_149] == 0) { error199("Double free: object of type B"); } else { T_nextFree_255[T_firstFree_108] = this_149; T_firstFree_108 = (T_firstFree_108 + 1); T_typeId_912[this_149] = 0; }; } function error199(string msg178) { $debugPrint161((msg_178 + (" " + #getStackTrace()))); } function dispatch_T_destroyT120(integer this161) { if (T_typeId_912[this_161] == 0) { if (this_161 == 0) { error199("Nullpointer exception when calling T.T"); } else { error199("Called T.T on invalid object."); }; } else { }; if (T_typeId_912[this_161] <= 2) { if (T_typeId_912[this_161] == 0) { error199("Double free: object of type T"); } else { T_nextFree_255[T_firstFree_108] = this_161; T_firstFree_108 = (T_firstFree_108 + 1); T_typeId_912[this_161] = 0; }; } else { destroyB719(this_161); }; }