Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- val: .byte 0
- current:.int 0
- first: .int 0
- previous:
- .int 0
- .text
- .global list_del
- list_del:
- pushl %ebp
- movl %esp, %ebp
- pushl %edi
- pushl %ebx
- movl $0, %edi
- movl $0, %ecx
- movl 8(%ebp), %eax
- movl 12(%ebp), %ebx
- cmpl $0, %eax
- je null
- cmpl $-128, %ebx
- jl not_found
- cmpl $127, %ebx
- ja not_found
- movb 12(%ebp), %bl
- movb %bl, val
- movl %eax, current
- movl $0, first
- del:
- movl current, %eax
- cmpl $0, %eax
- jne continue
- cmpl $0, %ecx
- je not_found
- movl first, %eax
- jmp end
- continue:
- movb (%eax), %bl
- cmpb val, %bl
- jne not_equal
- incl %ecx
- movl 4(%eax), %ebx
- movl previous, %eax
- movl %ebx, (%eax)
- movl %ebx, current
- jmp del
- not_equal:
- cmpl $0, %edi
- je first_time
- jmp n_time
- first_time:
- incl %edi
- movl %eax, first
- n_time:
- addl $4, %eax
- movl %eax, previous
- movl (%eax), %ebx
- movl %ebx, current
- jmp del
- null:
- movl $0, %eax
- jmp end
- not_found:
- movl 8(%ebp), %eax
- jmp end
- end:
- popl %ebx
- popl %edi
- movl %ebp, %esp
- popl %esp
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement