Translating if Statements to AVR


if (condition) {
    then_statements
} else {
    else_statements
}

translates to this AVR:


    # code for condition ->  R2
    AND R2,R2  ; set Z bit of status register
    BRBS 1, else
    # code for then_statements
    LDI    r31, hi8(pm(end))  
    LDI    r30, lo8(pm(end))
    IJMP
else:
    # code for else_statements
end:

Index