42 lines
516 B
ArmAsm
42 lines
516 B
ArmAsm
global ft_list_push_front
|
|
extern malloc
|
|
|
|
ft_list_push_front:
|
|
push rsp
|
|
push rdi
|
|
push rsi
|
|
mov rdi, 16
|
|
call malloc
|
|
cmp rax, 0
|
|
je .done
|
|
pop rsi
|
|
pop rdi
|
|
mov [rax], rsi
|
|
mov rbx, [rdi]
|
|
mov [rax + 8], rbx
|
|
mov [rdi], rax
|
|
.done:
|
|
pop rsp
|
|
ret
|
|
|
|
;ft_list_push_front:
|
|
; push ebp
|
|
; mov ebp, esp
|
|
; sub esp 0x10
|
|
; push rdi
|
|
; push rsi
|
|
; mov rdi, 16
|
|
; call malloc
|
|
; pop rsi
|
|
; pop rdi
|
|
; ;cmp rax, 0
|
|
; ;je .error
|
|
;
|
|
; mov rbx, [rdi]
|
|
; mov rbx, [rbx + 8]
|
|
; mov [rax], rsi
|
|
; mov [rax + 8], rbx
|
|
; mov [rdi], rax
|
|
; leave
|
|
; ret
|