Skip to content

Instantly share code, notes, and snippets.

@gnuvince
Last active February 27, 2018 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gnuvince/2ce9d214a1411d7bad998ad913498b9e to your computer and use it in GitHub Desktop.
Save gnuvince/2ce9d214a1411d7bad998ad913498b9e to your computer and use it in GitHub Desktop.
iload_0 ; [a]
iconst_1 ; [a, 1]
ieq ; [a==1]
dup ; [a==1, a==1]
jmp_nonzero OR ; [a==1]
drop ; []
iload_1 ; [b]
OR:
istore_2 ; []
iload_2 ; [c]
jmp_zero FALSE ; []
iload_0 ; [a]
iconst -1 ; [a, -1]
imul ; [-a]
ireturn ; []
FALSE:
iload_0 ; [a]
iconst_2 ; [a, 2]
imul ; [2a]
iload_0 ; [2a; a]
swap ; [a; 2a]
iadd ; [a + 2a]
ireturn ; []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment