string test_s338 array T_nextFree180 integer T_firstFree204 integer T_maxIndex244 array T_typeId108 string test_s338 = "" integer T_firstFree204 = 0 integer T_maxIndex244 = 0 function initGlobals211() { } function main154() { local integer t575 initGlobals211(); test_s_338 = ""; t_575 = new_A198(); dispatch_T_destroyT958(t_575); if (test_s_338 == "") { testSuccess644(); } else { }; } function config133() { } IS_NATIVE function testSuccess644() { } function new_A198() returns integer { local integer this340 local integer this186 if (T_firstFree_204 == 0) { if (T_maxIndex_244 < 32768) { T_maxIndex_244 = (T_maxIndex_244 + 1); this_186 = T_maxIndex_244; T_typeId_108[this_186] = 2; } else { error154("Out of memory: Could not create A."); this_186 = 0; }; } else { T_firstFree_204 = (T_firstFree_204 - 1); this_186 = T_nextFree_180[T_firstFree_204]; T_typeId_108[this_186] = 2; }; this_340 = this_186; return this_340; } function destroyB296(integer this190) { local integer obj184 test_s_338 = (test_s_338 + "B"); obj_184 = this_190; if (T_typeId_108[obj_184] == 0) { error154("Double free: object of type B"); } else { T_nextFree_180[T_firstFree_204] = obj_184; T_firstFree_204 = (T_firstFree_204 + 1); T_typeId_108[obj_184] = 0; }; } function error154(string msg114) { $debugPrint130((msg_114 + (" " + #getStackTrace()))); } function dispatch_T_destroyT958(integer this159) { local integer this125 local integer obj162 if (T_typeId_108[this_159] == 0) { if (this_159 == 0) { error154("Nullpointer exception when calling T.T"); } else { error154("Called T.T on invalid object."); }; } else { }; if (T_typeId_108[this_159] <= 2) { this_125 = this_159; obj_162 = this_125; if (T_typeId_108[obj_162] == 0) { error154("Double free: object of type T"); } else { T_nextFree_180[T_firstFree_204] = obj_162; T_firstFree_204 = (T_firstFree_204 + 1); T_typeId_108[obj_162] = 0; }; } else { destroyB296(this_159); }; }