integer test_x134
array<integer> A_nextFree928
integer A_firstFree108
integer A_maxIndex418
array<integer> A_typeId173


integer test_x134 = 2
integer A_firstFree108 = 0
integer A_maxIndex418 = 0


function initGlobals191() { 
    A_firstFree_108 = 0;
    A_maxIndex_418 = 0;
}


function main830() { 
    initGlobals191();
    init_test134();
}


function config574() { 
}


function init_test134() { 
    local integer a151
    test_x_134 = 2;
    a_151 = new_B826();
    dispatch_A_test_A_foo134(a_151);
    if (test_x_134 == 5) {
        testSuccess436();
    } else {
    };
}


IS_NATIVE function testSuccess436() { 
}


function A_foo150(integer this112) { 
    test_x_134 = 4;
}


function A_init753(integer this118) { 
}


function construct_A123(integer this202) { 
    A_init753(this_202);
}


function B_foo195(integer this144) { 
    test_x_134 = 5;
}


function B_init924(integer this180) { 
}


function new_B826() returns integer { 
    local integer this121
    this_121 = alloc_B143();
    construct_B340(this_121);
    return this_121;
}


function construct_B340(integer this895) { 
    construct_A123(this_895);
    B_init924(this_895);
}


function C_foo353(integer this110) { 
    test_x_134 = 6;
}


function error207(string msg173) { 
    $debugPrint829((msg_173 + ("
" + #getStackTrace())));
}


function alloc_B143() returns integer { 
    local integer this172
    if (A_firstFree_108 == 0) {
        if (A_maxIndex_418 < 32768) {
            A_maxIndex_418 = (A_maxIndex_418 + 1);
            this_172 = A_maxIndex_418;
            A_typeId_173[this_172] = 2;
        } else {
            error207("Out of memory: Could not create B.");
            this_172 = 0;
        };
    } else {
        A_firstFree_108 = (A_firstFree_108 - 1);
        this_172 = A_nextFree_928[A_firstFree_108];
        A_typeId_173[this_172] = 2;
    };
    return this_172;
}


function dispatch_A_test_A_foo134(integer this815) { 
    if (A_typeId_173[this_815] == 0) {
        if (this_815 == 0) {
            error207("Nullpointer exception when calling A.foo");
        } else {
            error207("Called A.foo on invalid object.");
        };
    } else {
    };
    if (A_typeId_173[this_815] <= 2) {
        if (A_typeId_173[this_815] <= 1) {
            A_foo150(this_815);
        } else {
            B_foo195(this_815);
        };
    } else {
        C_foo353(this_815);
    };
}