// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/Assembly.cpp
// Function: ha_print_ovlp_stat(ma_hit_t_alloc*, ma_hit_t_alloc*, long long)
void ha_print_ovlp_stat(ma_hit_t_alloc* paf, ma_hit_t_alloc* rev_paf, long long readNum)
{
	long long forward, reverse, strong, weak, exact, no_l_indel;
	long long i, j;

	no_l_indel = forward = reverse = exact = strong = weak = 0;
	for (i = 0; i < readNum; i++) {
		forward += paf[i].length;
		reverse += rev_paf[i].length;
		for (j = 0; j < paf[i].length; j++) {
			if (paf[i].buffer[j].el == 1) exact++;
			if (paf[i].buffer[j].ml == 1) strong++;
			if (paf[i].buffer[j].ml == 0) weak++;
			if (paf[i].buffer[j].no_l_indel == 1) no_l_indel++;
		}
	}
	fprintf(stderr, "[M::%s] # overlaps: %lld\n", __func__, forward);
	fprintf(stderr, "[M::%s] # strong overlaps: %lld\n", __func__, strong);
	fprintf(stderr, "[M::%s] # weak overlaps: %lld\n", __func__, weak);
	fprintf(stderr, "[M::%s] # exact overlaps: %lld\n", __func__, exact); // this seems not right
	fprintf(stderr, "[M::%s] # inexact overlaps: %lld\n", __func__, forward - exact);
	fprintf(stderr, "[M::%s] # overlaps without large indels: %lld\n", __func__, no_l_indel);
	fprintf(stderr, "[M::%s] # reverse overlaps: %lld\n", __func__, reverse);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rdx, %rdx
jle 0x3b7f
pxor %xmm0, %xmm0
xorl %eax, %eax
movdqa 0x22d106(%rip), %xmm1   # 0x230bf0
movdqa 0x22d10e(%rip), %xmm2   # 0x230c00
xorl %r15d, %r15d
xorl %r12d, %r12d
xorl %ebx, %ebx
xorl %r14d, %r14d
imulq $0x18, %rax, %rcx
movl 0xc(%rdi,%rcx), %r8d
testq %r8, %r8
je 0x3b5a
leaq (%rdi,%rcx), %r9
movq (%r9), %r9
imulq $0x28, %r8, %r10
xorl %r11d, %r11d
movl 0x18(%r9,%r11), %r13d
shrl $0x1e, %r13d
andl $0x1, %r13d
addq %r13, %r12
xorq $0x1, %r13
addq %r13, %r15
movq 0x20(%r9,%r11), %xmm3
pcmpeqb %xmm1, %xmm3
punpcklbw %xmm3, %xmm3    # xmm3 = xmm3[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
pshuflw $0xd4, %xmm3, %xmm3     # xmm3 = xmm3[0,1,1,3,4,5,6,7]
pshufd $0xd4, %xmm3, %xmm3     # xmm3 = xmm3[0,1,1,3]
pand %xmm2, %xmm3
paddq %xmm3, %xmm0
addq $0x28, %r11
cmpq %r11, %r10
jne 0x3b19
addq %r8, %r14
movl 0xc(%rsi,%rcx), %ecx
addq %rcx, %rbx
incq %rax
cmpq %rdx, %rax
jne 0x3afd
pshufd $0xee, %xmm0, %xmm1     # xmm1 = xmm0[2,3,2,3]
movq %xmm1, 0x10(%rsp)
movq %xmm0, 0x8(%rsp)
jmp 0x3b9c
xorl %r14d, %r14d
xorl %ebx, %ebx
xorl %r12d, %r12d
xorl %r15d, %r15d
movq $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movq 0x29143d(%rip), %r13    # 0x294fe0
movq (%r13), %rdi
leaq 0x22d194(%rip), %rsi    # 0x230d42
leaq 0x22d1a7(%rip), %rbp    # 0x230d5c
movq %rbp, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x22b0
movq (%r13), %rdi
leaq 0x22d1a2(%rip), %rsi    # 0x230d6f
movq %rbp, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x22b0
movq (%r13), %rdi
leaq 0x22d1ab(%rip), %rsi    # 0x230d90
movq %rbp, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x22b0
movq (%r13), %rdi
leaq 0x22d1b2(%rip), %rsi    # 0x230daf
movq %rbp, %rdx
movq 0x8(%rsp), %r15
movq %r15, %rcx
xorl %eax, %eax
callq 0x22b0
movq (%r13), %rdi
subq %r15, %r14
leaq 0x22d1b2(%rip), %rsi    # 0x230dcf
movq %rbp, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x22b0
movq (%r13), %rdi
leaq 0x22d1bc(%rip), %rsi    # 0x230df1
movq %rbp, %rdx
movq 0x10(%rsp), %rcx
xorl %eax, %eax
callq 0x22b0
movq (%r13), %rdi
leaq 0x22d1d1(%rip), %rsi    # 0x230e20
movq %rbp, %rdx
movq %rbx, %rcx
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x22b0