bril
@main {
    one: int = const 1;
    two: int = const 2;
    a: int = const 1;
    b: int = const 5;
    result: int = const 0;
    jmp .loop.cond;
.loop.bump:
    a: int = add a one;
.loop.cond:
    cond: bool = ge a b;
    br cond .end .body;
.body:
    remainder: int = call @mod a two;
    odd: bool = eq remainder one;
    br odd .then .endif;
.then:
    result: int = add result a;
.endif:
    jmp .loop.bump;
.end:
    print result;
}

@mod(a: int, b: int) {
    d: int = div a b;
    dd: int = mul d b;
    r: int = sub a dd;
    ret r;
}

CC BY-NC-SA 4.0 2023 - PRESENT © Larry Z | Built With