Created
May 26, 2021 00:02
-
-
Save DavidSouther/8f5b287f2cc1b0fb931d8c1de152cf2a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.assembly extern mscorlib {} | |
.assembly addnums {} | |
.method static void main() | |
{ | |
.entrypoint | |
.maxstack 15 | |
.locals init ( int32 ) | |
// a = 10 | |
ldc.i4.s 10 | |
stloc.0 | |
// while a > 0 | |
w: ldloc.0 | |
brfalse.s x | |
// push a | |
ldloc.0 | |
// a = a - 1 | |
ldloc.0 | |
ldc.i4.1 | |
sub | |
stloc.0 | |
ldloc.0 | |
br w | |
x: // end while a > 0 | |
// a = 9 | |
ldc.i4.s 9 | |
// while a > 0 | |
y: | |
stloc.0 | |
ldloc.0 | |
brfalse.s z | |
// add | |
add | |
// a = a - 1 | |
ldloc.0 | |
ldc.i4.1 | |
sub | |
stloc.0 | |
ldloc.0 | |
br y | |
z: // end while a > 0 | |
call void [mscorlib]System.Console::WriteLine(int32) | |
ret | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment