// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/ecovlp.cpp
// Function: debug_inter0(overlap_region*, ul_ov_t*, unsigned long*, long, unsigned long*, long, long, long, unsigned long, unsigned long, char const*)
void debug_inter0(overlap_region* ol, ul_ov_t *c_idx, uint64_t *idx, int64_t idx_n, uint64_t *res, int64_t res_n, int64_t s, int64_t e, uint64_t is_insert, uint64_t is_hard_check, const char *cmd)
{
    ul_ov_t *cp; int64_t q[2], a_n = 0, i, k = 0, os, oe; 
    for (i = 0; i < idx_n; i++) {
        cp = &(c_idx[(uint32_t)idx[i]]);
        q[0] = ol[ovlp_id(*cp)].w_list.a[ovlp_cur_wid(*cp)].x_start+ovlp_bd(*cp);
        q[1] = ol[ovlp_id(*cp)].w_list.a[ovlp_cur_wid(*cp)].x_end+1-ovlp_bd(*cp);

        // fprintf(stderr, "%s[M::%s] tid::%u\t%.*s\twid::%u\tq::[%u, %u)\terr::%d\toerr::%u\n", cmd, __func__, ol[ovlp_id(*cp)].y_id, (int)Get_NAME_LENGTH(R_INF, ol[ovlp_id(*cp)].y_id), Get_NAME(R_INF, ol[ovlp_id(*cp)].y_id),
        // ovlp_cur_wid(*cp), ol[ovlp_id(*cp)].w_list.a[ovlp_cur_wid(*cp)].x_start, ol[ovlp_id(*cp)].w_list.a[ovlp_cur_wid(*cp)].x_end+1, ol[ovlp_id(*cp)].w_list.a[ovlp_cur_wid(*cp)].error, ol[ovlp_id(*cp)].non_homopolymer_errors);

        os = MAX(q[0], s); oe = MIN(q[1], e);
        if((oe > os) || ((is_insert) && (s == e) && (s >= q[0]) && (s <= q[1]))) {
            a_n++; 
            // if(!(((uint32_t)idx[i]) == res[k])) {
            //     fprintf(stderr, "[M::%s] a_n::%ld\tres_n::%ld\ts::%ld\te::%ld\ti::%ld\tk::%ld\n", __func__, a_n, res_n, s, e, i, k);
            // }
            if(is_hard_check) {
                assert(((uint32_t)idx[i]) == res[k++]);
            } else {
                for (; (k < res_n) && (((uint32_t)idx[i]) != res[k]); k++);
                assert(k < res_n);
            }
        }
    }
    // if(a_n != res_n) {
    //     fprintf(stderr, "[M::%s] a_n::%ld\tres_n::%ld\ts::%ld\te::%ld\tidx_n::%ld\n", __func__, a_n, res_n, s, e, idx_n);
    // }
    if(is_hard_check) {
        assert(a_n == res_n);
    } else {
        assert(a_n <= res_n);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, 0x10(%rsp)
testq %rcx, %rcx
jle 0x17b92e
movq 0x58(%rsp), %rdx
cmpq $0x0, 0x60(%rsp)
movq 0x50(%rsp), %rbx
sete %al
cmpq %rdx, %rbx
setne %r10b
orb %al, %r10b
movb %r10b, 0xf(%rsp)
xorl %r10d, %r10d
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x10(%rsp), %rax
movl (%rax,%r14,8), %r12d
leaq (%r12,%r12,8), %rax
leaq (%rax,%rax,2), %rax
addq %r12, %rax
movl (%rsi,%rax), %ebp
movl 0xc(%rsi,%rax), %r13d
imulq $0xa8, %r13, %r13
movq 0x58(%rdi,%r13), %r11
shlq $0x5, %rbp
movslq (%r11,%rbp), %r13
movl 0x18(%rsi,%rax), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
addq %rax, %r13
movl 0x4(%r11,%rbp), %r11d
subl %eax, %r11d
incl %r11d
movslq %r11d, %rax
cmpq %rbx, %r13
movq %rbx, %r11
cmovgq %r13, %r11
cmpq %rdx, %rax
movq %rdx, %rbp
cmovlq %rax, %rbp
cmpq %r11, %rbp
jg 0x17b8d6
cmpq %rbx, %r13
setg %r11b
orb 0xf(%rsp), %r11b
jne 0x17b8ee
cmpq %rbx, %rax
jl 0x17b8ee
incq %r10
cmpq $0x0, 0x68(%rsp)
je 0x17b8fc
cmpq (%r8,%r15,8), %r12
jne 0x17b971
incq %r15
incq %r14
cmpq %rcx, %r14
jne 0x17b860
jmp 0x17b931
cmpq %r9, %r15
jge 0x17b90f
cmpq (%r8,%r15,8), %r12
je 0x17b8ee
incq %r15
cmpq %r15, %r9
jne 0x17b901
leaq 0xb6631(%rip), %rdi     # 0x231f47
leaq 0xb64ce(%rip), %rsi     # 0x231deb
leaq 0xb6596(%rip), %rcx     # 0x231eba
movl $0x463, %edx            # imm = 0x463
callq 0x2110
xorl %r10d, %r10d
cmpq $0x0, 0x68(%rsp)
je 0x17b95d
cmpq %r9, %r10
je 0x17b962
leaq 0xac83a(%rip), %rdi     # 0x22817f
leaq 0xb649f(%rip), %rsi     # 0x231deb
leaq 0xb6567(%rip), %rcx     # 0x231eba
movl $0x46b, %edx            # imm = 0x46B
callq 0x2110
cmpq %r9, %r10
jg 0x17b990
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xac775(%rip), %rdi     # 0x2280ed
leaq 0xb646c(%rip), %rsi     # 0x231deb
leaq 0xb6534(%rip), %rcx     # 0x231eba
movl $0x460, %edx            # imm = 0x460
callq 0x2110
leaq 0xb65ba(%rip), %rdi     # 0x231f51
leaq 0xb644d(%rip), %rsi     # 0x231deb
leaq 0xb6515(%rip), %rcx     # 0x231eba
movl $0x46d, %edx            # imm = 0x46D
callq 0x2110