array<integer> A_nextFree372
integer A_firstFree220
integer A_maxIndex122
array<integer> A_typeId142
array<integer> B_nextFree257
integer B_firstFree498
integer B_maxIndex808
array<integer> B_typeId924


integer A_firstFree220 = 0
integer A_maxIndex122 = 0
integer B_firstFree498 = 0
integer B_maxIndex808 = 0


function initGlobals784() { 
}


function main163() { 
    initGlobals784();
    init_test966();
}


function config140() { 
}


function init_test966() { 
    local integer i178
    local integer this145
    local integer test_A_M_bar_result201
    this_145 = new_A198();
    if (A_typeId_142[this_145] == 0) {
        if (this_145 == 0) {
            error688("Nullpointer exception when calling A.bar");
        } else {
            error688("Called A.bar on invalid object.");
        };
    } else {
    };
    test_A_M_bar_result_201 = A_M_bar675(this_145);
    i_178 = test_A_M_bar_result_201;
    if (i_178 == 42) {
        testSuccess167();
    } else {
    };
}


IS_NATIVE function testSuccess167() { 
}


function A_M_bar675(integer this550) returns integer { 
    local integer b262
    local integer this111
    local integer test_A_M_B_foo_result477
    b_262 = new_B110();
    this_111 = b_262;
    if (B_typeId_924[this_111] == 0) {
        if (this_111 == 0) {
            error688("Nullpointer exception when calling B.foo");
        } else {
            error688("Called B.foo on invalid object.");
        };
    } else {
    };
    test_A_M_B_foo_result_477 = 4;
    return ((test_A_M_B_foo_result_477 * 10) + 2);
}


function new_A198() returns integer { 
    local integer this185
    local integer this119
    if (A_firstFree_220 == 0) {
        if (A_maxIndex_122 < 32768) {
            A_maxIndex_122 = (A_maxIndex_122 + 1);
            this_119 = A_maxIndex_122;
            A_typeId_142[this_119] = 1;
        } else {
            error688("Out of memory: Could not create A.");
            this_119 = 0;
        };
    } else {
        A_firstFree_220 = (A_firstFree_220 - 1);
        this_119 = A_nextFree_372[A_firstFree_220];
        A_typeId_142[this_119] = 1;
    };
    this_185 = this_119;
    return this_185;
}


function new_B110() returns integer { 
    local integer this130
    local integer this857
    if (B_firstFree_498 == 0) {
        if (B_maxIndex_808 < 32768) {
            B_maxIndex_808 = (B_maxIndex_808 + 1);
            this_857 = B_maxIndex_808;
            B_typeId_924[this_857] = 2;
        } else {
            error688("Out of memory: Could not create B.");
            this_857 = 0;
        };
    } else {
        B_firstFree_498 = (B_firstFree_498 - 1);
        this_857 = B_nextFree_257[B_firstFree_498];
        B_typeId_924[this_857] = 2;
    };
    this_130 = this_857;
    return this_130;
}


function error688(string msg100) { 
    $debugPrint465((msg_100 + ("
" + #getStackTrace())));
}