Created
June 26, 2018 08:00
-
-
Save zv/404b1140ffb43d5f10ae983b4eeda37f to your computer and use it in GitHub Desktop.
optimize.asm
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
test: | |
.LFB0: | |
.cfi_startproc | |
push rbp | |
.cfi_def_cfa_offset 16 | |
.cfi_offset 6, -16 | |
mov rbp, rsp | |
.cfi_def_cfa_register 6 | |
mov DWORD PTR [rbp-20], edi | |
mov DWORD PTR [rbp-4], 0 | |
mov DWORD PTR [rbp-8], 0 | |
jmp .L2 | |
.L8: | |
mov eax, DWORD PTR [rbp-8] | |
imul eax, DWORD PTR [rbp-20] | |
test eax, eax | |
je .L3 | |
cmp eax, 1 | |
je .L4 | |
jmp .L9 | |
.L3: | |
add DWORD PTR [rbp-4], 1 | |
jmp .L6 | |
.L4: | |
add DWORD PTR [rbp-4], 2 | |
jmp .L6 | |
.L9: | |
mov eax, DWORD PTR [rbp-8] | |
imul eax, DWORD PTR [rbp-8] | |
mov edx, eax | |
mov eax, DWORD PTR [rbp-20] | |
add edx, eax | |
mov eax, DWORD PTR [rbp-20] | |
imul eax, DWORD PTR [rbp-20] | |
cmp edx, eax | |
jle .L6 | |
mov eax, DWORD PTR [rbp-4] | |
jmp .L7 | |
.L6: | |
add DWORD PTR [rbp-8], 1 | |
.L2: | |
cmp DWORD PTR [rbp-8], 99 | |
jle .L8 | |
mov eax, -1 | |
.L7: | |
pop rbp | |
.cfi_def_cfa 7, 8 | |
ret | |
.cfi_endproc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment