Created
December 23, 2012 11:32
-
-
Save anonymous/4363016 to your computer and use it in GitHub Desktop.
assembly
This file contains 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
# for each integer from 1 to 1000 | |
# mov ecx, 3 | |
my $ecx = 3; | |
# mov esi, 3 | |
my $esi = 3; | |
# mov edi, 3 | |
my $edi = 5; | |
# xor ebx, ebx | |
my $ebx = 0; # sum | |
zero: | |
# mov eax, ecx | |
my $eax = $ecx; | |
# xor edx, edx | |
# div esi | |
my $edx = $eax div $esi; | |
# test edx, edx | |
# je _yes | |
goto yes if $edx; | |
# mov eax, ecx | |
$eax = $ecx; | |
# xor edx, edx | |
# div edi | |
$edx = $eax div $edi; | |
# test edx, edx | |
# jne _no | |
goto no unless $edx; | |
yes: | |
# add ebx, ecx | |
$ebx += $ecx; | |
no: | |
# inc ecx | |
$ecx++; | |
# cmp ecx, 1000 | |
# jne _0 | |
goto zero if $ecx != 1000; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment