Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .text
- .type capitalize, @function
- .global capitalize
- #%rdi - string
- capitalize:
- MOV %rdi, %rax
- XOR %r8, %r8
- MOV $0, %r8
- loop:
- CMP $0, (%rdi)
- JE afterLoop
- CMP $1, %r8
- JE tryToSwap
- JMP checkIfDot
- afterSwap:
- INC %rdi
- JMP loop
- afterLoop:
- RET
- tryToSwap:
- CMPB $'a', (%rdi)
- JL afterSwap
- CMPB $'z', (%rdi)
- JG afterSwap
- SUBB $32, (%rdi)
- MOV $0, %r8
- JMP afterSwap
- checkIfDot:
- CMPB $'.', (%rdi)
- JNE afterSwap
- CMPB $'?', (%rdi)
- JNE afterSwap
- CMPB $'!', (%rdi)
- JNE afterSwap
- MOV $1, %r8
- JMP afterSwap
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement