array<integer> I_nextFree113
integer I_firstFree135
integer I_maxIndex188
array<integer> I_typeId108
integer wurst_stack_depth188
array<string> wurst_stack193


integer I_firstFree135 = 0
integer I_maxIndex188 = 0
integer wurst_stack_depth188 = 0


function initGlobals937() { 
}


function main211() { 
    initGlobals937();
    init_test447("when calling init_test in defaultImplInClass, line 1");
}


function config148() { 
}


function init_test447(string __wurst_stackPos101) { 
    local integer b173
    local integer c142
    local integer d765
    local boolean andLeft925
    wurst_stack_193[wurst_stack_depth_188] = __wurst_stackPos_101;
    wurst_stack_depth_188 = (wurst_stack_depth_188 + 1);
    b_173 = new_B142("when calling new_B in defaultImplInClass, line 14");
    c_142 = new_C754("when calling new_C in defaultImplInClass, line 15");
    d_765 = new_D287("when calling new_D in defaultImplInClass, line 16");
    wurst_stack_193[wurst_stack_depth_188] = "when calling foo in defaultImplInClass, line 17";
    wurst_stack_depth_188 = (wurst_stack_depth_188 + 1);
    if (I_typeId_108[b_173] == 0) {
        if (b_173 == 0) {
            error181("Nullpointer exception when calling B.foo", "when calling error in defaultImplInClass, line 7");
        } else {
            error181("Called B.foo on invalid object.", "when calling error in defaultImplInClass, line 7");
        };
    } else {
    };
    wurst_stack_depth_188 = (wurst_stack_depth_188 - 1);
    if (dispatch_I_test_I_foo977(c_142, "when calling foo in defaultImplInClass, line 17") == 5) {
        wurst_stack_193[wurst_stack_depth_188] = "when calling foo in defaultImplInClass, line 17";
        wurst_stack_depth_188 = (wurst_stack_depth_188 + 1);
        if (I_typeId_108[d_765] == 0) {
            if (d_765 == 0) {
                error181("Nullpointer exception when calling D.foo", "when calling error in defaultImplInClass, line 11");
            } else {
                error181("Called D.foo on invalid object.", "when calling error in defaultImplInClass, line 11");
            };
        } else {
        };
        wurst_stack_depth_188 = (wurst_stack_depth_188 - 1);
        andLeft_925 = true;
    } else {
        andLeft_925 = false;
    };
    if andLeft_925 {
        testSuccess942();
    } else {
    };
    wurst_stack_depth_188 = (wurst_stack_depth_188 - 1);
}


IS_NATIVE function testSuccess942() { 
}


function new_B142(string __wurst_stackPos202) returns integer { 
    local integer this290
    wurst_stack_193[wurst_stack_depth_188] = __wurst_stackPos_202;
    wurst_stack_depth_188 = (wurst_stack_depth_188 + 1);
    wurst_stack_193[wurst_stack_depth_188] = "when calling alloc_B in defaultImplInClass, line 6";
    wurst_stack_depth_188 = (wurst_stack_depth_188 + 1);
    if (I_firstFree_135 == 0) {
        if (I_maxIndex_188 < 32768) {
            I_maxIndex_188 = (I_maxIndex_188 + 1);
            this_290 = I_maxIndex_188;
            I_typeId_108[this_290] = 2;
        } else {
            error181("Out of memory: Could not create B.", "when calling error in defaultImplInClass, line 6");
            this_290 = 0;
        };
    } else {
        I_firstFree_135 = (I_firstFree_135 - 1);
        this_290 = I_nextFree_113[I_firstFree_135];
        I_typeId_108[this_290] = 2;
    };
    wurst_stack_depth_188 = ((wurst_stack_depth_188 - 1) - 1);
    return this_290;
}


function new_C754(string __wurst_stackPos608) returns integer { 
    local integer this107
    wurst_stack_193[wurst_stack_depth_188] = __wurst_stackPos_608;
    wurst_stack_depth_188 = (wurst_stack_depth_188 + 1);
    wurst_stack_193[wurst_stack_depth_188] = "when calling alloc_C in defaultImplInClass, line 9";
    wurst_stack_depth_188 = (wurst_stack_depth_188 + 1);
    if (I_firstFree_135 == 0) {
        if (I_maxIndex_188 < 32768) {
            I_maxIndex_188 = (I_maxIndex_188 + 1);
            this_107 = I_maxIndex_188;
            I_typeId_108[this_107] = 3;
        } else {
            error181("Out of memory: Could not create C.", "when calling error in defaultImplInClass, line 9");
            this_107 = 0;
        };
    } else {
        I_firstFree_135 = (I_firstFree_135 - 1);
        this_107 = I_nextFree_113[I_firstFree_135];
        I_typeId_108[this_107] = 3;
    };
    wurst_stack_depth_188 = ((wurst_stack_depth_188 - 1) - 1);
    return this_107;
}


function new_D287(string __wurst_stackPos852) returns integer { 
    local integer this108
    wurst_stack_193[wurst_stack_depth_188] = __wurst_stackPos_852;
    wurst_stack_depth_188 = (wurst_stack_depth_188 + 1);
    wurst_stack_193[wurst_stack_depth_188] = "when calling alloc_D in defaultImplInClass, line 10";
    wurst_stack_depth_188 = (wurst_stack_depth_188 + 1);
    if (I_firstFree_135 == 0) {
        if (I_maxIndex_188 < 32768) {
            I_maxIndex_188 = (I_maxIndex_188 + 1);
            this_108 = I_maxIndex_188;
            I_typeId_108[this_108] = 4;
        } else {
            error181("Out of memory: Could not create D.", "when calling error in defaultImplInClass, line 10");
            this_108 = 0;
        };
    } else {
        I_firstFree_135 = (I_firstFree_135 - 1);
        this_108 = I_nextFree_113[I_firstFree_135];
        I_typeId_108[this_108] = 4;
    };
    wurst_stack_depth_188 = ((wurst_stack_depth_188 - 1) - 1);
    return this_108;
}


function error181(string msg542, string __wurst_stackPos129) { 
    local integer stacktraceIndex158
    local integer stacktraceLimit516
    wurst_stack_193[wurst_stack_depth_188] = __wurst_stackPos_129;
    wurst_stack_depth_188 = (wurst_stack_depth_188 + 1);
    __wurst_stackPos_129 = "";
    stacktraceIndex_158 = wurst_stack_depth_188;
    stacktraceLimit_516 = 0;
    loop {
        stacktraceIndex_158 = (stacktraceIndex_158 - 1);
        stacktraceLimit_516 = (stacktraceLimit_516 + 1);
        exitwhen ((stacktraceLimit_516 > 20) or (stacktraceIndex_158 < 0));
        __wurst_stackPos_129 = (__wurst_stackPos_129 + ("
   " + wurst_stack_193[stacktraceIndex_158]));
    };
    $debugPrint109((msg_542 + ("
" + __wurst_stackPos_129)));
    wurst_stack_depth_188 = (wurst_stack_depth_188 - 1);
}


function dispatch_I_test_I_foo977(integer this280, string __wurst_stackPos120) returns integer { 
    wurst_stack_193[wurst_stack_depth_188] = __wurst_stackPos_120;
    wurst_stack_depth_188 = (wurst_stack_depth_188 + 1);
    if (I_typeId_108[this_280] == 0) {
        if (this_280 == 0) {
            error181("Nullpointer exception when calling I.foo", "when calling error in defaultImplInClass, line 4");
        } else {
            error181("Called I.foo on invalid object.", "when calling error in defaultImplInClass, line 4");
        };
    } else {
    };
    if (I_typeId_108[this_280] <= 2) {
        if (I_typeId_108[this_280] <= 1) {
            this_280 = 5;
        } else {
            this_280 = 2;
        };
    } else {
        if (I_typeId_108[this_280] <= 3) {
            this_280 = 5;
        } else {
            this_280 = 3;
        };
    };
    wurst_stack_depth_188 = (wurst_stack_depth_188 - 1);
    return this_280;
}