// File: /workspace/github_cpp_makefile_star2_O2/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)
movq 0x58(%rsp), %rdx
movq 0x50(%rsp), %r11
cmpq $0x0, 0x60(%rsp)
sete %al
cmpq %rdx, %r11
setne %r10b
orb %al, %r10b
movb %r10b, 0xf(%rsp)
xorl %r14d, %r14d
testq %rcx, %rcx
cmovleq %r14, %rcx
xorl %r12d, %r12d
xorl %r15d, %r15d
cmpq %rcx, %r12
je 0x13eda4
movq 0x10(%rsp), %rax
movl (%rax,%r12,8), %r13d
imulq $0x1c, %r13, %rax
movl (%rsi,%rax), %ebx
movl 0xc(%rsi,%rax), %ebp
imulq $0xa8, %rbp, %rbp
movq 0x58(%rdi,%rbp), %r10
shlq $0x5, %rbx
movslq (%r10,%rbx), %rbp
movl 0x18(%rsi,%rax), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
addq %rax, %rbp
movl 0x4(%r10,%rbx), %r10d
subl %eax, %r10d
incl %r10d
movslq %r10d, %rax
cmpq %r11, %rbp
movq %r11, %r10
cmovgq %rbp, %r10
cmpq %rdx, %rax
movq %rdx, %rbx
cmovlq %rax, %rbx
cmpq %r10, %rbx
jg 0x13ed78
cmpq %r11, %rbp
setg %r10b
orb 0xf(%rsp), %r10b
jne 0x13ed9c
cmpq %r11, %rax
jl 0x13ed9c
incq %r15
cmpq $0x0, 0x68(%rsp)
je 0x13ed91
cmpq (%r8,%r14,8), %r13
jne 0x13ee03
incq %r14
jmp 0x13ed9c
incq %r14
cmpq %r9, %r14
jge 0x13ede4
cmpq (%r8,%r14,8), %r13
jne 0x13ed8e
incq %r12
jmp 0x13ed01
cmpq $0x0, 0x68(%rsp)
je 0x13edd0
cmpq %r9, %r15
je 0x13edd5
leaq 0xa7427(%rip), %rdi     # 0x1e61df
leaq 0xb113c(%rip), %rsi     # 0x1efefb
leaq 0xb1204(%rip), %rcx     # 0x1effca
movl $0x46b, %edx            # imm = 0x46B
callq 0x2110
cmpq %r9, %r15
jg 0x13ee22
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb126c(%rip), %rdi     # 0x1f0057
leaq 0xb1109(%rip), %rsi     # 0x1efefb
leaq 0xb11d1(%rip), %rcx     # 0x1effca
movl $0x463, %edx            # imm = 0x463
callq 0x2110
leaq 0xa7343(%rip), %rdi     # 0x1e614d
leaq 0xb10ea(%rip), %rsi     # 0x1efefb
leaq 0xb11b2(%rip), %rcx     # 0x1effca
movl $0x460, %edx            # imm = 0x460
callq 0x2110
leaq 0xb1238(%rip), %rdi     # 0x1f0061
leaq 0xb10cb(%rip), %rsi     # 0x1efefb
leaq 0xb1193(%rip), %rcx     # 0x1effca
movl $0x46d, %edx            # imm = 0x46D
callq 0x2110