section .text global ft_strcmp ft_strcmp: xor rax, rax test rdi, rdi ; test if args are false je err test rsi, rsi je err loop_start: mov al, [rdi] cmp al, [rsi] jne compare test al, al ; test if rdi is \0 je compare mov al, [rsi] ; test if rsi is \0 test al, al je compare lea rsi, [rsi + 1] lea rdi, [rdi + 1] jmp loop_start compare: mov al, [rdi] cmp al, [rsi] jl lower jg greater mov eax, 0 jmp end lower: mov eax, -1 jmp end greater: mov eax, 1 jmp end err: mov eax, 0 end: ret