zombie-lib/strcmp.asm

50 lines
622 B
NASM

global libz_strcmp
section .text
libz_strcmp:
sub rsp, 8 ;enter
xor rcx, rcx ;we do this to clear garbage in rcx (i have had garbage in it before)
mov r8, rdi ;dupe them
mov r9, rsi
_loopwasp12bsharknado:
;loop tings
mov rdi, r8
mov rsi, r9
add rdi, rcx
add rsi, rcx
mov r10b, [rdi]
mov r11b, [rsi]
cmp r10b, r11b
jne _differiwikeassembwy
cmp r10b, 0
je _notdifferiwikeassembwy
cmp r11b, 0
je _notdifferiwikeassembwy
inc rcx
jmp _loopwasp12bsharknado
_differiwikeassembwy:
mov rax, 1
jmp _end123432345
_notdifferiwikeassembwy:
mov rax, 0
_end123432345:
add rsp, 8 ;exit
ret