Advertisement
Guest User

asma

a guest
Mar 18th, 2019
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. .globl asma
  2. asma:
  3. pushq %rbp /*push rbp onto stack*/
  4. movq %rsp, %rbp /*copy rsp into rbp*/
  5. movq %rdi, -24(%rbp) /*place argument a into stack*/
  6. movq %rsi, -32(%rbp) /*place argument b into stack*/
  7. movq %rdx, -40(%rbp) /*place argument c into stack*/
  8. movq -40(%rbp), %rax /*load variable c into rax*/
  9. shrl $6, %eax /*shift(right) c by 6*/
  10. movq %rax, -8(%rbp) /*store shifted value (longs)*/
  11. movq -40(%rbp), %rax /*load variable c into rax*/
  12. andl $63, %eax /*c AND 63, store into rax*/
  13. movq %rax, -16(%rbp) /*store rax value into stack (bits)*/
  14. movq -8(%rbp), %rax /*load var longs into rax*/
  15. andl $1, %eax /*rax MOD 2 and store into rax*/
  16. leaq 0(,%rax,8), %rdx /*store value into rdx (0 or 8)*/
  17. movq -24(%rbp), %rax /*load address of a into rax*/
  18. addq %rdx, %rax /*add 0 or 8 to the address*/
  19. movq (%rax), %rax /*load the value the address points to*/
  20. movq %rax, %r8 /*store value into r8*/
  21. movq -8(%rbp), %rax /*load var longs into rax*/
  22. addq $1, %rax /*longs+1*/
  23. andl $1, %eax /*(longs+1) MOD 2*/
  24. leaq 0(,%rax,8), %rdx /*store value into rdx (0 or 8)*/
  25. movq -24(%rbp), %rax /*load address of a into rax*/
  26. addq %rdx, %rax /*add 0 or 8 to the address*/
  27. movq (%rax), %rax /*load the value the address points to*/
  28. movq -16(%rbp), %rcx /*load var bits into rcx*/
  29. shld %cl, %rax, %r8 /*shift left by rdx bits*/
  30. movq -32(%rbp), %rdx /*load address of b into rdx*/
  31. movq %r8, (%rdx) /*store result as b[0]*/
  32. movq -32(%rbp), %rax /*load address of b into rax*/
  33. addq $8, %rax /*add 8 to the address in rax*/
  34. movq -8(%rbp), %rdx /*load var longs into rdx*/
  35. addq $1, %rdx /*longs+1*/
  36. andl $1, %edx /*(longs+1) MOD 2*/
  37. leaq 0(,%rdx,8), %rcx /*store value into rcx (0 or 8)*/
  38. movq -24(%rbp), %rdx /*load address of a into rdx*/
  39. addq %rcx, %rdx /*add 0 or 8 to the address of a*/
  40. movq (%rdx), %rdx /*load the value the address points to*/
  41. movq %rdx, %r8 /*store value into r8*/
  42. movq -8(%rbp), %rdx /*load var longs into rdx*/
  43. andl $1, %edx /*longs MOD 2*/
  44. leaq 0(,%rdx,8), %rcx /*store value into rcx (0 or 8)*/
  45. movq -24(%rbp), %rdx /*load address of a into rdx*/
  46. addq %rcx, %rdx /*add 8 or 0 to address in rdx*/
  47. movq (%rdx), %rdx /*load the value the address points to*/
  48. movq -16(%rbp), %rcx /*load var bits into rcx*/
  49. shld %cl, %rdx, %r8 /*shift left by rcx bits*/
  50. movq %r8, (%rax) /*store result as b[1]*/
  51. leave
  52. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement