// File: /workspace/github_cpp_makefile_star2_O1/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 $0x18, %rsp
movq %r9, %r13
movq %rdx, %rbx
movq %rsi, %rdx
movq %rdi, %r14
movq 0x8(%rsi), %r12
movq 0x10(%rdi), %rax
testq %rbx, %rbx
je 0x59fab
testq %rax, %rax
je 0x5a059
movq %rdx, 0x8(%rsp)
movq 0x58(%rsp), %rbp
movq $0x0, (%rbp)
cmpq %r13, 0x8(%rbp)
jae 0x59f3c
leaq -0x1(%r13), %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
movl %r8d, %r15d
callq 0x2370
movl %r15d, %r8d
movq %rax, 0x10(%rbp)
testq %r13, %r13
je 0x5a061
movq 0x50(%rsp), %rax
leaq 0x1(%r13), %rdx
cmpq $0x3, %rdx
movl $0x2, %ecx
cmovaeq %rdx, %rcx
movl $0x1, %edx
xorl %r15d, %r15d
leaq 0x1d3aa6(%rip), %rsi    # 0x22da10
xorl %edi, %edi
cmpq %r13, %rdx
je 0x59f83
movzbl (%rax,%rdi), %r9d
cmpb %r9b, (%rax,%rdx)
jne 0x59f83
cmpb $0x4, (%rsi,%r9)
jb 0x59f9e
cmpq %rdx, %rdi
jae 0x59f98
movq 0x10(%rbp), %r9
movl %r15d, (%r9,%rdi,4)
incq %rdi
cmpq %rdi, %rdx
jne 0x59f8c
incq %r15
movq %rdx, %rdi
incq %rdx
cmpq %rcx, %rdx
jne 0x59f6c
jmp 0x5a064
testq %rax, %rax
je 0x5a059
cmpq $0x0, 0x10(%r14)
je 0x5a059
movl %r8d, %eax
movq %rax, 0x10(%rsp)
movl $0x38, %ebx
xorl %r15d, %r15d
xorl %ebp, %ebp
movq %r14, (%rsp)
movq %r13, 0x8(%rsp)
movq (%rsp), %rax
movq (%rax), %rdi
leaq (%rdi,%rbx), %rsi
addq $-0x38, %rsi
addq %rbx, %rdi
movl 0x10(%rsi), %eax
movl 0x30(%rsi), %r9d
movq %rcx, %r14
movq (%rcx), %rcx
movq 0x10(%rcx), %rcx
leaq (%rax,%rax,4), %rax
movl (%rcx,%rax,8), %r8d
andl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
movq %r12, %rax
subq %r9, %rax
shlq $0x4, %r9
addq (%rdx), %r9
subq $0x8, %rsp
movq %r12, %r13
movq %rdx, %r12
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %rcx
pushq %rax
callq 0x59874
movq %r14, %rcx
movq %r12, %rdx
movq %r13, %r12
addq $0x10, %rsp
incq %rbp
addq $0xa8, %rbx
movq (%rsp), %rax
cmpq 0x10(%rax), %rbp
jb 0x59fda
jmp 0x5a0fa
xorl %r15d, %r15d
jmp 0x5a0fa
xorl %r15d, %r15d
cmpq $0x0, 0x10(%r14)
je 0x5a0fa
movl %r8d, %eax
movq %rax, (%rsp)
movl $0x38, %ebp
movq %r14, %r13
movq %rbx, %r14
xorl %ebx, %ebx
movq %r12, 0x10(%rsp)
movq 0x8(%rsp), %r12
movq (%r13), %rdi
leaq (%rdi,%rbp), %rsi
addq $-0x38, %rsi
addq %rbp, %rdi
movl 0x10(%rsi), %eax
movl 0x30(%rsi), %r10d
movq 0x58(%rsp), %rcx
movq 0x10(%rcx), %r8
movq 0x20(%r14), %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
addq (%r12), %r10
movq (%rsp), %rdx
movq %r15, %rcx
pushq %r11
pushq %r10
pushq %r14
pushq %rax
callq 0x59b25
addq $0x20, %rsp
incq %rbx
addq $0xa8, %rbp
cmpq 0x10(%r13), %rbx
jb 0x5a08d
movq %r15, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq