Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .section .rodata
- .LC0:
- .string "%lli\n"
- .text
- .type print, @function
- print:
- PUSH %rdi
- PUSH %rsi
- MOV %rdi, %rsi
- LEA .LC0(%rip), %rdi
- CALL printf
- POP %rsi
- POP %rdi
- RET
- .size print, . - print
- .globl fib
- .type fib, @function
- fib:
- MOV $2, %rbx
- CMP %rbx, %rdi
- SETL %al
- MOVZX %al, %rbx
- TEST %rbx, %rbx
- JZ .L0
- MOV %rdi, %rax
- RET
- JMP .L1
- .L0:
- MOV $1, %rbx
- MOV %rdi, %rbp
- SUB %rbx, %rbp
- PUSH %rdi
- MOV %rbp, %rdi
- XOR %rax, %rax
- CALL fib
- POP %rdi
- PUSH %rax
- MOV $2, %rbx
- MOV %rdi, %rbp
- SUB %rbx, %rbp
- PUSH %rdi
- MOV %rbp, %rdi
- XOR %rax, %rax
- CALL fib
- POP %rdi
- MOV %rax, %rbx
- POP %rax
- ADD %rax, %rbx
- MOV %rbx, %rax
- RET
- .L1:
- RET
- .size fib, . - fib
- .globl iter
- .type iter, @function
- iter:
- CMP %rsi, %rdi
- SETE %al
- MOVZX %al, %rbx
- TEST %rbx, %rbx
- JZ .L2
- XOR %rbx, %rbx
- MOV %rbx, %rax
- RET
- JMP .L3
- .L2:
- PUSH %rdi
- XOR %rax, %rax
- CALL fib
- POP %rdi
- PUSH %rdi
- MOV %rax, %rdi
- XOR %rax, %rax
- CALL print
- POP %rdi
- MOV $1, %rbx
- ADD %rdi, %rbx
- PUSH %rdi
- MOV %rbx, %rdi
- PUSH %rsi
- XOR %rax, %rax
- CALL iter
- POP %rsi
- POP %rdi
- RET
- .L3:
- RET
- .size iter, . - iter
- .globl main
- .type main, @function
- main:
- XOR %rbx, %rbx
- PUSH %rdi
- MOV %rbx, %rdi
- MOV $50, %rbx
- PUSH %rsi
- MOV %rbx, %rsi
- XOR %rax, %rax
- CALL iter
- POP %rsi
- POP %rdi
- RET
- .size main, . - main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement