-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_list_remove_if.s
64 lines (63 loc) · 924 Bytes
/
ft_list_remove_if.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
section .text
extern free
global ft_list_remove_if
ft_list_remove_if: ; rdi:&e, rsi:ref, rdx:fcmp, rcx:freefct
push rbx
push r12
push r13
push r14
push r15
push r8
push rcx
push rdx
cmp rdx, 0
je end
cmp rcx, 0
je end
mov rbx, rdi ;rbx:&e
mov r12, rsi ;r12:ref
mov r13, rdx ;r13:fcmp
mov r14, rcx ;ffree
mov r15, rdi;r15:&e
next:
cmp r15, 0
je end
cmp qword [r15], 0
je end
mov rcx, [r15] ;rcx:e
mov rdx, [r15]
add rdx, 8 ;rdx:&(e->next)
mov rdi, [rcx]
mov rsi, r12
push rcx
push rdx
call r13
pop rdx
pop rcx
cmp rax, 0
jne skip
mov rdx, [rdx]
mov rdi, [rcx]
push rdx
push rcx
call r14
pop rcx
mov rdi, rcx
call free
pop rdx
mov [r15], rdx
jmp next
skip:
mov r15, rdx
jmp next
end:
;mov rdi, rbx
pop rdx
pop rcx
pop r8
pop r15
pop r14
pop r13
pop r12
pop rbx
ret