// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Correct.cpp
// Function: update_ol_track(overlap_region_alloc*, Candidates_list*, hpc_t*, ul_idx_t const*, unsigned int, unsigned long, char*, kvec_t_u32_warp*)
uint64_t update_ol_track(overlap_region_alloc* ol, Candidates_list *cl, hpc_t *hpc_g, const ul_idx_t *udb, uint32_t apend_be, uint64_t qlen, 
char *qstr, kvec_t_u32_warp* q_idx)
{
    uint64_t cln = cl->length, i, k, l, m = 0; overlap_region *r; 
    if(hpc_g) {
        if(ol->length) {
            q_idx->a.n = 0; kv_resize(uint32_t, q_idx->a, qlen); m = 0;
            for (l = 0, k = 1; k <= qlen; k++) {
                if((k == qlen) || (qstr[k] != qstr[l]) || (seq_nt4_table[(uint8_t)qstr[l]] >= 4)) {
                    for (i = l; i < k; i++) q_idx->a.a[i] = m;
                    l = k; m++;
                }
            }
    
            for (i = k = 0; i < ol->length; ++i) {
                r = &(ol->list[i]); k = r->non_homopolymer_errors;
                update_ov_track_hpc_0(&(r->f_cigar), r, apend_be, m, q_idx->a.a, 
                (uint32_t)hpc_g->mm->idx[r->y_id], hpc_g->mm->a + (hpc_g->mm->idx[r->y_id]>>32), 
                hpc_g, cl->list+k, cln-k);
            }
        }
    } else {
        if(ol->length) {
            for (i = k = 0; i < ol->length; ++i) {
                r = &(ol->list[i]); k = r->non_homopolymer_errors;
                update_ov_track_0(&(r->f_cigar), r, apend_be, qlen, udb->ug->u.a[r->y_id].len, cl->list+k, cln-k);
            }
        }
    }
    return m;///hpc length
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r12
movl %r8d, %ebx
movq %rdi, %r14
movq %rsi, 0x18(%rsp)
movq 0x8(%rsi), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rdi), %rax
movq %rdx, 0x8(%rsp)
testq %rdx, %rdx
je 0x2a099
testq %rax, %rax
je 0x2a119
movq 0x68(%rsp), %rbp
andq $0x0, (%rbp)
cmpq %r12, 0x8(%rbp)
jae 0x29fcc
leaq -0x1(%r12), %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x1(%rcx), %rax
movq %rax, 0x8(%rbp)
movq 0x10(%rbp), %rdi
leaq 0x4(,%rcx,4), %rsi
callq 0x2370
movq %rax, 0x10(%rbp)
movq 0x60(%rsp), %rax
pushq $0x1
popq %rcx
xorl %esi, %esi
leaq 0x1c1b23(%rip), %rdx    # 0x1ebb00
xorl %r15d, %r15d
cmpq %r12, %rcx
ja 0x2a014
je 0x2a004
movzbl (%rax,%rcx), %edi
cmpb (%rax,%rsi), %dil
jne 0x2a004
cmpb $0x4, (%rdx,%rdi)
jae 0x2a004
jmp 0x2a00f
movq 0x10(%rbp), %rdi
movl %r15d, (%rdi,%rsi,4)
incq %rsi
cmpq %rcx, %rsi
jb 0x29ff9
incq %r15
movq %rcx, %rsi
incq %rcx
jmp 0x29fe0
movl %ebx, %eax
movq %rax, 0x20(%rsp)
pushq $0x38
popq %rbx
xorl %r13d, %r13d
movq 0x8(%rsp), %r12
cmpq 0x10(%r14), %r13
jae 0x2a11c
movq (%r14), %rdi
leaq (%rdi,%rbx), %rsi
addq $-0x38, %rsi
addq %rbx, %rdi
movl 0x10(%rsi), %eax
movl 0x30(%rsi), %r10d
movq 0x10(%rbp), %r8
movq 0x20(%r12), %rcx
movq 0x18(%rcx), %rdx
movq (%rdx,%rax,8), %rax
movl %eax, %r9d
shrq $0x20, %rax
addq 0x10(%rcx), %rax
movq 0x10(%rsp), %r11
subq %r10, %r11
shlq $0x4, %r10
movq 0x18(%rsp), %rcx
addq (%rcx), %r10
movq 0x20(%rsp), %rdx
movq %r15, %rcx
pushq %r11
pushq %r10
pushq %r12
pushq %rax
callq 0x29c09
addq $0x20, %rsp
incq %r13
addq $0xa8, %rbx
jmp 0x2a026
testq %rax, %rax
je 0x2a119
movq %rcx, %r13
movl %ebx, %edx
movq %rdx, 0x8(%rsp)
pushq $0x38
popq %rbx
xorl %r15d, %r15d
xorl %ebp, %ebp
cmpq %rax, %rbp
jae 0x2a11c
movq (%r14), %rdi
leaq (%rdi,%rbx), %rsi
addq $-0x38, %rsi
addq %rbx, %rdi
movl 0x10(%rsi), %eax
movl 0x30(%rsi), %r9d
movq (%r13), %rcx
movq 0x10(%rcx), %rcx
imulq $0x28, %rax, %rax
movl (%rcx,%rax), %r8d
andl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
movq 0x10(%rsp), %rax
subq %r9, %rax
shlq $0x4, %r9
movq 0x18(%rsp), %rcx
addq (%rcx), %r9
subq $0x8, %rsp
movq 0x10(%rsp), %rdx
movq %r12, %rcx
pushq %rax
callq 0x299bb
popq %rcx
popq %rdx
incq %rbp
movq 0x10(%r14), %rax
addq $0xa8, %rbx
jmp 0x2a0b0
xorl %r15d, %r15d
movq %r15, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq