// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/ecovlp.cpp
// Function: debug_mm_exact_cigar(overlap_region_alloc*, unsigned int, UC_Read*, UC_Read*)
void debug_mm_exact_cigar(overlap_region_alloc* ol, uint32_t qid, UC_Read *qu, UC_Read *tu)
{
    int64_t on = ol->length, k, i, zwn, xk, yk; uint32_t cl, ck; ///bit_extz_t ez; 
    overlap_region *z; asg16_v ct; uint64_t wx[2], wy[2]; uint16_t c;
    recover_UC_Read(qu, &R_INF, qid);

    for (i = 0; i < on; i++) {
        z = &(ol->list[i]); zwn = z->w_list.n; 
        if(z->y_pos_strand) {
            recover_UC_Read_RC(tu, &R_INF, z->y_id);
        } else {
            recover_UC_Read(tu, &R_INF, z->y_id); ///b->z.length
        }

        // fprintf(stderr, "[M::%s] x_id::%u\ty_id::%u\tx::[%u, %u)\ty::[%u, %u)\tzwn::%ld\n", 
        //         __func__, z->x_id, z->y_id, z->x_pos_s, z->x_pos_e + 1, z->y_pos_s, z->y_pos_e + 1, zwn);
        // fprintf(stderr, "qstr(%lld)::%.*s\n", qu->length, (int32_t)(qu->length), qu->seq);
        // fprintf(stderr, "tstr(%lld)::%.*s\n", tu->length, (int32_t)(tu->length), tu->seq);

        for (k = 0; k < zwn; k++) {
            // set_bit_extz_t(ez, (*z), k);
            // if(!cigar_check(tu->seq, qu->seq, &ez)) {
            //     fprintf(stderr, "\n[M::%s] x_id::%u, y_id::%u, x::[%u, %u), y::[%u, %u)\n", __func__, z->x_id, z->y_id, z->x_pos_s, z->x_pos_e + 1, z->y_pos_s, z->y_pos_e + 1);
            //     exit(1);
            // }
            // continue;
            ct.a = z->w_list.c.a + z->w_list.a[k].cidx;
            ct.n = ct.m = z->w_list.a[k].clen; ck = 0; 
            xk = z->w_list.a[k].x_start; yk = z->w_list.a[k].y_start;
            while (ck < ct.n) {
                wx[0] = xk; wy[0] = yk;
                ck = pop_trace(&ct, ck, &c, &cl);
                if(c != 2) xk += cl;
                if(c != 3) yk += cl;
                wx[1] = xk; wy[1] = yk;
                if(c == 0) {
                    if(memcmp(qu->seq + wx[0], tu->seq + wy[0], wx[1] - wx[0])) {
                        fprintf(stderr, "\n-0-[M::%s]\teq::[%lu,\t%lu)\tet::[%lu,\t%lu)\t%c\n", __func__, wx[0], wx[1], wy[0], wy[1], "+-"[z->y_pos_strand]);
                        fprintf(stderr, "qstr(%u)::%.*s\n", z->x_id, (int32_t)(wx[1] - wx[0]), qu->seq + wx[0]);
                        fprintf(stderr, "tstr(%u)::%.*s\n", z->y_id, (int32_t)(wy[1] - wy[0]), tu->seq + wy[0]);
                        // exit(1);
                    } 
                    // else {
                    //     fprintf(stderr, "\n-1-[M::%s]\teq::[%lu,\t%lu)\tet::[%lu,\t%lu)\t%c\n", __func__, wx[0], wx[1], wy[0], wy[1], "+-"[z->y_pos_strand]);
                    //     fprintf(stderr, "qstr(%u)::%.*s\n", z->x_id, (int32_t)(wx[1] - wx[0]), qu->seq + wx[0]);
                    //     fprintf(stderr, "tstr(%u)::%.*s\n", z->y_id, (int32_t)(wy[1] - wy[0]), tu->seq + wy[0]);
                    // }
                }
            }
        }
        
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, 0x18(%rsp)
movq %rdx, %rax
movq %rdi, 0x30(%rsp)
movq 0x10(%rdi), %rbx
movl %esi, %edx
leaq 0x110beb(%rip), %rsi    # 0x254230
movq %rax, 0x28(%rsp)
movq %rax, %rdi
callq 0x715e
xorl %eax, %eax
testq %rbx, %rbx
cmovleq %rax, %rbx
movq %rbx, 0x38(%rsp)
xorl %eax, %eax
cmpq 0x38(%rsp), %rax
je 0x14386b
movq %rax, %rcx
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq %rcx, 0x40(%rsp)
imulq $0xa8, %rcx, %rbx
movq 0x48(%rax,%rbx), %r14
cmpl $0x0, 0x1c(%rax,%rbx)
movq %rax, 0x10(%rsp)
movl 0x10(%rax,%rbx), %edx
je 0x1436ac
movq 0x18(%rsp), %rdi
leaq 0x110b8b(%rip), %rsi    # 0x254230
callq 0x7215
jmp 0x1436bd
movq 0x18(%rsp), %rdi
leaq 0x110b78(%rip), %rsi    # 0x254230
callq 0x715e
addq %rbx, 0x10(%rsp)
testq %r14, %r14
movl $0x0, %eax
cmovleq %rax, %r14
movq %r14, 0x48(%rsp)
xorl %edx, %edx
cmpq 0x48(%rsp), %rdx
je 0x14385e
movq 0x10(%rsp), %rsi
movq 0x58(%rsi), %rcx
movq %rdx, 0x50(%rsp)
shlq $0x5, %rdx
movl 0x18(%rcx,%rdx), %eax
addq %rax, %rax
addq 0x70(%rsi), %rax
movq %rax, 0x70(%rsp)
movl 0x1c(%rcx,%rdx), %eax
movq %rax, 0x68(%rsp)
movq %rax, 0x60(%rsp)
movslq (%rcx,%rdx), %r14
movslq 0x8(%rcx,%rdx), %rbx
xorl %esi, %esi
movl %esi, %ecx
cmpq %rcx, %rax
jbe 0x143851
leaq 0x60(%rsp), %rdi
leaq 0xa(%rsp), %rdx
leaq 0x24(%rsp), %rcx
callq 0x53a7d
movl %eax, %esi
movzwl 0xa(%rsp), %eax
movl 0x24(%rsp), %r13d
leaq (%r14,%r13), %r12
cmpw $0x2, %ax
movq %r12, %rbp
cmoveq %r14, %rbp
leaq (%rbx,%r13), %r8
cmpw $0x3, %ax
movq %r8, %r15
cmoveq %rbx, %r15
testw %ax, %ax
jne 0x14379d
movq 0x28(%rsp), %rax
movq (%rax), %rdi
addq %r14, %rdi
movq 0x18(%rsp), %rax
movl %esi, 0xc(%rsp)
movq (%rax), %rsi
addq %rbx, %rsi
movq %r13, %rdx
movq %r8, 0x58(%rsp)
callq 0x21a0
movq 0x58(%rsp), %r11
movl 0xc(%rsp), %esi
testl %eax, %eax
jne 0x1437ad
movq 0x60(%rsp), %rax
movq %r15, %rbx
movq %rbp, %r14
jmp 0x14371b
movq 0x10f82c(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
movq 0x10(%rsp), %rax
movl 0x1c(%rax), %eax
leaq 0xa0a5d(%rip), %rcx     # 0x1e4223
movsbl (%rax,%rcx), %r10d
leaq 0xacd56(%rip), %rsi     # 0x1f0528
leaq 0xacd7d(%rip), %rdx     # 0x1f0556
movq %r14, %rcx
movq %r12, %r8
movq %rbx, %r12
movq %rbx, %r9
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x22b0
popq %rcx
popq %rdx
movq 0x10f7e7(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
movq 0x10(%rsp), %rbx
movl (%rbx), %edx
movq 0x28(%rsp), %rax
addq (%rax), %r14
leaq 0xacd59(%rip), %rsi     # 0x1f056b
movl %r13d, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x22b0
movq 0x10f7ba(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
movl 0x10(%rbx), %edx
movq 0x18(%rsp), %rax
addq (%rax), %r12
leaq 0xacd40(%rip), %rsi     # 0x1f057b
movl %r13d, %ecx
movq %r12, %r8
xorl %eax, %eax
callq 0x22b0
movl 0xc(%rsp), %esi
jmp 0x14379d
movq 0x50(%rsp), %rdx
incq %rdx
jmp 0x1436d5
movq 0x40(%rsp), %rax
incq %rax
jmp 0x143662
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq