// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: get_specific_edge(ma_hit_t_alloc*, ma_sub_t*, R_to_U*, kvec_asg_arc_t_warp*, asg_t*, int, int, unsigned int, unsigned int, asg_arc_t*)
void get_specific_edge(ma_hit_t_alloc* sources, ma_sub_t *coverage_cut, 
R_to_U* ruIndex, kvec_asg_arc_t_warp* edge, asg_t* read_g, int max_hang, 
int min_ovlp, uint32_t query, uint32_t target, asg_arc_t* t)
{
    uint32_t nv, k;
    (*t).ul = (uint64_t)-1; (*t).v = (uint32_t)-1;
    if(read_g)
    {
        asg_arc_t* av = asg_arc_a(read_g, query);
        nv = asg_arc_n(read_g, query);
        for (k = 0; k < nv; k++)
        {
            if(av[k].del) continue;
            if(av[k].v == target) 
            {
                (*t) = av[k];
                break;
            }
        }
    }

    if((*t).ul == (uint64_t)-1)
    {
        if(get_edge_from_source(sources, coverage_cut, NULL, max_hang, min_ovlp, query, target, t)==0)
        {
            (*t).ul = (uint64_t)-1;
        }
    }
    
    if((*t).ul == (uint64_t)-1)
    {
        for (k = 0; k < edge->a.n; k++)
        {
            if(edge->a.a[k].del) continue;
            if((edge->a.a[k].ul>>32) == query && edge->a.a[k].v == target)
            {
                (*t) = edge->a.a[k];
                break;
            }
        }
        if(k == edge->a.n) fprintf(stderr, "ERROR\n");
    }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq 0x28(%rbp), %rax
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movq 0x28(%rbp), %rax
movq $-0x1, (%rax)
movq 0x28(%rbp), %rax
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
cmpq $0x0, -0x28(%rbp)
je 0xea8cf
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x28(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl 0x18(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rax
movl 0x18(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x30(%rbp), %eax
jae 0xea8cd
movq -0x40(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0xea880
jmp 0xea8c2
movq -0x40(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpl 0x20(%rbp), %eax
jne 0xea8c0
movq -0x40(%rbp), %rcx
movl -0x34(%rbp), %eax
imulq $0x18, %rax, %rax
addq %rax, %rcx
movq 0x28(%rbp), %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
jmp 0xea8cd
jmp 0xea8c2
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xea85d
jmp 0xea8cf
movq 0x28(%rbp), %rax
cmpq $-0x1, (%rax)
jne 0xea916
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x2c(%rbp), %ecx
movl 0x10(%rbp), %r8d
movl 0x18(%rbp), %r9d
movl 0x20(%rbp), %r10d
movq 0x28(%rbp), %rax
xorl %edx, %edx
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0xe9560
cmpl $0x0, %eax
jne 0xea914
movq 0x28(%rbp), %rax
movq $-0x1, (%rax)
jmp 0xea916
movq 0x28(%rbp), %rax
cmpq $-0x1, (%rax)
jne 0xea9f9
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpq (%rcx), %rax
jae 0xea9d3
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0xea95a
jmp 0xea9c5
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
movl 0x18(%rbp), %ecx
cmpq %rcx, %rax
jne 0xea9c3
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x34(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpl 0x20(%rbp), %eax
jne 0xea9c3
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
movl -0x34(%rbp), %eax
imulq $0x18, %rax, %rax
addq %rax, %rcx
movq 0x28(%rbp), %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
jmp 0xea9d3
jmp 0xea9c5
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xea92b
movl -0x34(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpq (%rcx), %rax
jne 0xea9f7
movq 0x2d95fa(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x29f0bf(%rip), %rsi    # 0x389aaf
movb $0x0, %al
callq 0x22a0
jmp 0xea9f9
addq $0x50, %rsp
popq %rbp
retq
nop