// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/horder.cpp
// Function: debug_sub_cov(kvec_pe_hit*, unsigned long, unsigned long, unsigned long, ma_utg_t*, asg_t*, unsigned long, unsigned long)
void debug_sub_cov(kvec_pe_hit *hits, uint64_t sidx, uint64_t eidx, uint64_t ulen, ma_utg_t *u, asg_t* r_g,
uint64_t rid, uint64_t i_cnt)
{
    uint64_t i, offset, beg, end, rs, re;
    uint64_t p0s, p0e, p1s, p1e, span_s, span_e, cnt = 0;
    rs = re = (uint64_t)-1;
    for (i = offset = 0; i < u->n; i++)
    {
        end = offset + ((u->a[i] != (uint64_t)-1?r_g->seq[u->a[i]>>33].len:GAP_LEN));
        offset += (u->a[i] != (uint64_t)-1? (uint32_t)u->a[i]:GAP_LEN);
        beg = offset;

        if(u->a[i] == (uint64_t)-1) beg -= GAP_LEN;
        if(end <= beg && i + 1 < u->n && u->a[i+1] == (uint64_t)-1)
        {
            end = beg + GAP_LEN;
        }
        if(rid == i)
        {
            rs = beg;
            re = end;
        }
    }

    for (i = sidx; i < eidx; i++)///keep all hic hits that contain interval we want
    {
        if(get_hit_suid(*hits, i) != get_hit_euid(*hits, i)) continue;
        p0s = get_hit_spos(*hits, i);
        p0e = get_hit_spos_e(*hits, i);
        p1s = get_hit_epos(*hits, i);
        p1e = get_hit_epos_e(*hits, i);

        span_s = MIN(MIN(p0s, p0e), MIN(p1s, p1e));
        span_s = MIN(span_s, ulen-1);
        span_e = MAX(MAX(p0s, p0e), MAX(p1s, p1e));
        span_e = MIN(span_e, ulen-1) + 1;

        //if(span_e - span_s <= ulen*BREAK_CUTOFF)//need it or not?
        {
            if(span_s <= rs && span_e >= re) cnt++;
        }
    }

    // if(cnt != i_cnt) fprintf(stderr, "cnt-%lu, i_cnt-%lu\n", cnt, i_cnt);
    fprintf(stderr, "******cnt-%lu, i_cnt-%lu\n", cnt, i_cnt);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, -0x10(%rsp)
movq %rsi, -0x8(%rsp)
movq %rdi, -0x18(%rsp)
movl 0x10(%r8), %edi
testq %rdi, %rdi
jne 0x1f9ee
movabsq $-0x1, %r11
movq %r11, %r10
jmp 0x1faaf
movq 0x38(%rsp), %rbx
movq 0x18(%r8), %r8
movq %rdi, %r14
negq %r14
negq %rbx
movabsq $-0x1, %r10
movabsq $0x1, %r15
xorl %r13d, %r13d
movabsq $0x64, %r12
movq %r10, %r11
movq -0x8(%r8,%r15,8), %rcx
movq %r12, %rbp
cmpq $-0x1, %rcx
je 0x1fa46
movq 0x20(%r9), %rax
movq %rcx, %rbp
shrq $0x21, %rbp
movl (%rax,%rbp,8), %ebp
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
cmpq $-0x1, %rcx
movl %ecx, %esi
cmoveq %r12, %rsi
leaq (%rsi,%r13), %rax
cmpq $-0x1, %rcx
leaq -0x64(%rsi,%r13), %rcx
cmovneq %rax, %rcx
addq %r13, %rbp
cmpq %rcx, %rbp
setbe %sil
cmpq %rdi, %r15
setb %r13b
andb %sil, %r13b
cmpb $0x1, %r13b
jne 0x1fa88
leaq 0x64(%rcx), %rsi
cmpq $-0x1, (%r8,%r15,8)
cmoveq %rsi, %rbp
leaq (%rbx,%r15), %rsi
cmpq $0x1, %rsi
cmoveq %rcx, %r11
cmoveq %rbp, %r10
leaq (%r14,%r15), %rcx
incq %rcx
incq %r15
movq %rax, %r13
cmpq $0x1, %rcx
jne 0x1fa24
movq 0x40(%rsp), %r8
movq -0x8(%rsp), %rsi
subq %rsi, %rdx
jbe 0x1fbcf
movq -0x18(%rsp), %rbp
movq 0x10(%rbp), %rax
movabsq $0x40, %rcx
subq 0x48(%rbp), %rcx
movq -0x10(%rsp), %r13
decq %r13
shlq $0x5, %rsi
addq %rax, %rsi
addq $0x18, %rsi
xorl %r9d, %r9d
movq -0x18(%rsi), %r15
leaq (%r15,%r15), %rdi
shrq %cl, %rdi
movq -0x10(%rsi), %rax
leaq (%rax,%rax), %rbx
shrq %cl, %rbx
cmpq %rbx, %rdi
jne 0x1fbc0
movq 0x50(%rbp), %r14
movq %r14, %rbx
andq %r15, %rbx
testq %r15, %r15
js 0x1fb30
movq (%rsi), %r12
movq %r12, %rdi
shrq $0x20, %rdi
leaq (%rbx,%rdi), %r15
decq %r15
jmp 0x1fb4b
leaq 0x1(%rbx), %rdi
movq (%rsi), %r12
movq %r12, %r15
shrq $0x20, %r15
subq %r15, %rdi
movl $0x0, %r15d
cmovaeq %rdi, %r15
andq %rax, %r14
testq %rax, %rax
js 0x1fb5e
movl %r12d, %eax
addq %r14, %rax
decq %rax
jmp 0x1fb71
leaq 0x1(%r14), %rdi
movl %r12d, %eax
subq %rax, %rdi
movl $0x0, %eax
cmovaeq %rdi, %rax
cmpq %r15, %rbx
movq %r15, %rdi
cmovbq %rbx, %rdi
cmpq %rax, %r14
movq %rax, %r12
cmovbq %r14, %r12
cmpq %r12, %rdi
cmovbq %rdi, %r12
cmpq %r13, %r12
jb 0x1fb94
movq %r13, %r12
cmpq %r11, %r12
ja 0x1fbc0
cmpq %rax, %r14
cmovaq %r14, %rax
cmpq %r15, %rbx
cmovaq %rbx, %r15
cmpq %rax, %r15
cmovbeq %rax, %r15
cmpq %r13, %r15
jb 0x1fbb6
movq %r13, %r15
incq %r15
cmpq %r10, %r15
sbbq $-0x1, %r9
addq $0x20, %rsi
decq %rdx
jne 0x1faef
jmp 0x1fbd2
xorl %r9d, %r9d
movq 0x275407(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x21dd16(%rip), %rsi    # 0x23d8f9
movq %r9, %rdx
movq %r8, %rcx
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x22b0