extern malloc global ft_strdup extern ft_strcpy extern ft_strlen extern __errno_location section .text ft_strdup: test rdi, rdi ; test if arg is NULL je err push rdi ;push to use it for the strcpy call ft_strlen mov rdi, rax call malloc wrt ..plt test rax, rax je malloc_failed mov rdi, rax pop rsi call ft_strcpy ret malloc_failed: call __errno_location wrt ..plt mov dword [rax], 12 pop rax err: xor rax, rax ret