Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .bss
- .comm output, 8
- .text
- .globl _start
- _start:
- movq 16(%rsp), %rdi
- call a_to_i
- movq %rax, %rbx
- movq 24(%rsp), %rdi
- call a_to_i
- addq %rbx, %rax
- movq $output, %rdi
- movq %rax, %rsi
- callq i_to_a
- movq $1, %rax
- movq $1, %rdi
- movq $output, %rsi
- movq $8, %rdx
- syscall
- movq $60, %rax
- movq $0, %rdi
- syscall
- a_to_i:
- movq $0, %rax
- movq $10, %r8
- movq $8, %rcx
- 0:
- mulq %r8
- movb -1(%rdi,%rcx), %dl
- subq $'0, %rdx
- addq %rdx, %rax
- loop 0b
- ret
- i_to_a:
- movq %rsi, %rax
- movq $10, %r8
- movq $8, %rcx
- 0:
- divq %r8
- addq $'0, %rdx
- movb %dl, -1(%rdi,%rcx)
- loop 0b
- ret
Advertisement
Add Comment
Please, Sign In to add comment