array<integer> A_nextFree213
integer A_firstFree158
integer A_maxIndex199
array<integer> A_typeId177


integer A_firstFree158 = 0
integer A_maxIndex199 = 0


function initGlobals174() { 
    A_firstFree_158 = 0;
    A_maxIndex_199 = 0;
}


function main650() { 
    initGlobals174();
    init_test671();
}


function config211() { 
}


function init_test671() { 
    local integer b118
    b_118 = new_B914();
    if (dispatch_A_test_A_foo195(b_118) == 42) {
        testSuccess418();
    } else {
    };
}


IS_NATIVE function testSuccess418() { 
}


function A_foo198(integer this158) returns integer { 
    return 42;
}


function A_init442(integer this190) { 
}


function construct_A842(integer this668) { 
    A_init442(this_668);
}


function B_init137(integer this211) { 
}


function new_B914() returns integer { 
    local integer this462
    this_462 = alloc_B147();
    construct_B203(this_462);
    return this_462;
}


function construct_B203(integer this146) { 
    construct_A842(this_146);
    B_init137(this_146);
}


function error615(string msg732) { 
    $debugPrint114((msg_732 + ("
" + #getStackTrace())));
}


function alloc_B147() returns integer { 
    local integer this203
    if (A_firstFree_158 == 0) {
        if (A_maxIndex_199 < 32768) {
            A_maxIndex_199 = (A_maxIndex_199 + 1);
            this_203 = A_maxIndex_199;
            A_typeId_177[this_203] = 2;
        } else {
            error615("Out of memory: Could not create B.");
            this_203 = 0;
        };
    } else {
        A_firstFree_158 = (A_firstFree_158 - 1);
        this_203 = A_nextFree_213[A_firstFree_158];
        A_typeId_177[this_203] = 2;
    };
    return this_203;
}


function dispatch_A_test_A_foo195(integer this187) returns integer { 
    local integer test_A_foo_result358
    if (A_typeId_177[this_187] == 0) {
        if (this_187 == 0) {
            error615("Nullpointer exception when calling A.foo");
        } else {
            error615("Called A.foo on invalid object.");
        };
    } else {
    };
    test_A_foo_result_358 = A_foo198(this_187);
    return test_A_foo_result_358;
}