Files
libasm/ft_strdup.s
2024-03-19 06:54:34 +01:00

22 lines
377 B
ArmAsm

global ft_strdup
extern ft_strlen
extern ft_strcpy
extern malloc
ft_strdup:
call ft_strlen
inc rax
push rdi
mov rdi, rax ; move the result of strlen in rdi
call malloc wrt ..plt
test rax, rax
je .end
pop rsi
mov rdi, rax ; move the result of malloc into rdi (override strlen result)
call ft_strcpy
ret
.end:
pop r8
ret