change labels from global to local in functions, align function calls in stack

This commit is contained in:
2025-08-06 20:10:05 +02:00
parent 2a65c14032
commit caa21a3fb0
11 changed files with 119 additions and 108 deletions

View File

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