// File: 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
movq %rsp, %rbp
subq $0x90, %rsp
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x24ec9d
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movq -0x60(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq -0x38(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0x38(%rbp), %rcx
movl (%rcx), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x38(%rbp), %rcx
movl 0x18(%rcx), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
addl %ecx, %eax
cltq
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq -0x38(%rbp), %rcx
movl 0xc(%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq 0x58(%rax), %rax
movq -0x38(%rbp), %rcx
movl (%rcx), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
addl $0x1, %eax
movq -0x38(%rbp), %rcx
movl 0x18(%rcx), %ecx
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
subl %ecx, %eax
cltq
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rax
cmpq 0x10(%rbp), %rax
jl 0x24eb2c
movq -0x50(%rbp), %rax
movq %rax, -0x80(%rbp)
jmp 0x24eb34
movq 0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x48(%rbp), %rax
cmpq 0x18(%rbp), %rax
jg 0x24eb53
movq -0x48(%rbp), %rax
movq %rax, -0x88(%rbp)
jmp 0x24eb5e
movq 0x18(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
cmpq -0x70(%rbp), %rax
jg 0x24eba8
cmpq $0x0, 0x20(%rbp)
je 0x24ec8a
movq 0x10(%rbp), %rax
cmpq 0x18(%rbp), %rax
jne 0x24ec8a
movq 0x10(%rbp), %rax
cmpq -0x50(%rbp), %rax
jl 0x24ec8a
movq 0x10(%rbp), %rax
cmpq -0x48(%rbp), %rax
jg 0x24ec8a
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, 0x28(%rbp)
je 0x24ec08
movq -0x18(%rbp), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq -0x28(%rbp), %rcx
movq -0x68(%rbp), %rdx
movq %rdx, %rsi
addq $0x1, %rsi
movq %rsi, -0x68(%rbp)
cmpq (%rcx,%rdx,8), %rax
jne 0x24ebe4
jmp 0x24ec03
leaq 0x1361da(%rip), %rdi    # 0x384dc5
leaq 0x140019(%rip), %rsi    # 0x38ec0b
movl $0x460, %edx            # imm = 0x460
leaq 0x1400dc(%rip), %rcx    # 0x38ecda
callq 0x2130
jmp 0x24ec88
jmp 0x24ec0a
movq -0x68(%rbp), %rcx
xorl %eax, %eax
cmpq -0x30(%rbp), %rcx
movb %al, -0x89(%rbp)
jge 0x24ec3f
movq -0x18(%rbp), %rax
movq -0x60(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq -0x28(%rbp), %rcx
movq -0x68(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
setne %al
movb %al, -0x89(%rbp)
movb -0x89(%rbp), %al
testb $0x1, %al
jne 0x24ec4b
jmp 0x24ec5b
jmp 0x24ec4d
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x24ec0a
movq -0x68(%rbp), %rax
cmpq -0x30(%rbp), %rax
jge 0x24ec67
jmp 0x24ec86
leaq 0x1400f9(%rip), %rdi    # 0x38ed67
leaq 0x13ff96(%rip), %rsi    # 0x38ec0b
movl $0x463, %edx            # imm = 0x463
leaq 0x140059(%rip), %rcx    # 0x38ecda
callq 0x2130
jmp 0x24ec88
jmp 0x24ec8a
jmp 0x24ec8c
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x24ea6f
cmpq $0x0, 0x28(%rbp)
je 0x24ecd1
movq -0x58(%rbp), %rax
cmpq -0x30(%rbp), %rax
jne 0x24ecb0
jmp 0x24eccf
leaq 0x1361a0(%rip), %rdi    # 0x384e57
leaq 0x13ff4d(%rip), %rsi    # 0x38ec0b
movl $0x46b, %edx            # imm = 0x46B
leaq 0x140010(%rip), %rcx    # 0x38ecda
callq 0x2130
jmp 0x24ecfe
movq -0x58(%rbp), %rax
cmpq -0x30(%rbp), %rax
jg 0x24ecdd
jmp 0x24ecfc
leaq 0x14008d(%rip), %rdi    # 0x38ed71
leaq 0x13ff20(%rip), %rsi    # 0x38ec0b
movl $0x46d, %edx            # imm = 0x46D
leaq 0x13ffe3(%rip), %rcx    # 0x38ecda
callq 0x2130
jmp 0x24ecfe
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)