Created
August 30, 2019 13:00
-
-
Save Lucretia/f99e1aaa3024ecd5d218fb9778b2a504 to your computer and use it in GitHub Desktop.
Fizz buss asm - no optimisation
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 | |
.globl _ada_fizz_buzz | |
.type _ada_fizz_buzz, @function | |
_ada_fizz_buzz: | |
.LFB1: | |
.cfi_startproc | |
pushq %rbp | |
.cfi_def_cfa_offset 16 | |
.cfi_offset 6, -16 | |
movq %rsp, %rbp | |
.cfi_def_cfa_register 6 | |
pushq %r15 | |
pushq %r14 | |
pushq %r13 | |
pushq %r12 | |
pushq %rbx | |
subq $40, %rsp | |
.cfi_offset 15, -24 | |
.cfi_offset 14, -32 | |
.cfi_offset 13, -40 | |
.cfi_offset 12, -48 | |
.cfi_offset 3, -56 | |
movb $1, -49(%rbp) | |
.L6: | |
cmpb $100, -49(%rbp) | |
jg .L8 | |
movzbl -49(%rbp), %ecx | |
movsbw %cl, %ax | |
imull $86, %eax, %eax | |
shrw $8, %ax | |
movl %eax, %edx | |
movl %ecx, %eax | |
sarb $7, %al | |
movl %edx, %ebx | |
subl %eax, %ebx | |
movl %ebx, %eax | |
movl %eax, %edx | |
addl %edx, %edx | |
addl %eax, %edx | |
movl %ecx, %eax | |
subl %edx, %eax | |
testb %al, %al | |
sete %al | |
movb %al, -50(%rbp) | |
movzbl -49(%rbp), %ecx | |
movsbw %cl, %ax | |
imull $103, %eax, %eax | |
shrw $8, %ax | |
movl %eax, %edx | |
sarb %dl | |
movl %ecx, %eax | |
sarb $7, %al | |
subl %eax, %edx | |
movl %edx, %eax | |
movl %eax, %edx | |
sall $2, %edx | |
addl %eax, %edx | |
movl %ecx, %eax | |
subl %edx, %eax | |
testb %al, %al | |
sete %al | |
movb %al, -51(%rbp) | |
movzbl -50(%rbp), %eax | |
andb -51(%rbp), %al | |
testb %al, %al | |
je .L3 | |
movq $.LC2, -80(%rbp) | |
movq $.LC0, -72(%rbp) | |
movq -80(%rbp), %rax | |
movq -72(%rbp), %rdx | |
movq %rax, %rcx | |
movq %rdx, %rbx | |
movq %rdx, %rax | |
movq %rcx, %rdi | |
movq %rax, %rsi | |
call ada__text_io__put_line__2 | |
jmp .L4 | |
.L3: | |
cmpb $0, -50(%rbp) | |
je .L5 | |
movl $.LC3, %r14d | |
movl $.LC1, %r15d | |
movq %r14, %rcx | |
movq %r15, %rbx | |
movq %r14, %rax | |
movq %r15, %rdx | |
movq %rdx, %rax | |
movq %rcx, %rdi | |
movq %rax, %rsi | |
call ada__text_io__put_line__2 | |
jmp .L4 | |
.L5: | |
cmpb $0, -51(%rbp) | |
je .L4 | |
movl $.LC4, %r12d | |
movl $.LC1, %r13d | |
movq %r12, %rcx | |
movq %r13, %rbx | |
movq %r12, %rax | |
movq %r13, %rdx | |
movq %rdx, %rax | |
movq %rcx, %rdi | |
movq %rax, %rsi | |
call ada__text_io__put_line__2 | |
.L4: | |
addb $1, -49(%rbp) | |
jmp .L6 | |
.L8: | |
nop | |
addq $40, %rsp | |
popq %rbx | |
popq %r12 | |
popq %r13 | |
popq %r14 | |
popq %r15 | |
popq %rbp | |
.cfi_def_cfa 7, 8 | |
ret | |
.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