Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- occurences:
- .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
- .text
- .type check_tab, @function
- .global check_tab
- #tab->n->max
- check_tab:
- XOR %rbx, %rbx
- XOR %rax, %rax
- XOR %r8, %r8
- XOR %r9, %r9
- XOR %rcx, %rcx
- MOV $0, %ecx
- clear:
- MOV $0, occurences(, %ecx, 4)
- INC %ecx
- CMP $64, %ecx
- JNE clear
- XOR %ecx, %ecx
- MOV %rdi, %r9
- loop:
- CMP $0, %rsi
- JE afterLoop
- CMPB $0, (%rdi)
- JL afterHashing
- CMPB $63, (%rdi)
- JG afterHashing
- MOV (%rdi), %eax
- MOV occurences(, %eax, 4), %ebx
- INC %ebx
- MOV %ebx, occurences(, %eax, 4)
- afterHashing:
- ADD $4, %rdi
- DEC %rsi
- JMP loop
- afterLoop:
- MOV $63, %ecx
- XOR %rax, %rax
- XOR %rbx, %rbx
- MOV $0, %rbx
- loop2:
- XOR %r8, %r8
- MOV occurences(, %ecx, 4), %r8
- CMP %r8, %rbx
- JB swapMax
- afterSwap:
- SHL $1, %rax
- CMP $0, %r8
- JE noOccurences
- ADD $1, %rax
- afterModifing:
- DEC %ecx
- CMP $0, %ecx
- JGE loop2
- MOV %rbx, (%rdx)
- MOV %r9, %rdi
- RET
- swapMax:
- MOV %r8, %rbx
- JMP afterSwap
- noOccurences:
- ADD $0, %rax
- JMP afterModifing
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement