// File: /workspace/github_cpp_makefile_star2_O3/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, %r12
movq 0x90(%rsp), %rcx
movq 0x80(%rsp), %rdi
movq %rdx, 0x20(%rsp)
movq 0x8(%rdx), %r15
leaq 0x18(%rsi), %rax
movq %r8, 0x30(%rsp)
movq %r8, %rsi
movq %r12, %r8
movq %rbx, %r9
movq %xmm0, 0x8(%rsp)
pushq 0xd0(%rsp)
pushq 0xd0(%rsp)
pushq %rax
pushq 0xc0(%rsp)
callq 0x62922
addq $0x20, %rsp
testq %r15, %r15
jle 0x79c7d
movq %rbx, 0x40(%rsp)
movl $0x1, %ebx
xorl %ebp, %ebp
movdqa 0x1b7888(%rip), %xmm5   # 0x2312d0
movdqa 0x1b7890(%rip), %xmm6   # 0x2312e0
pcmpeqd %xmm7, %xmm7
xorl %r13d, %r13d
movq 0x8(%rsp), %xmm0
movq %r12, 0x18(%rsp)
movq %r15, 0x10(%rsp)
leaq (,%r13,8), %rax
addq %r13, %rax
leaq (%rax,%rax,2), %r14
addq %r13, %r14
movq 0x20(%rsp), %rax
movq (%rax), %rcx
movl (%rcx,%r14), %eax
cmpq %r15, %rbx
je 0x79a9e
leaq (%rbx,%rbx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rbx, %rdx
cmpl (%rcx,%rdx), %eax
je 0x79c6b
movq (%r12), %r12
imulq $0xa8, %rax, %rcx
movl 0x28(%r12,%rcx), %edx
cmpq %rdx, %r13
jne 0x79d4d
movq %rax, %rsi
subq %rbp, %rsi
jbe 0x79b5f
leaq 0x1(%rsi), %rdx
andq $-0x2, %rdx
decq %rsi
movq %rsi, %xmm1
pshufd $0x44, %xmm1, %xmm4     # xmm4 = xmm1[0,1,0,1]
imulq $0xa8, %rbp, %rsi
addq %r12, %rsi
addq $0xf0, %rsi
pxor %xmm6, %xmm4
xorl %edi, %edi
movq %rdi, %xmm1
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
por %xmm5, %xmm1
pxor %xmm6, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm4, %xmm2
pcmpeqd %xmm4, %xmm1
pshufd $0xf5, %xmm1, %xmm3     # xmm3 = xmm1[1,1,3,3]
pand %xmm2, %xmm3
pshufd $0xf5, %xmm2, %xmm1     # xmm1 = xmm2[1,1,3,3]
por %xmm3, %xmm1
movd %xmm1, %r8d
notl %r8d
testb $0x1, %r8b
je 0x79b38
movq $0x0, -0xa8(%rsi)
pxor %xmm7, %xmm1
pextrw $0x4, %xmm1, %r8d
testb $0x1, %r8b
je 0x79b4f
movq $0x0, (%rsi)
addq $0x2, %rdi
addq $0x150, %rsi            # imm = 0x150
cmpq %rdi, %rdx
jne 0x79aef
addq %rcx, %r12
movl %eax, %ebp
incl %ebp
movq %r12, %rsi
movq 0x40(%rsp), %r15
movq %r15, %rdx
movq 0xb0(%rsp), %rcx
movq 0xd8(%rsp), %r8
xorl %r9d, %r9d
callq 0x61c66
testq %rax, %rax
je 0x79c44
movq 0x8(%r15), %rdx
movq 0x20(%rsp), %rcx
addq (%rcx), %r14
movq %rbx, %r9
subq %r13, %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 %r14, %r8
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rcx
movq 0x68(%rsp), %xmm0
callq 0x698c8
addq $0x60, %rsp
movq %rbx, %r13
movq 0x18(%rsp), %r12
movq 0x8(%rsp), %xmm0
movq 0x10(%rsp), %r15
movdqa 0x1b7671(%rip), %xmm5   # 0x2312d0
movdqa 0x1b7679(%rip), %xmm6   # 0x2312e0
pcmpeqd %xmm7, %xmm7
leaq 0x1(%rbx), %rax
cmpq %r15, %rbx
movq %rax, %rbx
jne 0x79a67
jmp 0x79c7f
xorl %ebp, %ebp
movq 0x10(%r12), %rcx
subq %rbp, %rcx
jbe 0x79d3e
movq (%r12), %rdx
leaq 0x1(%rcx), %rax
andq $-0x2, %rax
decq %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
imulq $0xa8, %rbp, %rcx
addq %rdx, %rcx
addq $0xf0, %rcx
xorl %edx, %edx
movdqa 0x1b760f(%rip), %xmm1   # 0x2312d0
movdqa 0x1b7617(%rip), %xmm2   # 0x2312e0
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movq %rdx, %xmm4
pshufd $0x44, %xmm4, %xmm4     # xmm4 = xmm4[0,1,0,1]
por %xmm1, %xmm4
pxor %xmm2, %xmm4
movdqa %xmm4, %xmm5
pcmpgtd %xmm0, %xmm5
pcmpeqd %xmm0, %xmm4
pshufd $0xf5, %xmm4, %xmm6     # xmm6 = xmm4[1,1,3,3]
pand %xmm5, %xmm6
pshufd $0xf5, %xmm5, %xmm4     # xmm4 = xmm5[1,1,3,3]
por %xmm6, %xmm4
movd %xmm4, %esi
notl %esi
testb $0x1, %sil
je 0x79d18
movq $0x0, -0xa8(%rcx)
pxor %xmm3, %xmm4
pextrw $0x4, %xmm4, %esi
testb $0x1, %sil
je 0x79d2e
movq $0x0, (%rcx)
addq $0x2, %rdx
addq $0x150, %rcx            # imm = 0x150
cmpq %rdx, %rax
jne 0x79cd1
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1bad34(%rip), %rdi    # 0x234a88
leaq 0x1b79f8(%rip), %rsi    # 0x231753
leaq 0x1bad3b(%rip), %rcx    # 0x234a9d
movl $0x5686, %edx           # imm = 0x5686
callq 0x2110