// File: /workspace/github_cpp_makefile_star2_O3/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 0x182607
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 0x1825af
cmpq %rbx, %r13
setg %r11b
orb 0xf(%rsp), %r11b
jne 0x1825c7
cmpq %rbx, %rax
jl 0x1825c7
incq %r10
cmpq $0x0, 0x68(%rsp)
je 0x1825d5
cmpq (%r8,%r15,8), %r12
jne 0x18264a
incq %r15
incq %r14
cmpq %rcx, %r14
jne 0x182539
jmp 0x18260a
cmpq %r9, %r15
jge 0x1825e8
cmpq (%r8,%r15,8), %r12
je 0x1825c7
incq %r15
cmpq %r15, %r9
jne 0x1825da
leaq 0xbbba8(%rip), %rdi     # 0x23e197
leaq 0xbba45(%rip), %rsi     # 0x23e03b
leaq 0xbbb0d(%rip), %rcx     # 0x23e10a
movl $0x463, %edx            # imm = 0x463
callq 0x2110
xorl %r10d, %r10d
cmpq $0x0, 0x68(%rsp)
je 0x182636
cmpq %r9, %r10
je 0x18263b
leaq 0xb1c71(%rip), %rdi     # 0x23428f
leaq 0xbba16(%rip), %rsi     # 0x23e03b
leaq 0xbbade(%rip), %rcx     # 0x23e10a
movl $0x46b, %edx            # imm = 0x46B
callq 0x2110
cmpq %r9, %r10
jg 0x182669
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb1bac(%rip), %rdi     # 0x2341fd
leaq 0xbb9e3(%rip), %rsi     # 0x23e03b
leaq 0xbbaab(%rip), %rcx     # 0x23e10a
movl $0x460, %edx            # imm = 0x460
callq 0x2110
leaq 0xbbb31(%rip), %rdi     # 0x23e1a1
leaq 0xbb9c4(%rip), %rsi     # 0x23e03b
leaq 0xbba8c(%rip), %rcx     # 0x23e10a
movl $0x46d, %edx            # imm = 0x46D
callq 0x2110