// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Assembly.cpp
// Function: ha_overlap_cal(int, int)
void ha_overlap_cal(int round, int read_from_store)
{
	int i, hom_cov, het_cov;
	ha_ovec_buf_t **b;
    ha_flt_tab_hp = ha_idx_hp = NULL;

	// overlap and correct reads
	CALLOC(b, asm_opt.thread_num);
	for (i = 0; i < asm_opt.thread_num; ++i)
		b[i] = ha_ovec_init(0, (round == asm_opt.number_of_round - 1),0);
    if(ha_idx) hom_cov = asm_opt.hom_cov;
	if(ha_idx == NULL) ha_idx = ha_pt_gen(&asm_opt, ha_flt_tab, ((round == 0)&&(read_from_store == 0))?0:1, 0, &R_INF, &hom_cov, &het_cov); // build the index
	///debug_adapter(&asm_opt, &R_INF);
    if (/**round == 0 &&**/ ha_flt_tab == 0) // then asm_opt.hom_cov hasn't been updated
		ha_opt_update_cov(&asm_opt, hom_cov);
    het_cnt = NULL;
    if(round == asm_opt.number_of_round-1 && asm_opt.is_dbg_het_cnt) CALLOC(het_cnt, R_INF.total_reads);
    // fprintf(stderr, "[M::%s-start]\n", __func__);
	kt_for(asm_opt.thread_num, worker_ovec_cal0, b, R_INF.total_reads);///debug_for_fix
    // fprintf(stderr, "[M::%s-end]\n", __func__);

	ha_pt_destroy(ha_idx);
	ha_idx = NULL;

    if(het_cnt) {
        print_het_cnt_log(het_cnt); free(het_cnt); het_cnt = NULL;
    }

	// collect statistics
	for (i = 0; i < asm_opt.thread_num; ++i) {
		asm_opt.num_bases += b[i]->num_read_base;
		asm_opt.num_corrected_bases += b[i]->num_correct_base;
		asm_opt.num_recorrected_bases += b[i]->num_recorrect_base;
		asm_opt.mem_buf += ha_ovec_mem(b[i], NULL);
		ha_ovec_destroy(b[i]);
	}
	free(b);
    asm_opt.hom_cov = hom_cov;
    asm_opt.het_cov = het_cov;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %r14d
leaq 0x246504(%rip), %rax    # 0x254448
andq $0x0, (%rax)
leaq 0x2464f1(%rip), %rax    # 0x254440
andq $0x0, (%rax)
movl %edi, %ebp
leaq 0x2457fc(%rip), %r15    # 0x253758
movl 0x7c(%r15), %r13d
movslq %r13d, %rdi
pushq $0x8
popq %rsi
callq 0x2120
movq %rax, %rbx
xorl %r12d, %r12d
movslq %r13d, %rax
cmpq %rax, %r12
jge 0xdfa0
movl 0xf8(%r15), %eax
decl %eax
xorl %esi, %esi
cmpl %ebp, %eax
sete %sil
xorl %edi, %edi
xorl %edx, %edx
callq 0xc44b
movq %rax, (%rbx,%r12,8)
incq %r12
movl 0x7c(%r15), %r13d
jmp 0xdf71
leaq 0x246491(%rip), %r12    # 0x254438
cmpq $0x0, (%r12)
je 0xdfbb
movl 0xd0(%r15), %eax
movl %eax, 0x10(%rsp)
jmp 0xdff4
leaq 0x24646e(%rip), %rax    # 0x254430
movq (%rax), %rsi
xorl %edx, %edx
orl %ebp, %r14d
setne %dl
leaq 0x14(%rsp), %rax
movq %rax, (%rsp)
leaq 0x24577b(%rip), %rdi    # 0x253758
leaq 0x24624c(%rip), %r8     # 0x254230
leaq 0x10(%rsp), %r9
xorl %ecx, %ecx
callq 0xd6a80
movq %rax, (%r12)
leaq 0x246435(%rip), %rax    # 0x254430
cmpq $0x0, (%rax)
jne 0xe011
movl 0x10(%rsp), %esi
leaq 0x24574c(%rip), %rdi    # 0x253758
callq 0x3430
andq $0x0, 0x2463cf(%rip)    # 0x2543e8
movl 0xf8(%r15), %eax
decl %eax
movq 0x246257(%rip), %r14    # 0x254280
cmpl %ebp, %eax
jne 0xe049
cmpb $0x0, 0x248(%r15)
je 0xe049
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x2120
movq %rax, 0x24639f(%rip)    # 0x2543e8
movl 0x7c(%r15), %edi
leaq 0xbf(%rip), %rsi        # 0xe113
movq %rbx, %rdx
movq %r14, %rcx
callq 0xc67c0
movq (%r12), %rdi
callq 0xd4d2f
andq $0x0, (%r12)
movq 0x246374(%rip), %rdi    # 0x2543e8
testq %rdi, %rdi
je 0xe092
callq 0xd58f
movq 0x246363(%rip), %rdi    # 0x2543e8
callq 0x2220
andq $0x0, 0x246356(%rip)    # 0x2543e8
xorl %r14d, %r14d
movslq 0x7c(%r15), %rax
cmpq %rax, %r14
jge 0xe0e6
movq (%rbx,%r14,8), %rdi
movdqu 0x190(%r15), %xmm0
paddq 0xf0(%rdi), %xmm0
movdqu %xmm0, 0x190(%r15)
movq 0x100(%rdi), %rax
addq %rax, 0x1a0(%r15)
xorl %esi, %esi
callq 0xc6d6
addq %rax, 0x1a8(%r15)
movq (%rbx,%r14,8), %rdi
callq 0xc5d1
incq %r14
jmp 0xe095
movq %rbx, %rdi
callq 0x2220
movl 0x10(%rsp), %eax
movl %eax, 0xd0(%r15)
movl 0x14(%rsp), %eax
movl %eax, 0xd4(%r15)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq