// File: chhylp123[P]hifiasm/Correct.cpp
// Function: debug_inter(overlap_region_alloc*, kv_ul_ov_t*, unsigned long*, long, unsigned long*, long, long, long)
void debug_inter(overlap_region_alloc* ol, kv_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)
{
    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->a[(uint32_t)idx[i]]);
        q[0] = ol->list[ovlp_id(*cp)].w_list.a[ovlp_cur_wid(*cp)].x_start+ovlp_bd(*cp);
        q[1] = ol->list[ovlp_id(*cp)].w_list.a[ovlp_cur_wid(*cp)].x_end+1-ovlp_bd(*cp);
        os = MAX(q[0], s); oe = MIN(q[1], e);
        if(oe > os) {
            a_n++; assert(((uint32_t)idx[i]) == res[k++]);
        }
    }
    // if(a_n != res_n) {
    //     fprintf(stderr, "[M::%s] a_n::%ld\tres_n::%ld\ts::%ld\te::%ld\n", __func__, a_n, res_n, s, e);
    // }
    assert(a_n == res_n);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
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 0x752d9
movq -0x10(%rbp), %rax
movq (%rax), %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 (%rax), %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 (%rax), %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 0x75229
movq -0x50(%rbp), %rax
movq %rax, -0x80(%rbp)
jmp 0x75231
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 0x75250
movq -0x48(%rbp), %rax
movq %rax, -0x88(%rbp)
jmp 0x7525b
movq 0x18(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
cmpq -0x70(%rbp), %rax
jle 0x752c6
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
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 0x752a5
jmp 0x752c4
leaq 0x30fb19(%rip), %rdi    # 0x384dc5
leaq 0x30d068(%rip), %rsi    # 0x38231b
movl $0x4c5b, %edx           # imm = 0x4C5B
leaq 0x30fb25(%rip), %rcx    # 0x384de4
callq 0x2130
jmp 0x752c6
jmp 0x752c8
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x75163
movq -0x58(%rbp), %rax
cmpq -0x30(%rbp), %rax
jne 0x752e5
jmp 0x75304
leaq 0x30fb6b(%rip), %rdi    # 0x384e57
leaq 0x30d028(%rip), %rsi    # 0x38231b
movl $0x4c61, %edx           # imm = 0x4C61
leaq 0x30fae5(%rip), %rcx    # 0x384de4
callq 0x2130
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)