Advertisement
Coriic

Untitled

May 29th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. .data
  2.  
  3. min:
  4. .long 0
  5. max:
  6. .long 0
  7.  
  8. .text
  9. .type max_diff,@function
  10. .global max_diff
  11. #rdi - a
  12. #rsi - b
  13. #rdx - c
  14. #rcx - d
  15.  
  16. max_diff:
  17. MOV %rdi, min
  18. MOV %rdi, max
  19. comp_b:
  20. CMP min, %rsi
  21. JL b_min
  22. MOV %rsi, max
  23. comp_c:
  24. CMP min, %rdx
  25. JL c_min
  26. MOV %rdx, max
  27. comp_d:
  28. CMP min, %rcx
  29. JL d_min
  30. MOV %rcx, max
  31. exit:
  32. MOVL min, %eax
  33. MOVL max, %ebx
  34. SUB %eax,%ebx
  35. MOVL %ebx, %eax
  36. RET
  37.  
  38. b_min:
  39. MOV %rsi, min
  40. JMP comp_c
  41. c_min:
  42. MOV %rdx, min
  43. JMP comp_d
  44. d_min:
  45. MOV %rcx, min
  46. JMP exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement