array<integer> A_nextFree141
integer A_firstFree653
integer A_maxIndex722
array<integer> Cell_nextFree111
integer Cell_firstFree140
integer Cell_maxIndex194


integer A_firstFree653 = 0
integer A_maxIndex722 = 0
integer Cell_firstFree140 = 0
integer Cell_maxIndex194 = 0


function initGlobals195() { 
    A_firstFree_653 = 0;
    A_maxIndex_722 = 0;
    Cell_firstFree_140 = 0;
    Cell_maxIndex_194 = 0;
}


function main678() { 
    initGlobals195();
    init_Test193();
}


function config436() { 
}


function init_Test193() { 
    local integer c286
    c_286 = new_Cell790();
    new_B137();
}


function A_init908(integer this154) { 
}


function construct_A779(integer this216) { 
    A_init908(this_216);
}


function B_init147(integer this119) { 
}


function new_B137() returns integer { 
    local integer this204
    this_204 = alloc_B133();
    construct_B459(this_204);
    return this_204;
}


function construct_B459(integer this134) { 
    construct_A779(this_134);
    B_init147(this_134);
}


function Cell_init106(integer this280) { 
}


function new_Cell790() returns integer { 
    local integer this194
    this_194 = alloc_Cell146();
    construct_Cell201(this_194);
    return this_194;
}


function construct_Cell201(integer this117) { 
    Cell_init106(this_117);
}


function error183(string msg152) { 
    $debugPrint128((msg_152 + ("
" + #getStackTrace())));
}


function alloc_B133() returns integer { 
    local integer this977
    if (A_firstFree_653 == 0) {
        if (A_maxIndex_722 < 32768) {
            A_maxIndex_722 = (A_maxIndex_722 + 1);
            this_977 = A_maxIndex_722;
        } else {
            error183("Out of memory: Could not create B.");
            this_977 = 0;
        };
    } else {
        A_firstFree_653 = (A_firstFree_653 - 1);
        this_977 = A_nextFree_141[A_firstFree_653];
    };
    return this_977;
}


function alloc_Cell146() returns integer { 
    local integer this138
    if (Cell_firstFree_140 == 0) {
        if (Cell_maxIndex_194 < 32768) {
            Cell_maxIndex_194 = (Cell_maxIndex_194 + 1);
            this_138 = Cell_maxIndex_194;
        } else {
            error183("Out of memory: Could not create Cell.");
            this_138 = 0;
        };
    } else {
        Cell_firstFree_140 = (Cell_firstFree_140 - 1);
        this_138 = Cell_nextFree_111[Cell_firstFree_140];
    };
    return this_138;
}