// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/Correct.cpp
// Function: ul_gap_filling_local(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_local(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, a_n = aln->n; uint64_t pqn, pk; overlap_region *z; //k_mer_hit *ch_a;
    count_k_hits_filter(ol, cl, buf, &(cl->chainDP));
    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);  
            for (pk = pqn; pk < aln->a[l].qn; pk++) ol->list[pk].w_list.n = 0;
            pqn = aln->a[l].qn+1;  
            cigar_gen_by_chain_adv_local(z, cl, aln->a+l, k-l, wl, uref, hpc_g, rref, qstr, tu, exz, aux_o, e_rate, ql, rid, khit);
            // ch_n = gen_cns_chain(z, cl, iidx, max_lgap, e_rate, 0);
            // 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 $0x68, %rsp
movq %xmm0, 0x60(%rsp)
movq %r9, 0x58(%rsp)
movq %r8, 0x50(%rsp)
movq %rcx, 0x48(%rsp)
movq %rdx, %r13
movq %rsi, %rbp
movq %rdi, %rbx
movq 0xc8(%rsp), %rdx
movq 0x8(%r13), %r14
leaq 0x18(%rsi), %rcx
callq 0x626a0
testq %r14, %r14
jle 0x79f79
movl $0x1, %r15d
xorl %esi, %esi
movdqa 0x1b750a(%rip), %xmm4   # 0x2312d0
movdqa 0x1b7512(%rip), %xmm5   # 0x2312e0
pcmpeqd %xmm6, %xmm6
xorl %eax, %eax
leaq (%rax,%rax,8), %rcx
leaq (%rcx,%rcx,2), %rcx
addq %rax, %rcx
movq (%r13), %rdx
movl (%rdx,%rcx), %r12d
cmpq %r14, %r15
je 0x79e01
leaq (%r15,%r15,8), %rdi
leaq (%rdi,%rdi,2), %rdi
addq %r15, %rdi
cmpl (%rdx,%rdi), %r12d
je 0x79f67
movq (%rbx), %rdi
imulq $0xa8, %r12, %r8
movl 0x28(%rdi,%r8), %r9d
cmpq %r9, %rax
jne 0x7a047
movq %r12, %r10
subq %rsi, %r10
jbe 0x79ec2
leaq 0x1(%r10), %r9
andq $-0x2, %r9
decq %r10
movq %r10, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
imulq $0xa8, %rsi, %rsi
addq %rdi, %rsi
addq $0xf0, %rsi
pxor %xmm5, %xmm0
xorl %r10d, %r10d
movq %r10, %xmm1
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
por %xmm4, %xmm1
pxor %xmm5, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm0, %xmm2
pcmpeqd %xmm0, %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, %r11d
notl %r11d
testb $0x1, %r11b
je 0x79e9b
movq $0x0, -0xa8(%rsi)
pxor %xmm6, %xmm1
pextrw $0x4, %xmm1, %r11d
testb $0x1, %r11b
je 0x79eb2
movq $0x0, (%rsi)
addq $0x2, %r10
addq $0x150, %rsi            # imm = 0x150
cmpq %r10, %r9
jne 0x79e52
addq %rcx, %rdx
addq %r8, %rdi
incl %r12d
movq %r15, %rcx
subq %rax, %rcx
movq 0xe8(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0xd8(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0xc0(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0xb8(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0xa8(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x58(%rsp), %rax
movq %rax, (%rsp)
movq %rbp, %rsi
movq 0x48(%rsp), %r8
movq 0x50(%rsp), %r9
movq 0x60(%rsp), %xmm0
callq 0x6a497
pcmpeqd %xmm6, %xmm6
movdqa 0x1b7387(%rip), %xmm5   # 0x2312e0
movdqa 0x1b736f(%rip), %xmm4   # 0x2312d0
movq %r15, %rax
movq %r12, %rsi
leaq 0x1(%r15), %rcx
cmpq %r14, %r15
movq %rcx, %r15
jne 0x79dd4
jmp 0x79f7b
xorl %esi, %esi
movq 0x10(%rbx), %rcx
subq %rsi, %rcx
jbe 0x7a038
movq (%rbx), %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, %rsi, %rcx
addq %rdx, %rcx
addq $0xf0, %rcx
xorl %edx, %edx
movdqa 0x1b7315(%rip), %xmm1   # 0x2312d0
movdqa 0x1b731d(%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 0x7a012
movq $0x0, -0xa8(%rcx)
pxor %xmm3, %xmm4
pextrw $0x4, %xmm4, %esi
testb $0x1, %sil
je 0x7a028
movq $0x0, (%rcx)
addq $0x2, %rdx
addq $0x150, %rcx            # imm = 0x150
cmpq %rdx, %rax
jne 0x79fcb
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1baa3a(%rip), %rdi    # 0x234a88
leaq 0x1b76fe(%rip), %rsi    # 0x231753
leaq 0x1bab43(%rip), %rcx    # 0x234b9f
movl $0x56a0, %edx           # imm = 0x56A0
callq 0x2110