// File: /workspace/github_cpp_makefile_star2_O3/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 %rcx, %r12
movq %rsi, %rbx
movl %edi, 0x14(%rsp)
movq 0x60(%rsp), %rsi
movl 0x10(%rbx), %r13d
testq %r9, %r9
je 0x5fb9e
movq (%r9), %rax
movq 0x10(%rax), %rax
leaq (,%r13,4), %rcx
addq %r13, %rcx
movl (%rax,%rcx,8), %r15d
shrl %r15d
andl $0x3fffffff, %r15d      # imm = 0x3FFFFFFF
jmp 0x5fbca
testq %rsi, %rsi
je 0x5fbc2
movq (%rsi), %rax
movq 0x10(%rax), %rax
leaq (,%r13,4), %rcx
addq %r13, %rcx
movl (%rax,%rcx,8), %r15d
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
jmp 0x5fbca
movq 0x18(%r8), %rax
movq (%rax,%r13,8), %r15
movl 0x1c(%rbx), %r10d
movq (%rdx), %rax
movq %rax, 0x18(%rsp)
cmpq %r15, 0x10(%r12)
jge 0x5fc0d
movq (%r12), %rdi
movq %r15, %rsi
movq %r8, %r14
movl %r10d, 0x8(%rsp)
movq %r9, %rbp
callq 0x2370
movq %rbp, %r9
movl 0x8(%rsp), %r10d
movq 0x60(%rsp), %rsi
movq %r14, %r8
movq %rax, (%r12)
movq %r15, 0x10(%r12)
testq %r8, %r8
movq %r13, 0x20(%rsp)
je 0x5fc32
movq (%r12), %rdi
movzbl %r10b, %ecx
xorl %esi, %esi
movq %r15, %rdx
movq %r13, %r9
callq 0x32ef8
movq (%r12), %r12
jmp 0x5fca1
testq %r9, %r9
je 0x5fc62
movq (%r9), %rax
movq 0x10(%rax), %rax
leaq (,%r13,4), %rcx
addq %r13, %rcx
movq 0x20(%rax,%rcx,8), %r12
testb %r10b, %r10b
je 0x5fc9c
leaq (%rax,%rcx,8), %rax
movl (%rax), %eax
shrl %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
jmp 0x5fc9e
movq (%r12), %r12
movq (%rsi), %rax
leaq (,%r13,4), %rdx
addq %r13, %rdx
shlq $0x3, %rdx
addq 0x10(%rax), %rdx
subq $0x8, %rsp
movzbl %r10b, %ecx
xorl %edi, %edi
movq %r12, %rsi
xorl %r8d, %r8d
movq %r15, %r9
pushq $0x0
callq 0x36049
addq $0x10, %rsp
jmp 0x5fca1
xorl %eax, %eax
addq %rax, %r12
movq 0x48(%rbx), %rcx
testq %rcx, %rcx
je 0x5fcf0
leaq 0x48(%rbx), %r13
xorl %eax, %eax
xorl %r15d, %r15d
movq %rax, %rbp
movq 0x58(%rbx), %r14
cmpl $-0x1, 0xc(%r14,%rax)
je 0x5fcdf
leaq (%r14,%rbp), %rdi
movq %r13, %rsi
movq 0x18(%rsp), %rdx
movq %r12, %rcx
callq 0x5fafb
movq (%r13), %rcx
testq %rax, %rax
je 0x5fceb
incq %r15
leaq 0x20(%rbp), %rax
cmpq %rcx, %r15
jb 0x5fcb3
cmpq %rcx, %r15
jb 0x5fcff
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2352da(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
movl (%r14,%rbp), %r9d
movl 0x4(%r14,%rbp), %eax
movq %rax, 0x8(%rsp)
movl 0x8(%r14,%rbp), %r11d
movl 0xc(%r14,%rbp), %r13d
movswl 0x14(%r14,%rbp), %r10d
leaq 0x1d2a0e(%rip), %rsi    # 0x23273c
movl 0x14(%rsp), %edx
movq 0x20(%rsp), %rcx
movq %r15, %r8
xorl %eax, %eax
pushq %r10
pushq %r13
pushq %r11
pushq 0x20(%rsp)
callq 0x22b0
addq $0x20, %rsp
movl 0x18(%r14,%rbp), %edi
movl 0x1c(%r14,%rbp), %esi
addq %rdi, %rdi
addq 0x70(%rbx), %rdi
callq 0x5a0be
movq 0x235274(%rip), %r15    # 0x294fe0
movq (%r15), %rdi
movl 0x14(%rbx), %edx
movl 0x18(%rbx), %ecx
movl 0xc(%r14,%rbp), %r8d
movslq 0x8(%r14,%rbp), %rax
subl %eax, %r8d
incl %r8d
addq %rax, %r12
leaq 0x1d29f1(%rip), %rsi    # 0x232780
movq %r12, %r9
xorl %eax, %eax
callq 0x22b0
movq (%r15), %rdi
movl 0x4(%rbx), %edx
movl 0x8(%rbx), %ecx
movl 0x4(%r14,%rbp), %r8d
movslq (%r14,%rbp), %rax
subl %eax, %r8d
incl %r8d
movq 0x18(%rsp), %r9
addq %rax, %r9
leaq 0x1d29d7(%rip), %rsi    # 0x232797
xorl %eax, %eax
callq 0x22b0
xorl %edi, %edi
callq 0x2250