array<integer> SimpleFunc_nextFree164
integer SimpleFunc_firstFree573
integer SimpleFunc_maxIndex116
array<integer> SimpleFunc_typeId104
array<integer> main213


integer SimpleFunc_firstFree573 = 0
integer SimpleFunc_maxIndex116 = 0


function initGlobals164() { 
    SimpleFunc_firstFree_573 = 0;
    SimpleFunc_maxIndex_116 = 0;
}


function main193() { 
    initGlobals164();
    init_test171();
}


function config194() { 
}


function init_test171() { 
    local integer main162
    local integer f108
    local integer clVar118
    main_162 = 4;
    clVar_118 = alloc_SimpleFunc_test172();
    main_213[clVar_118] = main_162;
    f_108 = clVar_118;
    if (dispatch_SimpleFunc_test_SimpleFunc_apply935(f_108, 3) == 7) {
        testSuccess180();
    } else {
    };
}


IS_NATIVE function testSuccess180() { 
}


function apply_test166(integer this137, integer x105) returns integer { 
    return (x_105 + main_213[this_137]);
}


function alloc_SimpleFunc_test172() returns integer { 
    local integer this110
    if (SimpleFunc_firstFree_573 == 0) {
        if (SimpleFunc_maxIndex_116 < 32768) {
            SimpleFunc_maxIndex_116 = (SimpleFunc_maxIndex_116 + 1);
            this_110 = SimpleFunc_maxIndex_116;
            SimpleFunc_typeId_104[this_110] = 2;
        } else {
            error181("Out of memory: Could not create SimpleFunc_test.");
            this_110 = 0;
        };
    } else {
        SimpleFunc_firstFree_573 = (SimpleFunc_firstFree_573 - 1);
        this_110 = SimpleFunc_nextFree_164[SimpleFunc_firstFree_573];
        SimpleFunc_typeId_104[this_110] = 2;
    };
    return this_110;
}


function error181(string msg166) { 
    $debugPrint888((msg_166 + ("
" + #getStackTrace())));
}


function dispatch_SimpleFunc_test_SimpleFunc_apply935(integer this806, integer x199) returns integer { 
    local integer test_SimpleFunc_apply_result111
    if (SimpleFunc_typeId_104[this_806] == 0) {
        if (this_806 == 0) {
            error181("Nullpointer exception when calling SimpleFunc.apply");
        } else {
            error181("Called SimpleFunc.apply on invalid object.");
        };
    } else {
    };
    test_SimpleFunc_apply_result_111 = apply_test166(this_806, x_199);
    return test_SimpleFunc_apply_result_111;
}