Skip to content

Instantly share code, notes, and snippets.

@evanrinehart
Last active May 16, 2018 23:49
Show Gist options
  • Save evanrinehart/634d867ba2dc4c776365d7eb1e2d1a2b to your computer and use it in GitHub Desktop.
Save evanrinehart/634d867ba2dc4c776365d7eb1e2d1a2b to your computer and use it in GitHub Desktop.
def sum(ptr, n, a)
n ? sum(ptr, n-1, a + ptr[n-1]) : a
ifz n goto L
r1 = r1 - 1
r4 = r1 - 1 # without CSE
r3 = ptr[r4]
r2 = r2 + r3
goto 0 # loopification
L:
r0 = r2
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment