Skip to content

Instantly share code, notes, and snippets.

@eira-fransham
Last active February 15, 2019 13:33
Show Gist options
  • Save eira-fransham/ea245022f7fa2af456b0464c7beeb343 to your computer and use it in GitHub Desktop.
Save eira-fransham/ea245022f7fa2af456b0464c7beeb343 to your computer and use it in GitHub Desktop.
def .L1_end :: [i32, i32]:
def .L2 :: [i32, i32] num_callers=1:
def .L3 :: [i32, i32] has_backwards_callers:
def .L3_end :: [i32, i32]:
def .L4 :: [i32, i32] num_callers=1:
.fn_0:
const 0i32
const 1i32
swap 1
drop
pick 1
const 2i32
u32.lt
br_if .L1_end, .L2
.L2:
const 1i32
swap 1
drop
br .L3
.L3:
pick 1
const -1i32
i32.add
call 0
pick 1
i32.add
swap 1
drop
pick 1
const -2i32
i32.add
swap 2
const 1i32
u32.gt
br_if .L3, .L4
.L4:
br .L1_end
.L1_end:
pick 0
br .return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment