array<integer> SimpleFunc_nextFree177
integer SimpleFunc_firstFree141
integer SimpleFunc_maxIndex154
array<integer> SimpleFunc_typeId153


integer SimpleFunc_firstFree141 = 0
integer SimpleFunc_maxIndex154 = 0


function initGlobals210() { 
    SimpleFunc_firstFree_141 = 0;
    SimpleFunc_maxIndex_154 = 0;
}


function main161() { 
    initGlobals210();
    init_test598();
}


function config177() { 
}


function init_test598() { 
    local integer f597
    local integer clVar156
    local integer g911
    clVar_156 = alloc_SimpleFunc_test365();
    f_597 = clVar_156;
    g_911 = new_Test175();
    if ((dispatch_SimpleFunc_test_SimpleFunc_apply206(f_597, 3, 4) == 7) and (dispatch_SimpleFunc_test_SimpleFunc_apply206(g_911, 3, 4) == 12)) {
        testSuccess300();
    } else {
    };
}


IS_NATIVE function testSuccess300() { 
}


function apply_test115(integer this203, integer x185, integer y204) returns integer { 
    return (x_185 + y_204);
}


function Test_apply954(integer this172, integer x169, integer y455) returns integer { 
    return (x_169 * y_455);
}


function Test_init980(integer this130) { 
}


function new_Test175() returns integer { 
    local integer this906
    this_906 = alloc_Test866();
    construct_Test199(this_906);
    return this_906;
}


function construct_Test199(integer this459) { 
    Test_init980(this_459);
}


function alloc_SimpleFunc_test365() returns integer { 
    local integer this678
    if (SimpleFunc_firstFree_141 == 0) {
        if (SimpleFunc_maxIndex_154 < 32768) {
            SimpleFunc_maxIndex_154 = (SimpleFunc_maxIndex_154 + 1);
            this_678 = SimpleFunc_maxIndex_154;
            SimpleFunc_typeId_153[this_678] = 2;
        } else {
            error690("Out of memory: Could not create SimpleFunc_test.");
            this_678 = 0;
        };
    } else {
        SimpleFunc_firstFree_141 = (SimpleFunc_firstFree_141 - 1);
        this_678 = SimpleFunc_nextFree_177[SimpleFunc_firstFree_141];
        SimpleFunc_typeId_153[this_678] = 2;
    };
    return this_678;
}


function error690(string msg104) { 
    $debugPrint173((msg_104 + ("
" + #getStackTrace())));
}


function alloc_Test866() returns integer { 
    local integer this955
    if (SimpleFunc_firstFree_141 == 0) {
        if (SimpleFunc_maxIndex_154 < 32768) {
            SimpleFunc_maxIndex_154 = (SimpleFunc_maxIndex_154 + 1);
            this_955 = SimpleFunc_maxIndex_154;
            SimpleFunc_typeId_153[this_955] = 3;
        } else {
            error690("Out of memory: Could not create Test.");
            this_955 = 0;
        };
    } else {
        SimpleFunc_firstFree_141 = (SimpleFunc_firstFree_141 - 1);
        this_955 = SimpleFunc_nextFree_177[SimpleFunc_firstFree_141];
        SimpleFunc_typeId_153[this_955] = 3;
    };
    return this_955;
}


function dispatch_SimpleFunc_test_SimpleFunc_apply206(integer this870, integer x146, integer y845) returns integer { 
    local integer test_SimpleFunc_apply_result147
    if (SimpleFunc_typeId_153[this_870] == 0) {
        if (this_870 == 0) {
            error690("Nullpointer exception when calling SimpleFunc.apply");
        } else {
            error690("Called SimpleFunc.apply on invalid object.");
        };
    } else {
    };
    if (SimpleFunc_typeId_153[this_870] <= 2) {
        test_SimpleFunc_apply_result_147 = apply_test115(this_870, x_146, y_845);
    } else {
        test_SimpleFunc_apply_result_147 = Test_apply954(this_870, x_146, y_845);
    };
    return test_SimpleFunc_apply_result_147;
}