// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Correct.cpp
// Function: verify_aln(int, overlap_region*, UC_Read*, UC_Read*, All_reads*, hpc_t*, ul_idx_t const*)
void verify_aln(int32_t sid, overlap_region *z, UC_Read* qu, UC_Read* tu, All_reads *rref, hpc_t *hpc_g, const ul_idx_t *uref)
{
    uint64_t tl, tid = z->y_id, rev = z->y_pos_strand, i; char *tstr, *qstr; window_list *p;
    if(hpc_g) tl = hpc_len(*hpc_g, tid);
    else if(uref) tl = uref->ug->u.a[tid].len;
    else tl = Get_READ_LENGTH((*rref), tid);
    
    qstr = qu->seq; resize_UC_Read(tu, tl);
    if(rref) {
        recover_UC_Read_sub_region(tu->seq, 0, tl, rev, rref, tid); tstr = tu->seq;
    } else {
        tstr = return_str_seq_exz(tu->seq, 0, tl, rev, hpc_g, uref, tid);
    }
    
    for (i = 0; i < z->w_list.n; i++) {
        p = &(z->w_list.a[i]);
        if(p->y_end == -1) continue;
        if(!wcigar_check(p, &(z->w_list), qstr, tstr)) break;
    }
    if(i < z->w_list.n) {
        fprintf(stderr, "sid::%d, tid::%lu, i::%lu, qs::%d, qe::%d, ts::%d, te::%d, err::%d\n", sid, tid, i, 
        p->x_start, p->x_end, p->y_start, p->y_end, p->error); 
        prt_cigar(z->w_list.c.a+p->cidx, p->clen);
        fprintf(stderr, "[tstr::[%u, %u]] %.*s\n", z->y_pos_s, z->y_pos_e, p->y_end+1-p->y_start, tstr+p->y_start);
        fprintf(stderr, "[qstr::[%u, %u]] %.*s\n", z->x_pos_s, z->x_pos_e, p->x_end+1-p->x_start, qstr+p->x_start);
        exit(0);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r13
movq %r8, %rbp
movq %rcx, %r12
movq %rsi, %rbx
movl %edi, 0x14(%rsp)
movq 0x60(%rsp), %rax
movl 0x10(%rsi), %r14d
movl 0x1c(%rsi), %ecx
movl %ecx, 0x8(%rsp)
testq %r9, %r9
je 0x2faae
movq (%r13), %rax
movq 0x10(%rax), %rax
imulq $0x28, %r14, %rcx
movl (%rax,%rcx), %r15d
shrl %r15d
andl $0x3fffffff, %r15d      # imm = 0x3FFFFFFF
jmp 0x2fad3
testq %rax, %rax
je 0x2facb
movq (%rax), %rax
movq 0x10(%rax), %rax
imulq $0x28, %r14, %rcx
movl (%rax,%rcx), %r15d
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
jmp 0x2fad3
movq 0x18(%rbp), %rax
movq (%rax,%r14,8), %r15
movq (%rdx), %rax
movq %rax, 0x18(%rsp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x562fa
movq (%r12), %rdi
testq %rbp, %rbp
movq %r14, 0x20(%rsp)
je 0x2fb0f
movzbl 0x8(%rsp), %ecx
xorl %esi, %esi
movq %r15, %rdx
movq %rbp, %r8
movq %r14, %r9
callq 0x6c9e
movq (%r12), %rax
jmp 0x2fb2e
subq $0x8, %rsp
movzbl 0x10(%rsp), %ecx
xorl %esi, %esi
movq %r15, %rdx
movq %r13, %r8
movq 0x68(%rsp), %r9
pushq %r14
callq 0x578d7
popq %rcx
popq %rdx
movq %rax, 0x8(%rsp)
leaq 0x48(%rbx), %r15
xorl %r14d, %r14d
xorl %ebp, %ebp
movq (%r15), %rax
cmpq %rax, %rbp
jae 0x2fb80
movq 0x58(%rbx), %r13
leaq (%r14,%r13), %r12
cmpl $-0x1, 0xc(%r13,%r14)
je 0x2fb6e
movq %r12, %rdi
movq %r15, %rsi
movq 0x18(%rsp), %rdx
movq 0x8(%rsp), %rcx
callq 0x2fa04
testq %rax, %rax
je 0x2fb77
incq %rbp
addq $0x20, %r14
jmp 0x2fb3c
movq (%r15), %rax
addq %r14, %r13
movq %r13, %r12
cmpq %rax, %rbp
jb 0x2fb94
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x223445(%rip), %r15    # 0x252fe0
movq (%r15), %rdi
movl (%r12), %r9d
movl 0x4(%r12), %r10d
movl 0x8(%r12), %r11d
movl 0xc(%r12), %r14d
movswl 0x14(%r12), %r13d
leaq 0x1b4ace(%rip), %rsi    # 0x1e468c
movl 0x14(%rsp), %edx
movq 0x20(%rsp), %rcx
movq %rbp, %r8
xorl %eax, %eax
pushq %r13
pushq %r14
pushq %r11
pushq %r10
callq 0x22b0
addq $0x20, %rsp
movl 0x18(%r12), %edi
movl 0x1c(%r12), %esi
addq %rdi, %rdi
addq 0x70(%rbx), %rdi
callq 0x2aa00
movq (%r15), %rdi
movl 0x14(%rbx), %edx
movl 0x18(%rbx), %ecx
movl 0xc(%r12), %r8d
movslq 0x8(%r12), %rax
subl %eax, %r8d
incl %r8d
movq 0x8(%rsp), %r9
addq %rax, %r9
leaq 0x1b4ab5(%rip), %rsi    # 0x1e46d0
xorl %eax, %eax
callq 0x22b0
movq (%r15), %rdi
movl 0x4(%rbx), %edx
movl 0x8(%rbx), %ecx
movl 0x4(%r12), %r8d
movslq (%r12), %rax
subl %eax, %r8d
incl %r8d
movq 0x18(%rsp), %r9
addq %rax, %r9
leaq 0x1b4a9e(%rip), %rsi    # 0x1e46e7
xorl %eax, %eax
callq 0x22b0
xorl %edi, %edi
callq 0x2250