Skip to content

Instantly share code, notes, and snippets.

@mneise
Created October 31, 2017 03:13
Show Gist options
  • Select an option

  • Save mneise/98c008d10084511941b8039423749db1 to your computer and use it in GitHub Desktop.

Select an option

Save mneise/98c008d10084511941b8039423749db1 to your computer and use it in GitHub Desktop.
int print1(int x):
int-list: $t0, $t1, 13x
float-list:
assign, $t0, 0,
brgeq, 13x, 10, label0
assign, $t0, 1,
label0:
breq, $t0, 0, iflabel1
iflabel0:
call, printi, 13x
iflabel1:
assign, $t1, 0,
brgeq, 13x, 5, label1
assign, $t1, 1,
label1:
breq, $t1, 0, iflabel4
iflabel3:
call, printi, 13x
goto, iflabel5
iflabel4:
call, printi, 7
iflabel5:
return, 1, ,
void main():
int-list: $t3, 14x
float-list:
assign, 14x, 6
let2:
int-list: $t2, 12y
float-list:
assign, 12y, 5
main:
callr, $t2, print1, 12y
assign, $t3, 0,
brneq, 14x, 1, label2
assign, $t3, 1,
label2:
assign, 14x, $t3
return, , ,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment