array A_nextFree877 integer A_firstFree129 integer A_maxIndex570 array A_typeId217 integer A_firstFree129 = 0 integer A_maxIndex570 = 0 function initGlobals941() { A_firstFree_129 = 0; A_maxIndex_570 = 0; } function main232() { initGlobals941(); init_test131(); } function config154() { } function init_test131() { local integer b123 b_123 = new_B139(); dispatch_A_destroyA511(b_123); } IS_NATIVE function testSuccess326() { } function A_init206(integer this237) { } function construct_A647(integer this174) { A_init206(this_174); } function A_onDestroy608(integer this686) { } function destroyA215(integer this241) { A_onDestroy608(this_241); dealloc_A738(this_241); } function destroyB174(integer this308) { B_onDestroy878(this_308); dealloc_B499(this_308); } function B_init513(integer this108) { construct_B_OnDestroy172(this_108); } function construct_B_OnDestroy172(integer this689) { } function new_B139() returns integer { local integer this610 this_610 = alloc_B993(); construct_B739(this_610); return this_610; } function construct_B739(integer this190) { construct_A647(this_190); B_init513(this_190); } function B_onDestroy878(integer this440) { testSuccess326(); A_onDestroy608(this_440); } function error743(string msg212) { $debugPrint220((msg_212 + (" " + #getStackTrace()))); } function dealloc_A738(integer obj857) { if (A_typeId_217[obj_857] == 0) { error743("Double free: object of type A"); } else { A_nextFree_877[A_firstFree_129] = obj_857; A_firstFree_129 = (A_firstFree_129 + 1); A_typeId_217[obj_857] = 0; }; } function alloc_B993() returns integer { local integer this257 if (A_firstFree_129 == 0) { if (A_maxIndex_570 < 32768) { A_maxIndex_570 = (A_maxIndex_570 + 1); this_257 = A_maxIndex_570; A_typeId_217[this_257] = 2; } else { error743("Out of memory: Could not create B."); this_257 = 0; }; } else { A_firstFree_129 = (A_firstFree_129 - 1); this_257 = A_nextFree_877[A_firstFree_129]; A_typeId_217[this_257] = 2; }; return this_257; } function dealloc_B499(integer obj158) { if (A_typeId_217[obj_158] == 0) { error743("Double free: object of type B"); } else { A_nextFree_877[A_firstFree_129] = obj_158; A_firstFree_129 = (A_firstFree_129 + 1); A_typeId_217[obj_158] = 0; }; } function dispatch_A_destroyA511(integer this170) { if (A_typeId_217[this_170] == 0) { if (this_170 == 0) { error743("Nullpointer exception when calling A.A"); } else { error743("Called A.A on invalid object."); }; } else { }; if (A_typeId_217[this_170] <= 1) { destroyA215(this_170); } else { destroyB174(this_170); }; }