// File: /workspace/github_cpp_makefile_star2_O1/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 $0x18, %rsp
movq %rcx, %r12
movq %rsi, %rbx
movl %edi, 0x4(%rsp)
movq 0x50(%rsp), %rsi
movl 0x10(%rbx), %r14d
testq %r9, %r9
je 0x6031a
movq (%r9), %rax
movq 0x10(%rax), %rax
leaq (%r14,%r14,4), %rcx
movl (%rax,%rcx,8), %r15d
shrl %r15d
andl $0x3fffffff, %r15d      # imm = 0x3FFFFFFF
jmp 0x6033f
testq %rsi, %rsi
je 0x60337
movq (%rsi), %rax
movq 0x10(%rax), %rax
leaq (%r14,%r14,4), %rcx
movl (%rax,%rcx,8), %r15d
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
jmp 0x6033f
movq 0x18(%r8), %rax
movq (%rax,%r14,8), %r15
movl 0x1c(%rbx), %ebp
movq (%rdx), %rax
movq %rax, 0x10(%rsp)
cmpq %r15, 0x10(%r12)
movq %r14, 0x8(%rsp)
jge 0x60381
movq (%r12), %rdi
movq %r15, %rsi
movq %r8, %r14
movq %r9, %r13
callq 0x2370
movq %r13, %r9
movq 0x50(%rsp), %rsi
movq %r14, %r8
movq 0x8(%rsp), %r14
movq %rax, (%r12)
movq %r15, 0x10(%r12)
testq %r8, %r8
je 0x603a1
movq (%r12), %rdi
movzbl %bpl, %ecx
xorl %esi, %esi
movq %r15, %rdx
movq %r14, %r9
callq 0x337f7
movq (%r12), %r12
jmp 0x60402
testq %r9, %r9
je 0x603ca
movq (%r9), %rax
movq 0x10(%rax), %rax
leaq (%r14,%r14,4), %rcx
movq 0x20(%rax,%rcx,8), %r12
testb %bpl, %bpl
je 0x603fd
leaq (%rax,%rcx,8), %rax
movl (%rax), %eax
shrl %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
jmp 0x603ff
movq (%r12), %r12
movq (%rsi), %rax
leaq (%r14,%r14,4), %rdx
shlq $0x3, %rdx
addq 0x10(%rax), %rdx
subq $0x8, %rsp
movzbl %bpl, %ecx
xorl %edi, %edi
movq %r12, %rsi
xorl %r8d, %r8d
movq %r15, %r9
pushq $0x0
callq 0x36b0d
addq $0x10, %rsp
jmp 0x60402
xorl %eax, %eax
addq %rax, %r12
leaq 0x48(%rbx), %rbp
cmpq $0x0, 0x48(%rbx)
je 0x6044f
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x58(%rbx), %rax
leaq (%rax,%r14), %r13
cmpl $-0x1, 0xc(%rax,%r14)
je 0x6043b
movq %r13, %rdi
movq %rbp, %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rcx
callq 0x60276
testq %rax, %rax
je 0x60448
incq %r15
addq $0x20, %r14
cmpq (%rbp), %r15
jb 0x60413
movq 0x8(%rsp), %r14
jmp 0x60452
xorl %r15d, %r15d
cmpq (%rbp), %r15
jb 0x60467
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x229b72(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
movl (%r13), %r9d
movl 0x4(%r13), %r10d
movl 0x8(%r13), %r11d
movq %r14, %rcx
movl 0xc(%r13), %r14d
movswl 0x14(%r13), %ebp
leaq 0x1c619c(%rip), %rsi    # 0x22662c
movl 0x4(%rsp), %edx
movq %r15, %r8
xorl %eax, %eax
pushq %rbp
pushq %r14
pushq %r11
pushq %r10
callq 0x22b0
addq $0x20, %rsp
movl 0x18(%r13), %edi
movl 0x1c(%r13), %esi
addq %rdi, %rdi
addq 0x70(%rbx), %rdi
callq 0x5ab77
movq 0x229b1c(%rip), %r14    # 0x289fe0
movq (%r14), %rdi
movl 0x14(%rbx), %edx
movl 0x18(%rbx), %ecx
movl 0xc(%r13), %r8d
movslq 0x8(%r13), %rax
subl %eax, %r8d
incl %r8d
addq %rax, %r12
leaq 0x1c618b(%rip), %rsi    # 0x226670
movq %r12, %r9
xorl %eax, %eax
callq 0x22b0
movq (%r14), %rdi
movl 0x4(%rbx), %edx
movl 0x8(%rbx), %ecx
movl 0x4(%r13), %r8d
movslq (%r13), %rax
subl %eax, %r8d
incl %r8d
movq 0x10(%rsp), %r9
addq %rax, %r9
leaq 0x1c6172(%rip), %rsi    # 0x226687
xorl %eax, %eax
callq 0x22b0
xorl %edi, %edi
callq 0x2250