Advertisement
Coriic

Untitled

Jun 27th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. .text
  2. .type capitalize, @function
  3. .global capitalize
  4.  
  5. #%rdi - string
  6.  
  7. capitalize:
  8. MOV %rdi, %rax
  9. XOR %r8, %r8
  10. MOV $0, %r8
  11. loop:
  12. CMP $0, (%rdi)
  13. JE afterLoop
  14. CMP $1, %r8
  15. JE tryToSwap
  16. JMP checkIfDot
  17. afterSwap:
  18. INC %rdi
  19. JMP loop
  20. afterLoop:
  21. RET
  22.  
  23. tryToSwap:
  24. CMPB $'a', (%rdi)
  25. JL afterSwap
  26. CMPB $'z', (%rdi)
  27. JG afterSwap
  28. SUBB $32, (%rdi)
  29. MOV $0, %r8
  30. JMP afterSwap
  31.  
  32. checkIfDot:
  33. CMPB $'.', (%rdi)
  34. JNE afterSwap
  35. CMPB $'?', (%rdi)
  36. JNE afterSwap
  37. CMPB $'!', (%rdi)
  38. JNE afterSwap
  39. MOV $1, %r8
  40. JMP afterSwap
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement