array<integer> I_nextFree871
integer I_firstFree158
integer I_maxIndex650
array<integer> I_typeId104


integer I_firstFree158 = 0
integer I_maxIndex650 = 0


function initGlobals150() { 
    I_firstFree_158 = 0;
    I_maxIndex_650 = 0;
}


function main199() { 
    initGlobals150();
    init_test668();
}


function config902() { 
}


function init_test668() { 
    local integer i1187
    local integer i2160
    i1_187 = new_B508();
    i2_160 = new_C890();
    if ((dispatch_I_test_I_foo153(i1_187) == 2) and (dispatch_I_test_I_foo153(i2_160) == 3)) {
        testSuccess121();
    } else {
    };
}


IS_NATIVE function testSuccess121() { 
}


function B_foo166(integer this295) returns integer { 
    return 2;
}


function B_init869(integer this196) { 
}


function new_B508() returns integer { 
    local integer this110
    this_110 = alloc_B263();
    construct_B514(this_110);
    return this_110;
}


function construct_B514(integer this508) { 
    B_init869(this_508);
}


function C_foo127(integer this111) returns integer { 
    return 3;
}


function C_init654(integer this772) { 
}


function new_C890() returns integer { 
    local integer this578
    this_578 = alloc_C198();
    construct_C165(this_578);
    return this_578;
}


function construct_C165(integer this147) { 
    C_init654(this_147);
}


function alloc_B263() returns integer { 
    local integer this163
    if (I_firstFree_158 == 0) {
        if (I_maxIndex_650 < 32768) {
            I_maxIndex_650 = (I_maxIndex_650 + 1);
            this_163 = I_maxIndex_650;
            I_typeId_104[this_163] = 2;
        } else {
            error457("Out of memory: Could not create B.");
            this_163 = 0;
        };
    } else {
        I_firstFree_158 = (I_firstFree_158 - 1);
        this_163 = I_nextFree_871[I_firstFree_158];
        I_typeId_104[this_163] = 2;
    };
    return this_163;
}


function error457(string msg164) { 
    $debugPrint211((msg_164 + ("
" + #getStackTrace())));
}


function alloc_C198() returns integer { 
    local integer this141
    if (I_firstFree_158 == 0) {
        if (I_maxIndex_650 < 32768) {
            I_maxIndex_650 = (I_maxIndex_650 + 1);
            this_141 = I_maxIndex_650;
            I_typeId_104[this_141] = 3;
        } else {
            error457("Out of memory: Could not create C.");
            this_141 = 0;
        };
    } else {
        I_firstFree_158 = (I_firstFree_158 - 1);
        this_141 = I_nextFree_871[I_firstFree_158];
        I_typeId_104[this_141] = 3;
    };
    return this_141;
}


function dispatch_I_test_I_foo153(integer this124) returns integer { 
    local integer test_I_foo_result913
    if (I_typeId_104[this_124] == 0) {
        if (this_124 == 0) {
            error457("Nullpointer exception when calling I.foo");
        } else {
            error457("Called I.foo on invalid object.");
        };
    } else {
    };
    if (I_typeId_104[this_124] <= 2) {
        test_I_foo_result_913 = B_foo166(this_124);
    } else {
        test_I_foo_result_913 = C_foo127(this_124);
    };
    return test_I_foo_result_913;
}