// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/ecovlp.cpp
// Function: worker_hap_dc_ec_gen_new_idx(void*, long, int)
static void worker_hap_dc_ec_gen_new_idx(void *data, long i, int tid)
{
    
    ec_ovec_buf_t0 *b = &(((ec_ovec_buf_t*)data)->a[tid]);
    uint32_t high_occ = asm_opt.hom_cov * (2.0 - HA_KMER_GOOD_RATIO);
    uint32_t low_occ = asm_opt.hom_cov * HA_KMER_GOOD_RATIO; uint32_t qlen = 0;

    recover_UC_Read(&b->self_read, &R_INF, i); qlen = b->self_read.length; 

    h_ec_lchain(b->ab, i, b->self_read.seq, b->self_read.length, asm_opt.mz_win, asm_opt.k_mer_length, &R_INF, &b->olist, &b->clist, /**0.02**/0.001, asm_opt.max_n_chain, 1, NULL, NULL, &(b->sp), &high_occ, &low_occ, 1, 1, 3, 0.7, 2, 32, COV_W);

    overlap_region_sort_y_id(b->olist.list, b->olist.length);

    // overlap_region_sort_y_id(b->olist.list, b->olist.length);
	// ma_hit_sort_tn(R_INF.paf[i].buffer, R_INF.paf[i].length);
	// ma_hit_sort_tn(R_INF.reverse_paf[i].buffer, R_INF.reverse_paf[i].length);

    // R_INF.paf[i].is_fully_corrected = is_well_cal(&b->v64, &(R_INF.paf[i]), &(R_INF.reverse_paf[i]), b->self_read.length, 4);

    // R_INF.paf[i].is_abnormal = abnormal;
    // R_INF.trio_flag[i] = AMBIGU;

    h_ec_lchain_fast_new(b->ab, i, &b->self_read, &b->ovlp_read, &R_INF, &b->olist, &b->clist, &b->exz, &b->v16, &b->v64, &(R_INF.paf[i]), &(R_INF.reverse_paf[i]), 0.866666);

    if((asm_opt.is_ont) && (is_uncorrected_read(&b->olist, &b->v64, qlen, 1600))) {
        b->olist.length = 0;
        // fprintf(stderr, "[M::%s] rid::%ld\t%.*s\n", __func__, i, (int)Get_NAME_LENGTH(R_INF, i), Get_NAME(R_INF, i));
    }

    push_ff_ovlp(&(R_INF.paf[i]), &b->olist, 1, &R_INF, b->cnt);
    push_ff_ovlp(&(R_INF.reverse_paf[i]), &b->olist, 2, &R_INF, b->cnt);

    /**
    copy_asg_arr(buf0, b->sp);
    if(gen_hap_dc_cov(&(b->v64), &buf0, &(R_INF.paf[i]), &R_INF, WINDOW_HC_FAST, 4, 0.7, &b->self_read, &b->ovlp_read, &scc, i)) {
        scc.f[i] = 1; b->num_read_base++;
        // fprintf(stderr, "-mm-[M::%s]\tqn::%u::%.*s\n", __func__, (uint32_t)(i), (int)Get_NAME_LENGTH(R_INF, i), Get_NAME((R_INF), i));
    } else {
        scc.f[i] = 0; b->num_correct_base++;
        // fprintf(stderr, "-um-[M::%s]\tqn::%u::%.*s\n", __func__, (uint32_t)(i), (int)Get_NAME_LENGTH(R_INF, i), Get_NAME((R_INF), i));
    }
    copy_asg_arr(b->sp, buf0);
    **/
   refresh_ec_ovec_buf_t0(b, REFRESH_N);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r12
movq (%rdi), %r13
movslq %edx, %rax
imulq $0x5c0, %rax, %rbp      # imm = 0x5C0
movq %r13, %rdi
addq %rbp, %rdi
movq %rdi, 0x90(%rsp)
leaq 0x106de4(%rip), %rbx    # 0x253758
cvtsi2sdl 0xd0(%rbx), %xmm0
movsd 0xa010c(%rip), %xmm1    # 0x1eca90
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
leaq 0x84(%rsp), %rcx
movl %eax, (%rcx)
mulsd 0x9ec21(%rip), %xmm0    # 0x1eb5c0
cvttsd2si %xmm0, %rax
leaq 0x80(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x10787b(%rip), %r14    # 0x254230
movq %r14, %rsi
movq %r12, %rdx
callq 0x715e
leaq 0x98(,%rbp), %r15
addq %r13, %r15
movq -0x98(%r15), %rdx
movq -0x90(%r15), %rcx
movq 0x20(%r15), %rdi
movq %rbx, %rax
movslq 0x94(%rbx), %r8
movslq 0x80(%rbx), %r9
leaq 0x40(%r13,%rbp), %rbx
movl 0xe8(%rax), %eax
leaq 0x568(%r13,%rbp), %r10
pushq $0x1
popq %rsi
movl %esi, 0x58(%rsp)
movl %esi, 0x50(%rsp)
leaq 0x80(%rsp), %r11
movq %r11, 0x48(%rsp)
leaq 0x84(%rsp), %r11
movq %r11, 0x40(%rsp)
movq %r10, 0x38(%rsp)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x28(%rsp)
movl %esi, 0x20(%rsp)
movl %eax, 0x18(%rsp)
movq %rbx, 0x10(%rsp)
movq %r15, 0x8(%rsp)
movq %r14, (%rsp)
movq $0xc00, 0x78(%rsp)      # imm = 0xC00
movl $0x20, 0x70(%rsp)
movl $0x2, 0x68(%rsp)
movq $0x3, 0x60(%rsp)
movsd 0x96183(%rip), %xmm0    # 0x1e2bf8
movsd 0x96a73(%rip), %xmm1    # 0x1e34f0
movl %r12d, %esi
movq %rcx, 0x88(%rsp)
callq 0xea30c
movq 0x58(%rbx), %rdi
movq 0x68(%rbx), %rsi
movq 0x90(%rsp), %rbx
callq 0x1188f
leaq 0x20(,%rbp), %rcx
addq %r13, %rcx
leaq 0x3e0(,%rbp), %rax
addq %r13, %rax
addq %rbp, %r13
addq $0x4d0, %r13            # imm = 0x4D0
imulq $0x18, %r12, %rbp
movq 0x78(%r14), %rdx
addq %rbp, %rdx
movq 0x80(%r14), %rsi
addq %rbp, %rsi
movq %rsi, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movq %r13, 0x18(%rsp)
movq %rax, 0x8(%rsp)
movsd 0xa33ad(%rip), %xmm0    # 0x1efea0
movl %r12d, %esi
movq %rbx, %rdx
movq %r14, %r8
movq %r15, %r9
callq 0x14931a
leaq 0x106c4d(%rip), %rax    # 0x253758
cmpq $0x0, 0x2a8(%rax)
je 0x14cb38
movl 0x88(%rsp), %edx
movl $0x640, %ecx            # imm = 0x640
movq %r15, %rdi
movq %r13, %rsi
callq 0x1448c4
testl %eax, %eax
je 0x14cb38
andq $0x0, 0xa8(%rbx)
movq 0x78(%r14), %rdi
addq %rbp, %rdi
leaq 0xc0(%rbx), %r12
pushq $0x1
popq %rdx
movq %r15, %rsi
movq %r14, %rcx
movq %r12, %r8
callq 0x14341f
addq 0x80(%r14), %rbp
pushq $0x2
popq %rdx
movq %rbp, %rdi
movq %r15, %rsi
movq %r14, %rcx
movq %r12, %r8
callq 0x14341f
movl $0x80, %esi
movq %rbx, %rdi
callq 0x14f9cd
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq