Guest User

Untitled

a guest
Jan 19th, 2020
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. .bss
  2.  
  3. .comm output, 8
  4.  
  5. .text
  6.  
  7. .globl _start
  8.  
  9. _start:
  10. movq 16(%rsp), %rdi
  11. call a_to_i
  12. movq %rax, %rbx
  13.  
  14. movq 24(%rsp), %rdi
  15. call a_to_i
  16. addq %rbx, %rax
  17.  
  18. movq $output, %rdi
  19. movq %rax, %rsi
  20. callq i_to_a
  21.  
  22. movq $1, %rax
  23. movq $1, %rdi
  24. movq $output, %rsi
  25. movq $8, %rdx
  26. syscall
  27.  
  28. movq $60, %rax
  29. movq $0, %rdi
  30. syscall
  31.  
  32. a_to_i:
  33. movq $0, %rax
  34. movq $10, %r8
  35. movq $8, %rcx
  36. 0:
  37. mulq %r8
  38. movb -1(%rdi,%rcx), %dl
  39. subq $'0, %rdx
  40. addq %rdx, %rax
  41. loop 0b
  42.  
  43. ret
  44.  
  45. i_to_a:
  46. movq %rsi, %rax
  47. movq $10, %r8
  48. movq $8, %rcx
  49. 0:
  50. divq %r8
  51. addq $'0, %rdx
  52. movb %dl, -1(%rdi,%rcx)
  53. loop 0b
  54.  
  55. ret
Advertisement
Add Comment
Please, Sign In to add comment