array A_nextFree209 integer A_firstFree132 integer A_maxIndex200 array A_typeId157 array D_c182 integer A_firstFree132 = 0 integer A_maxIndex200 = 0 function initGlobals165() { A_firstFree_132 = 0; A_maxIndex_200 = 0; } function main195() { initGlobals165(); init_Test947(); } function config668() { } function init_Test947() { local integer d129 d_129 = new_D485(0); dispatch_D_destroyD377(d_129); } IS_NATIVE function testSuccess108() { } function A_init165(integer this183) { } function construct_A209(integer this337) { A_init165(this_337); } function A_onDestroy200(integer this141) { } function B_init833(integer this136) { } function construct_B187(integer this547) { construct_A209(this_547); B_init833(this_547); } function B_onDestroy187(integer this582) { A_onDestroy200(this_582); } function C_init727(integer this107) { } function construct_C220(integer this157) { construct_B187(this_157); C_init727(this_157); } function C_onDestroy291(integer this912) { testSuccess108(); B_onDestroy187(this_912); } function destroyD109(integer this143) { D_onDestroy163(this_143); dealloc_D146(this_143); } function D_init429(integer this640) { } function new_D485(integer i152) returns integer { local integer this729 this_729 = alloc_D102(); construct_D100(this_729, i_152); return this_729; } function construct_D100(integer this113, integer i109) { construct_C220(this_113); D_init429(this_113); D_c_182[this_113] = i_109; } function D_onDestroy163(integer this114) { loop { exitwhen (not (D_c_182[this_114] < 4)); D_c_182[this_114] = (D_c_182[this_114] + 1); }; C_onDestroy291(this_114); } function error483(string msg189) { $debugPrint165((msg_189 + (" " + #getStackTrace()))); } function alloc_D102() returns integer { local integer this335 if (A_firstFree_132 == 0) { if (A_maxIndex_200 < 32768) { A_maxIndex_200 = (A_maxIndex_200 + 1); this_335 = A_maxIndex_200; A_typeId_157[this_335] = 4; } else { error483("Out of memory: Could not create D."); this_335 = 0; }; } else { A_firstFree_132 = (A_firstFree_132 - 1); this_335 = A_nextFree_209[A_firstFree_132]; A_typeId_157[this_335] = 4; }; return this_335; } function dealloc_D146(integer obj129) { if (A_typeId_157[obj_129] == 0) { error483("Double free: object of type D"); } else { A_nextFree_209[A_firstFree_132] = obj_129; A_firstFree_132 = (A_firstFree_132 + 1); A_typeId_157[obj_129] = 0; }; } function dispatch_D_destroyD377(integer this244) { if (A_typeId_157[this_244] == 0) { if (this_244 == 0) { error483("Nullpointer exception when calling D.D"); } else { error483("Called D.D on invalid object."); }; } else { }; destroyD109(this_244); }