.psize
.intel_syntax noprefix
.text
.globl HailLstCnt
.ALIGN 16
HailLstCnt:
xor ecx, ecx
mov r8, rdi
mov r9, rsi
dec ecx
jmp dummy
.ALIGN 16
top:
mov rdi, rax
mov rsi, rdx
.ALIGN 8
dummy:
test rdi, 2
mov rax, rdi
mov rdx, rsi
jz bit1_clear
shr rsi, 1
rcr rdi, 1
adc rax, rdi
adc rdx, rsi
jmp done
.ALIGN 16
bit1_clear:
mov r10, rdi
and edi, 7
shr rsi, 1
rcr r10, 1
cmp edi, 5
je type_3
stc
adc rax, r10
adc rdx, rsi
shr rdx, 1
rcr rax, 1
jmp done
.ALIGN 8
type_3:
mov rdi, r10
shr rsi, 1
rcr rdi, 1
jmp dummy
.ALIGN 16
done:
inc ecx
cmp r9, rdx
ja over
jb top
cmp r8, rax
jb top
.ALIGN 8
over:
mov eax, ecx
ret
.end