integer test_x787
array<integer> B_nextFree298
integer B_firstFree207
integer B_maxIndex599
array<integer> B_typeId157
integer wurst_stack_depth160
array<string> wurst_stack223


integer test_x787 = 2
integer B_firstFree207 = 0
integer B_maxIndex599 = 0
integer wurst_stack_depth160 = 0


function initGlobals126() { 
}


function main201() { 
    initGlobals126();
    wurst_stack_223[wurst_stack_depth_160] = "when calling init_test in ondestroy, line 1";
    wurst_stack_depth_160 = (wurst_stack_depth_160 + 1);
    test_x_787 = 2;
    dispatch_A_destroyA207(new_A182("when calling new_A in ondestroy, line 11"), "when calling dispatch_A_destroyA in ondestroy, line 12");
    if (test_x_787 == 6) {
        testSuccess643();
    } else {
    };
    wurst_stack_depth_160 = (wurst_stack_depth_160 - 1);
}


function config214() { 
}


IS_NATIVE function testSuccess643() { 
}


function new_A182(string __wurst_stackPos157) returns integer { 
    local integer this840
    wurst_stack_223[wurst_stack_depth_160] = __wurst_stackPos_157;
    wurst_stack_depth_160 = (wurst_stack_depth_160 + 1);
    wurst_stack_223[wurst_stack_depth_160] = "when calling alloc_A in ondestroy, line 7";
    wurst_stack_depth_160 = (wurst_stack_depth_160 + 1);
    if (B_firstFree_207 == 0) {
        if (B_maxIndex_599 < 32768) {
            B_maxIndex_599 = (B_maxIndex_599 + 1);
            this_840 = B_maxIndex_599;
            B_typeId_157[this_840] = 2;
        } else {
            error518("Out of memory: Could not create A.", "when calling error in ondestroy, line 7");
            this_840 = 0;
        };
    } else {
        B_firstFree_207 = (B_firstFree_207 - 1);
        this_840 = B_nextFree_298[B_firstFree_207];
        B_typeId_157[this_840] = 2;
    };
    wurst_stack_depth_160 = ((wurst_stack_depth_160 - 1) - 1);
    return this_840;
}


function error518(string msg658, string __wurst_stackPos170) { 
    local integer stacktraceIndex321
    local integer stacktraceLimit880
    wurst_stack_223[wurst_stack_depth_160] = __wurst_stackPos_170;
    wurst_stack_depth_160 = (wurst_stack_depth_160 + 1);
    __wurst_stackPos_170 = "";
    stacktraceIndex_321 = wurst_stack_depth_160;
    stacktraceLimit_880 = 0;
    loop {
        stacktraceIndex_321 = (stacktraceIndex_321 - 1);
        stacktraceLimit_880 = (stacktraceLimit_880 + 1);
        exitwhen ((stacktraceLimit_880 > 20) or (stacktraceIndex_321 < 0));
        __wurst_stackPos_170 = (__wurst_stackPos_170 + ("
   " + wurst_stack_223[stacktraceIndex_321]));
    };
    $debugPrint535((msg_658 + ("
" + __wurst_stackPos_170)));
    wurst_stack_depth_160 = (wurst_stack_depth_160 - 1);
}


function dispatch_A_destroyA207(integer this468, string __wurst_stackPos109) { 
    wurst_stack_223[wurst_stack_depth_160] = __wurst_stackPos_109;
    wurst_stack_depth_160 = (wurst_stack_depth_160 + 1);
    if (B_typeId_157[this_468] == 0) {
        if (this_468 == 0) {
            error518("Nullpointer exception when calling A.A", "when calling error in ondestroy, line 7");
        } else {
            error518("Called A.A on invalid object.", "when calling error in ondestroy, line 7");
        };
    } else {
    };
    wurst_stack_223[wurst_stack_depth_160] = "when calling destroyA in ondestroy, line 7";
    wurst_stack_depth_160 = (wurst_stack_depth_160 + 1);
    test_x_787 = ((test_x_787 + 1) * 2);
    wurst_stack_223[wurst_stack_depth_160] = "when calling dealloc_A in ondestroy, line 8";
    wurst_stack_depth_160 = (wurst_stack_depth_160 + 1);
    if (B_typeId_157[this_468] == 0) {
        error518("Double free: object of type A", "when calling error in ondestroy, line 7");
    } else {
        B_nextFree_298[B_firstFree_207] = this_468;
        B_firstFree_207 = (B_firstFree_207 + 1);
        B_typeId_157[this_468] = 0;
    };
    wurst_stack_depth_160 = (((wurst_stack_depth_160 - 1) - 1) - 1);
}