array A_nextFree131 integer A_firstFree121 integer A_maxIndex265 array A_typeId181 integer A_firstFree121 = 0 integer A_maxIndex265 = 0 function initGlobals997() { } function main147() { initGlobals997(); init_test164(); } function config271() { } function init_test164() { dispatch_A_destroyA142(new_B781()); } IS_NATIVE function testSuccess153() { } function A_init147(integer this144) { } function construct_A691(integer this177) { A_init147(this_177); } function A_onDestroy156(integer this146) { } function destroyA194(integer this589) { A_onDestroy156(this_589); dealloc_A695(this_589); } function destroyB411(integer this158) { B_onDestroy178(this_158); dealloc_B438(this_158); } function B_init650(integer this517) { construct_B_OnDestroy118(this_517); } function construct_B_OnDestroy118(integer this358) { } function new_B781() returns integer { local integer this113 this_113 = alloc_B592(); construct_B514(this_113); return this_113; } function construct_B514(integer this927) { construct_A691(this_927); B_init650(this_927); } function B_onDestroy178(integer this288) { testSuccess153(); A_onDestroy156(this_288); } function error208(string msg123) { $debugPrint204((msg_123 + (" " + #getStackTrace()))); } function dealloc_A695(integer obj424) { if (A_typeId_181[obj_424] == 0) { error208("Double free: object of type A"); } else { A_nextFree_131[A_firstFree_121] = obj_424; A_firstFree_121 = (A_firstFree_121 + 1); A_typeId_181[obj_424] = 0; }; } function alloc_B592() returns integer { local integer this776 if (A_firstFree_121 == 0) { if (A_maxIndex_265 < 32768) { A_maxIndex_265 = (A_maxIndex_265 + 1); this_776 = A_maxIndex_265; A_typeId_181[this_776] = 2; } else { error208("Out of memory: Could not create B."); this_776 = 0; }; } else { A_firstFree_121 = (A_firstFree_121 - 1); this_776 = A_nextFree_131[A_firstFree_121]; A_typeId_181[this_776] = 2; }; return this_776; } function dealloc_B438(integer obj153) { if (A_typeId_181[obj_153] == 0) { error208("Double free: object of type B"); } else { A_nextFree_131[A_firstFree_121] = obj_153; A_firstFree_121 = (A_firstFree_121 + 1); A_typeId_181[obj_153] = 0; }; } function dispatch_A_destroyA142(integer this196) { if (A_typeId_181[this_196] == 0) { if (this_196 == 0) { error208("Nullpointer exception when calling A.A"); } else { error208("Called A.A on invalid object."); }; } else { }; if (A_typeId_181[this_196] <= 1) { destroyA194(this_196); } else { destroyB411(this_196); }; }