// File: /workspace/github_cpp_makefile_star2_O1/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, 0x38(%rsp)
movq %rcx, 0x28(%rsp)
movq %rsi, %rbx
movq %rdi, %r14
movq 0x90(%rsp), %rcx
movq 0x80(%rsp), %rdi
movq %rdx, 0x10(%rsp)
movq 0x8(%rdx), %r13
leaq 0x18(%rsi), %rax
movq %r8, 0x30(%rsp)
movq %r8, %rsi
movq %r14, %r8
movq %rbx, %r9
movsd %xmm0, 0x8(%rsp)
pushq 0xd0(%rsp)
pushq 0xd0(%rsp)
pushq %rax
pushq 0xc0(%rsp)
callq 0x62df6
addq $0x20, %rsp
testq %r13, %r13
jle 0x7a140
movq %rbx, 0x40(%rsp)
movl $0x1, %ebx
xorl %esi, %esi
xorl %ebp, %ebp
movsd 0x8(%rsp), %xmm0
movq %r13, 0x18(%rsp)
cmpq %r13, %rbx
je 0x79fce
movq 0x10(%rsp), %rax
movq (%rax), %rax
leaq (,%rbp,8), %rcx
addq %rbp, %rcx
leaq (%rcx,%rcx,2), %rcx
addq %rbp, %rcx
movl (%rax,%rcx), %ecx
leaq (%rbx,%rbx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rbx, %rdx
cmpl (%rax,%rdx), %ecx
je 0x7a12e
movq %r14, %r15
movq (%r14), %r14
movq 0x10(%rsp), %rax
movq (%rax), %rax
leaq (,%rbp,8), %rcx
addq %rbp, %rcx
leaq (%rcx,%rcx,2), %r12
addq %rbp, %r12
movl (%rax,%r12), %eax
imulq $0xa8, %rax, %rcx
movl 0x28(%r14,%rcx), %edx
cmpq %rdx, %rbp
jne 0x7a17e
movq %rax, %rdx
subq %rsi, %rdx
jbe 0x7a030
imulq $0xa8, %rsi, %rsi
addq %r14, %rsi
addq $0x48, %rsi
movq $0x0, (%rsi)
addq $0xa8, %rsi
decq %rdx
jne 0x7a01d
addq %rcx, %r14
incl %eax
movq %rax, 0x20(%rsp)
movq %r14, %rsi
movq 0x40(%rsp), %r13
movq %r13, %rdx
movq 0xb0(%rsp), %rcx
movq 0xd8(%rsp), %r8
xorl %r9d, %r9d
callq 0x6217f
testq %rax, %rax
je 0x7a118
movq 0x8(%r13), %rdx
movq 0x10(%rsp), %rcx
addq (%rcx), %r12
movq %rbx, %r9
subq %rbp, %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 0x98(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq 0x90(%rsp), %rcx
movq %rcx, 0x8(%rsp)
movq 0x88(%rsp), %rcx
movq %rcx, (%rsp)
movq %r12, %r8
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rcx
movsd 0x68(%rsp), %xmm0
callq 0x69c19
addq $0x60, %rsp
movq %rbx, %rbp
movq %r15, %r14
movsd 0x8(%rsp), %xmm0
movq 0x18(%rsp), %r13
movq 0x20(%rsp), %rsi
leaq 0x1(%rbx), %rax
cmpq %r13, %rbx
movq %rax, %rbx
jne 0x79f98
jmp 0x7a142
xorl %esi, %esi
movq 0x10(%r14), %rax
subq %rsi, %rax
jbe 0x7a16f
movq (%r14), %rcx
imulq $0xa8, %rsi, %rdx
addq %rdx, %rcx
addq $0x48, %rcx
movq $0x0, (%rcx)
addq $0xa8, %rcx
decq %rax
jne 0x7a15c
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1ae7f3(%rip), %rdi    # 0x228978
leaq 0x1ab4b7(%rip), %rsi    # 0x225643
leaq 0x1ae7fa(%rip), %rcx    # 0x22898d
movl $0x5686, %edx           # imm = 0x5686
callq 0x2110