Last active
August 30, 2019 13:02
-
-
Save Lucretia/79b7559a160778adeda6ee0967723c8d to your computer and use it in GitHub Desktop.
Fizz buzz - -O3
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
.file "fizz_buzz.adb" | |
.text | |
.section .rodata | |
.LC2: | |
.ascii " - Fizz Buzz" | |
.LC3: | |
.ascii " - Fizz" | |
.LC4: | |
.ascii " - Buzz" | |
.align 8 | |
.LC0: | |
.long 1 | |
.long 12 | |
.align 8 | |
.LC1: | |
.long 1 | |
.long 7 | |
.text | |
.align 2 | |
.p2align 4,,15 | |
.globl _ada_fizz_buzz | |
.type _ada_fizz_buzz, @function | |
_ada_fizz_buzz: | |
.LFB1: | |
.cfi_startproc | |
pushq %rbx | |
.cfi_def_cfa_offset 16 | |
.cfi_offset 3, -16 | |
xorl %ebx, %ebx | |
jmp .L5 | |
.p2align 4,,10 | |
.p2align 3 | |
.L2: | |
testb %dl, %dl | |
je .L9 | |
testb %dil, %dil | |
je .L10 | |
.L3: | |
cmpb $100, %bl | |
je .L11 | |
.L5: | |
addl $1, %ebx | |
movsbw %bl, %ax | |
movl %ebx, %ecx | |
movl %ebx, %esi | |
imull $86, %eax, %edx | |
sarb $7, %cl | |
movl %ebx, %edi | |
imull $103, %eax, %eax | |
shrw $8, %dx | |
sarw $9, %ax | |
subl %ecx, %edx | |
subl %ecx, %eax | |
leal (%rdx,%rdx,2), %edx | |
leal (%rax,%rax,4), %eax | |
subl %edx, %esi | |
subl %eax, %edi | |
movl %esi, %edx | |
orb %dil, %sil | |
jne .L2 | |
movl $.LC2, %edi | |
movl $.LC0, %esi | |
call ada__text_io__put_line__2 | |
cmpb $100, %bl | |
jne .L5 | |
.L11: | |
popq %rbx | |
.cfi_remember_state | |
.cfi_def_cfa_offset 8 | |
ret | |
.p2align 4,,10 | |
.p2align 3 | |
.L9: | |
.cfi_restore_state | |
movl $.LC3, %edi | |
movl $.LC1, %esi | |
call ada__text_io__put_line__2 | |
jmp .L3 | |
.p2align 4,,10 | |
.p2align 3 | |
.L10: | |
movl $.LC4, %edi | |
movl $.LC1, %esi | |
call ada__text_io__put_line__2 | |
jmp .L3 | |
.cfi_endproc | |
.LFE1: | |
.size _ada_fizz_buzz, .-_ada_fizz_buzz | |
.ident "GCC: (GNU) 7.3.0" | |
.section .note.GNU-stack,"",@progbits |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment