// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/Overlaps.cpp
// Function: get_real_sources_length(ma_hit_t_alloc*, ma_sub_t*, int, int, unsigned int)
uint32_t get_real_sources_length(ma_hit_t_alloc* sources, ma_sub_t *coverage_cut, 
int max_hang, int min_ovlp, uint32_t query)
{
    uint32_t qn = query>>1;
    if(coverage_cut[qn].del) return 0;
    int32_t r;
    asg_arc_t t;
    ma_hit_t *h = NULL;
    ma_sub_t *sq = NULL;
    ma_sub_t *st = NULL;
    ma_hit_t_alloc* x = &(sources[qn]);
    uint32_t i, occ = 0;
    for (i = 0; i < x->length; i++)
    {
        h = &(x->buffer[i]);
        if(h->del) continue;
        ///now the edge has not been removed
        sq = &(coverage_cut[Get_qn(*h)]);
        st = &(coverage_cut[Get_tn(*h)]);
        if(sq->del || st->del) continue;
        r = ma_hit2arc(h, sq->e - sq->s, st->e - st->s, max_hang, 
                                asm_opt.max_hang_rate, min_ovlp, &t);
        ///if it is a contained read
        if(r < 0) continue;
        if((t.ul>>32) == query) occ++;
    }

    return occ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %r8d, %eax
shrl %eax
leaq (%rax,%rax,2), %r9
movl $0x0, -0x14(%rsp)
cmpl $0x0, (%rsi,%r9,4)
js 0xa1d7d
movl %edx, -0xc(%rsp)
movl %ecx, -0x10(%rsp)
movl 0xc(%rdi,%r9,8), %eax
testq %rax, %rax
je 0xa1d7d
leaq (%rdi,%r9,8), %rcx
movq (%rcx), %rdi
leaq 0x1f3b5d(%rip), %rcx    # 0x295758
movss 0x158(%rcx), %xmm0
movl %r8d, %ecx
movq %rcx, -0x8(%rsp)
shlq $0x3, %rax
leaq (%rax,%rax,4), %rdx
xorl %r10d, %r10d
movl $0x0, -0x14(%rsp)
movq 0x18(%rdi,%r10), %rax
testq %rax, %rax
js 0xa1d0a
movq (%rdi,%r10), %r11
movq %r11, %rcx
shrq $0x20, %rcx
leaq (%rcx,%rcx,2), %r9
movl (%rsi,%r9,4), %r8d
testl %r8d, %r8d
js 0xa1d0a
movl 0xc(%rdi,%r10), %ecx
leaq (%rcx,%rcx,2), %rcx
leaq (%rsi,%rcx,4), %rbx
movl (%rbx), %ecx
testl %ecx, %ecx
js 0xa1d0a
movl 0x4(%rbx), %ebx
subl %ecx, %ebx
testl %eax, %eax
js 0xa1c7c
movl 0x10(%rdi,%r10), %r13d
movl 0x14(%rdi,%r10), %r12d
subl %r12d, %ebx
movl %ebx, %ebp
movl %r13d, %ebx
jmp 0xa1c8c
movl 0x10(%rdi,%r10), %r13d
movl 0x14(%rdi,%r10), %r12d
subl %r12d, %ebx
movl %r13d, %ebp
leaq (%rsi,%r9,4), %rax
movl 0x4(%rax), %ecx
subl %r8d, %ecx
cmpl %r11d, %ebx
movl %r11d, %eax
cmovll %ebx, %eax
movl 0x8(%rdi,%r10), %r15d
movl %ecx, %r14d
subl %r15d, %r14d
cmpl %ebp, %r14d
movl %ebp, %r8d
cmovll %r14d, %r8d
movl -0xc(%rsp), %r9d
cmpl %r9d, %eax
jg 0xa1d0a
cmpl %r9d, %r8d
jg 0xa1d0a
movl %r15d, %r9d
subl %r11d, %r9d
xorps %xmm1, %xmm1
cvtsi2ss %r9, %xmm1
addl %eax, %r9d
addl %r8d, %r9d
xorps %xmm2, %xmm2
cvtsi2ss %r9, %xmm2
mulss %xmm0, %xmm2
ucomiss %xmm1, %xmm2
ja 0xa1d0a
subl %r13d, %r12d
xorps %xmm1, %xmm1
cvtsi2ss %r12, %xmm1
addl %eax, %r8d
addl %r12d, %r8d
xorps %xmm2, %xmm2
cvtsi2ss %r8, %xmm2
mulss %xmm0, %xmm2
ucomiss %xmm1, %xmm2
jbe 0xa1d19
addq $0x28, %r10
cmpq %r10, %rdx
jne 0xa1c1e
jmp 0xa1d7d
cmpl %ebp, %r14d
setl %al
setg %r12b
cmpl %ebx, %r11d
setg %r13b
setl %r14b
orb %r12b, %r13b
cmpb $0x1, %r13b
jne 0xa1d0a
orb %al, %r14b
je 0xa1d0a
movl -0x10(%rsp), %eax
cmpl %eax, %r9d
jl 0xa1d0a
cmpl %eax, %r8d
jl 0xa1d0a
addl %r15d, %ebp
subl %ebp, %ecx
movl %r11d, %eax
subl %ebx, %eax
cmovlel %ecx, %eax
testl %eax, %eax
js 0xa1d0a
xorl %eax, %eax
cmpl %ebx, %r11d
setle %al
shrq $0x1f, %r11
andl $-0x2, %r11d
orl %r11d, %eax
xorl %ecx, %ecx
cmpl -0x8(%rsp), %eax
sete %cl
addl %ecx, -0x14(%rsp)
jmp 0xa1d0a
movl -0x14(%rsp), %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq