// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Correct.cpp
// Function: ul_gap_filling_adv(overlap_region_alloc*, Candidates_list*, kv_ul_ov_t*, unsigned long, ul_idx_t const*, hpc_t*, All_reads*, char*, UC_Read*, bit_extz_t*, overlap_region*, asg64_v*, asg64_v*, double, long, unsigned long, long, long, long)
void ul_gap_filling_adv(overlap_region_alloc* ol, Candidates_list *cl, kv_ul_ov_t *aln, uint64_t wl, 
const ul_idx_t *uref, hpc_t *hpc_g, All_reads *rref, char* qstr, UC_Read *tu, bit_extz_t *exz, overlap_region *aux_o,  
asg64_v* buf, asg64_v* iidx, double e_rate, int64_t ql, uint64_t rid, int64_t khit, int64_t base_chekc_k_hit,
int64_t max_lgap)
{
    int64_t k, l, ch_n, a_n = aln->n; uint64_t pqn, pk; overlap_region *z; //k_mer_hit *ch_a;
    // count_k_hits(rref, uref, qstr, tu, ol, cl, buf, khit, base_chekc_k_hit);
    count_k_hits_adv(rref, uref, qstr, tu, ol, cl, buf, &(cl->chainDP), e_rate, khit, base_chekc_k_hit);
    // prt_khit(cl, ol, NULL, 109111, "e");
    for (k = 1, l = 0, pqn = 0; k <= a_n; k++) {
        if(k == a_n || aln->a[l].qn != aln->a[k].qn) {
            z = &(ol->list[aln->a[l].qn]); assert(z->align_length == l);  
            // fprintf(stderr, "[M::%s::] oid::[%lu, %u)\n", __func__, pqn, aln->a[l].qn);
            for (pk = pqn; pk < aln->a[l].qn; pk++) ol->list[pk].w_list.n = 0;
            pqn = aln->a[l].qn+1;  
            // fprintf(stderr, "[M::%s::utg%.6dl::%c]\n", __func__, (int32_t)z->y_id+1, "+-"[z->y_pos_strand]);
            // prt_khit(cl, ol, NULL, 109111, "f");
            ch_n = gen_cns_chain(ol, z, cl, iidx, max_lgap, e_rate, 0);
            // prt_khit(cl, ol, NULL, 109111, "g");
            if(ch_n) {
                cigar_gen_by_chain_adv(z, cl, cl->length, ch_n, aln->a+l, k-l, wl, uref, hpc_g, rref, qstr, tu, exz, aux_o, e_rate, ql, rid, khit);
            }
            l = k;
        }
    }
    for (pk = pqn; pk < ol->length; pk++) ol->list[pk].w_list.n = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, 0x20(%rsp)
movq %rcx, 0x10(%rsp)
movq %rsi, %r9
movq %rdi, %r12
movq 0x90(%rsp), %rcx
movq 0x80(%rsp), %rdi
movq %rdx, 0x8(%rsp)
movq 0x8(%rdx), %rbx
leaq 0x18(%rsi), %rax
movq %r8, 0x18(%rsp)
movq %r8, %rsi
movq %r12, %r8
movq %r9, 0x28(%rsp)
movsd %xmm0, (%rsp)
pushq 0xd0(%rsp)
pushq 0xd0(%rsp)
pushq %rax
pushq 0xc0(%rsp)
callq 0x322ec
addq $0x20, %rsp
xorl %esi, %esi
testq %rbx, %rbx
movl $0x0, %eax
movq %rbx, 0x30(%rsp)
cmovgq %rbx, %rax
incq %rax
movq %rax, 0x38(%rsp)
pushq $0x1
popq %r13
xorl %r15d, %r15d
movq 0x28(%rsp), %rbx
cmpq 0x38(%rsp), %r13
je 0x47387
imulq $0x1c, %rsi, %r14
movq 0x8(%rsp), %rax
movq (%rax), %rcx
movl (%rcx,%r14), %eax
cmpq 0x30(%rsp), %r13
je 0x47252
imulq $0x1c, %r13, %rdx
cmpl (%rcx,%rdx), %eax
je 0x4737f
movq %r12, %rbp
movq (%r12), %rcx
imulq $0xa8, %rax, %r12
movl 0x28(%rcx,%r12), %edx
cmpq %rdx, %rsi
jne 0x473c0
addq %rcx, %r12
imulq $0xa8, %r15, %rdx
addq %rdx, %rcx
addq $0x48, %rcx
movsd (%rsp), %xmm0
cmpq %rax, %r15
jae 0x47299
andq $0x0, (%rcx)
incq %r15
addq $0xa8, %rcx
jmp 0x47284
movq %rsi, 0x40(%rsp)
movl %eax, %r15d
incl %r15d
movq %r12, %rsi
movq %rbx, %rdx
movq 0xb0(%rsp), %rcx
movq 0xd8(%rsp), %r8
xorl %r9d, %r9d
callq 0x3177b
testq %rax, %rax
je 0x47379
movq 0x8(%rbx), %rdx
movq 0x8(%rsp), %rcx
addq (%rcx), %r14
movq %r13, %r9
subq 0x40(%rsp), %r9
subq $0x60, %rsp
movq 0x128(%rsp), %rcx
movq %rcx, 0x50(%rsp)
movq 0x118(%rsp), %rcx
movq %rcx, 0x40(%rsp)
movq 0x100(%rsp), %rcx
movq %rcx, 0x38(%rsp)
movq 0xf8(%rsp), %rcx
movq %rcx, 0x30(%rsp)
movq 0xf0(%rsp), %rcx
movq %rcx, 0x28(%rsp)
movq 0xe8(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movq 0xe0(%rsp), %rcx
movq %rcx, 0x18(%rsp)
movq 0x80(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq 0x78(%rsp), %rcx
movq %rcx, 0x8(%rsp)
movq 0x70(%rsp), %rcx
movq %rcx, (%rsp)
movq %r14, %r8
movq %r12, %rdi
movq %rbx, %rsi
movq %rax, %rcx
movsd 0x60(%rsp), %xmm0
callq 0x38436
addq $0x60, %rsp
movq %r13, %rsi
movq %rbp, %r12
incq %r13
jmp 0x47223
movq 0x10(%r12), %rax
imulq $0xa8, %r15, %rcx
addq $0x48, %rcx
cmpq %rax, %r15
jae 0x473b1
movq (%r12), %rdx
andq $0x0, (%rdx,%rcx)
incq %r15
addq $0xa8, %rcx
jmp 0x47397
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x19f611(%rip), %rdi    # 0x1e69d8
leaq 0x19c2d5(%rip), %rsi    # 0x1e36a3
leaq 0x19f618(%rip), %rcx    # 0x1e69ed
movl $0x5686, %edx           # imm = 0x5686
callq 0x2110