Advertisement
Coriic

Untitled

May 29th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. .data
  2. index:
  3. .long 0
  4. value:
  5. .long 0
  6.  
  7. .text
  8. .type max_ind,@function
  9. .global max_ind
  10.  
  11. #rdi->rsi->rdx->rcx
  12.  
  13. max_ind:
  14. MOV %rdi, value
  15. MOV $1, index
  16. CMP value, %rsi
  17. JB b_max
  18. compare_c:
  19. CMP value, %rdi
  20. JB c_max
  21. compare_d:
  22. CMP value, %rdx
  23. JB d_max
  24.  
  25. exit:
  26. MOV index, %rax
  27. RET
  28.  
  29. b_max:
  30. CMP %rsi, value
  31. JE equal
  32. MOV %rsi, value
  33. MOV $2, index
  34. JMP compare_c
  35.  
  36. c_max:
  37. CMP %rdi, value
  38. JE equal
  39. MOV %rdi, value
  40. MOV $3, index
  41. JMP compare_d
  42.  
  43. c_max:
  44. CMP %rdx, value
  45. JE equal
  46. MOV %rdx, value
  47. MOV $4, index
  48. JMP exit
  49.  
  50. equal:
  51. MOV $0, index
  52. JMP exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement