Skip to content

Instantly share code, notes, and snippets.

@Lucretia
Created August 30, 2019 13:04
Show Gist options
  • Save Lucretia/254d3ebeebe8d8f6bb23efb36bd15df3 to your computer and use it in GitHub Desktop.
Save Lucretia/254d3ebeebe8d8f6bb23efb36bd15df3 to your computer and use it in GitHub Desktop.
Fizz buzz 2 - table based - -O3
.file "fizz_buzz_2.adb"
.text
.align 2
.p2align 4,,15
.globl _ada_fizz_buzz_2
.type _ada_fizz_buzz_2, @function
_ada_fizz_buzz_2:
.LFB1:
.cfi_startproc
pushq %r12
.cfi_def_cfa_offset 16
.cfi_offset 12, -16
movl $-1431655765, %r12d
pushq %rbp
.cfi_def_cfa_offset 24
.cfi_offset 6, -24
movl $-858993459, %ebp
pushq %rbx
.cfi_def_cfa_offset 32
.cfi_offset 3, -32
movl $1, %ebx
.p2align 4,,10
.p2align 3
.L3:
addl $1, %ebx
xorl %ecx, %ecx
movl %ebx, %eax
mull %r12d
shrl %edx
leal (%rdx,%rdx,2), %eax
cmpl %eax, %ebx
movl %ebx, %eax
sete %cl
mull %ebp
shrl $2, %edx
leal (%rdx,%rdx,4), %eax
cmpl %eax, %ebx
sete %al
movzbl %al, %eax
leaq (%rax,%rcx,2), %rax
salq $4, %rax
movq string_table.4304(%rax), %rdi
movq string_table.4304+8(%rax), %rsi
testq %rdi, %rdi
je .L2
call ada__text_io__put_line__2
.L2:
cmpl $100, %ebx
jne .L3
popq %rbx
.cfi_def_cfa_offset 24
popq %rbp
.cfi_def_cfa_offset 16
popq %r12
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE1:
.size _ada_fizz_buzz_2, .-_ada_fizz_buzz_2
.section .rodata
.align 8
.type fizz___UNC.4202, @object
.size fizz___UNC.4202, 12
fizz___UNC.4202:
.long 1
.long 4
.ascii "Fizz"
.align 8
.type buzz___UNC.4213, @object
.size buzz___UNC.4213, 12
buzz___UNC.4213:
.long 1
.long 4
.ascii "Buzz"
.align 16
.type fizz_buzz___UNC.4224, @object
.size fizz_buzz___UNC.4224, 16
fizz_buzz___UNC.4224:
.long 1
.long 8
.ascii "FizzBuzz"
.align 8
.LC0:
.zero 8
.align 32
.type string_table.4304, @object
.size string_table.4304, 64
string_table.4304:
.quad 0
.quad .LC0
.quad buzz___UNC.4213+8
.quad buzz___UNC.4213
.quad fizz___UNC.4202+8
.quad fizz___UNC.4202
.quad fizz_buzz___UNC.4224+8
.quad fizz_buzz___UNC.4224
.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