integer test_x195 array B_nextFree151 integer B_firstFree462 integer B_maxIndex197 array B_typeId698 integer test_x195 = 2 integer B_firstFree462 = 0 integer B_maxIndex197 = 0 function initGlobals207() { B_firstFree_462 = 0; B_maxIndex_197 = 0; } function main212() { initGlobals207(); init_test190(); } function config102() { } function init_test190() { local integer a119 test_x_195 = 2; a_119 = new_X179(); dispatch_X_destroyX173(a_119); if (test_x_195 == 6) { testSuccess107(); } else { }; } IS_NATIVE function testSuccess107() { } function A_init157(integer this639) { } function construct_A102(integer this841) { construct_B183(this_841); A_init157(this_841); } function A_onDestroy289(integer this586) { local integer z548 z_548 = 1; test_x_195 = (test_x_195 + z_548); B_onDestroy321(this_586); } function B_init174(integer this194) { } function construct_B183(integer this213) { B_init174(this_213); } function B_onDestroy321(integer this213) { local integer y144 y_144 = 2; test_x_195 = (test_x_195 * y_144); } function destroyX435(integer this711) { X_onDestroy853(this_711); dealloc_X188(this_711); } function X_init122(integer this116) { } function new_X179() returns integer { local integer this107 this_107 = alloc_X185(); construct_X518(this_107); return this_107; } function construct_X518(integer this170) { construct_A102(this_170); X_init122(this_170); } function X_onDestroy853(integer this237) { A_onDestroy289(this_237); } function error713(string msg787) { $debugPrint158((msg_787 + (" " + #getStackTrace()))); } function alloc_X185() returns integer { local integer this200 if (B_firstFree_462 == 0) { if (B_maxIndex_197 < 32768) { B_maxIndex_197 = (B_maxIndex_197 + 1); this_200 = B_maxIndex_197; B_typeId_698[this_200] = 3; } else { error713("Out of memory: Could not create X."); this_200 = 0; }; } else { B_firstFree_462 = (B_firstFree_462 - 1); this_200 = B_nextFree_151[B_firstFree_462]; B_typeId_698[this_200] = 3; }; return this_200; } function dealloc_X188(integer obj297) { if (B_typeId_698[obj_297] == 0) { error713("Double free: object of type X"); } else { B_nextFree_151[B_firstFree_462] = obj_297; B_firstFree_462 = (B_firstFree_462 + 1); B_typeId_698[obj_297] = 0; }; } function dispatch_X_destroyX173(integer this172) { if (B_typeId_698[this_172] == 0) { if (this_172 == 0) { error713("Nullpointer exception when calling X.X"); } else { error713("Called X.X on invalid object."); }; } else { }; destroyX435(this_172); }