# expected: 000001BC, 000002BC, 000003BC, 00000AC, 00000AC
    .text
_start:
    li x5, 0x0
    # case1: not equal -> should not jump -> write 0x1BC
    add x1, x0, 0x00A
    add x2, x0, 0x00B
    beq x1, x2, case1_skip
    add x31, x0, 0x1BC
case1_skip:

    # case2: equal -> should jump -> write 0x2BC
    add x1, x0, 0x1BC
    add x2, x0, 0x1BC
    beq x1, x2, case2_target
    add x31, x0, 0x3BC
case2_target:
    add x31, x0, 0x2BC

back_label:
    bne x5, x0, back_label_flagged
    add x1, x0, 0x000
    add x2, x0, 0x001
    add x31, x0, 0x3BC
    jal x0, back_label_cont
back_label_flagged:
    add x31, x0, 0x0BC
    add x5, x0, 0x0
    jal x0, after_backward
back_label_cont:

    # case3: zero equality -> should jump -> write 0x4BC
    add x1, x0, 0x000
    add x2, x0, 0x000
    beq x1, x2, case3_target
    add x31, x0, 0x5BC
case3_target:

    # set flag and branch backwards to test negative offset
    add x5, x0, 0x1
    add x1, x0, 0x002
    add x2, x0, 0x001
    beq x1, x2, back_label

    # same-register: always equal -> should jump -> write 0x0AC
    add x1, x0, 0x00A
    beq x1, x1, same_reg_target
    add x31, x0, 0x6BC
same_reg_target:
    add x31, x0, 0x0AC

after_backward:
    # final marker
    add x31, x0, 0x0AC
