array A_nextFree966 integer A_firstFree275 integer A_maxIndex302 array A_typeId155 integer A_firstFree275 = 0 integer A_maxIndex302 = 0 function initGlobals155() { A_firstFree_275 = 0; A_maxIndex_302 = 0; } function main201() { initGlobals155(); init_Test202(); } function config114() { } function init_Test202() { local integer a466 local integer e580 local integer count1172 local integer count2176 a_466 = new_A196(); new_A196(); new_A196(); new_A196(); e_580 = new_A196(); count1_172 = instanceCount124(1); dispatch_A_destroyA592(a_466); dispatch_A_destroyA592(e_580); count2_176 = instanceCount124(1); if ((count1_172 == 5) and (count2_176 == 3)) { testSuccess113(); } else { }; } IS_NATIVE function testSuccess113() { } function A_init974(integer this908) { } function new_A196() returns integer { local integer this248 this_248 = alloc_A114(); construct_A204(this_248); return this_248; } function construct_A204(integer this932) { A_init974(this_932); } function A_onDestroy568(integer this951) { } function destroyA106(integer this128) { A_onDestroy568(this_128); dealloc_A444(this_128); } function instanceCount124(integer typeId152) returns integer { return (A_maxIndex_302 - A_firstFree_275); return 0; } function alloc_A114() returns integer { local integer this385 if (A_firstFree_275 == 0) { if (A_maxIndex_302 < 32768) { A_maxIndex_302 = (A_maxIndex_302 + 1); this_385 = A_maxIndex_302; A_typeId_155[this_385] = 1; } else { error384("Out of memory: Could not create A."); this_385 = 0; }; } else { A_firstFree_275 = (A_firstFree_275 - 1); this_385 = A_nextFree_966[A_firstFree_275]; A_typeId_155[this_385] = 1; }; return this_385; } function error384(string msg521) { $debugPrint142((msg_521 + (" " + #getStackTrace()))); } function dealloc_A444(integer obj214) { if (A_typeId_155[obj_214] == 0) { error384("Double free: object of type A"); } else { A_nextFree_966[A_firstFree_275] = obj_214; A_firstFree_275 = (A_firstFree_275 + 1); A_typeId_155[obj_214] = 0; }; } function dispatch_A_destroyA592(integer this119) { if (A_typeId_155[this_119] == 0) { if (this_119 == 0) { error384("Nullpointer exception when calling A.A"); } else { error384("Called A.A on invalid object."); }; } else { }; destroyA106(this_119); }