26 lines
269 B
ArmAsm
26 lines
269 B
ArmAsm
|
global ft_strdup
|
||
|
|
||
|
extern my_test
|
||
|
extern malloc
|
||
|
extern ft_strlen
|
||
|
extern ft_strcpy
|
||
|
|
||
|
ft_strdup:
|
||
|
enter 16, 0
|
||
|
push rdi
|
||
|
enter 16, 0
|
||
|
call ft_strlen
|
||
|
mov rdi, rax
|
||
|
inc rdi
|
||
|
call malloc
|
||
|
cmp rax, 0
|
||
|
jz .done
|
||
|
leave
|
||
|
mov rdi, rax
|
||
|
pop rsi
|
||
|
call ft_strcpy
|
||
|
|
||
|
.done:
|
||
|
leave
|
||
|
ret
|