// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/inter.cpp
// Function: get_ug_edge_src(ma_ug_t*, ma_hit_t_alloc*, long, long, unsigned int, unsigned int)
ma_hit_t *get_ug_edge_src(ma_ug_t *ug, ma_hit_t_alloc *src, int64_t max_hang, int64_t min_ovlp, uint32_t uv, uint32_t uw)
{
	if(ug->u.a[uv>>1].circ || ug->u.a[uw>>1].circ) return NULL;
	uint32_t v, w, k, qn, tn; int32_t r; asg_arc_t t;
    v = ((uv&1)?(ug->u.a[uv>>1].start^1):(ug->u.a[uv>>1].end^1));
    w = ((uw&1)?(ug->u.a[uw>>1].end):(ug->u.a[uw>>1].start));
    ma_hit_t_alloc *x = &(src[v>>1]);

	for (k = 0; k < x->length; k++) {
        qn = Get_qn(x->buffer[k]);
        tn = Get_tn(x->buffer[k]);
        if(qn == (v>>1) && tn == (w>>1)) {
            r = ma_hit2arc(&(x->buffer[k]), Get_READ_LENGTH(R_INF, v>>1), Get_READ_LENGTH(R_INF, w>>1),
			max_hang, asm_opt.max_hang_rate, min_ovlp, &t);
            if(r < 0) continue;
            if((t.ul>>32)!=v || t.v!=w) continue;
			return &(x->buffer[k]);
        }
    }

	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, -0x20(%rsp)
movq 0x10(%rdi), %rax
movl %r8d, %edx
shrl %edx
leaq (%rdx,%rdx,4), %rdx
cmpl $0x0, (%rax,%rdx,8)
js 0x1ab633
movl %r9d, %edi
shrl %edi
leaq (%rdi,%rdi,4), %r11
cmpl $0x0, (%rax,%r11,8)
js 0x1ab633
xorl %edi, %edi
testb $0x1, %r8b
sete %dil
leaq (%rax,%rdx,8), %rdx
movl 0x4(%rdx,%rdi,4), %edi
movl %edi, %r8d
shrl %r8d
leaq (%r8,%r8,2), %rdx
movl 0xc(%rsi,%rdx,8), %r10d
testq %r10, %r10
je 0x1ab633
movq %rcx, -0x30(%rsp)
leaq (%rax,%r11,8), %rax
andl $0x1, %r9d
movl 0x4(%rax,%r9,4), %r9d
leaq (%rsi,%rdx,8), %rax
xorq $0x1, %rdi
movq %rdi, -0x10(%rsp)
movq (%rax), %rax
movl %r9d, %esi
shrl %esi
leaq 0xead73(%rip), %rcx     # 0x296230
movq 0x18(%rcx), %rcx
movq %rcx, -0x28(%rsp)
leaq 0xea28b(%rip), %rcx     # 0x295758
movss 0x158(%rcx), %xmm0
movq %r9, -0x18(%rsp)
movl %r9d, %ecx
andl $-0x2, %ecx
movl %ecx, -0x34(%rsp)
movq (%rax), %r14
movq %r14, %rcx
shrq $0x20, %rcx
cmpl %ecx, %r8d
jne 0x1ab5a8
cmpl %esi, 0xc(%rax)
jne 0x1ab5a8
movq -0x28(%rsp), %rcx
movl (%rcx,%rsi,8), %ebp
movq 0x18(%rax), %rcx
movq %rcx, -0x8(%rsp)
testl %ecx, %ecx
js 0x1ab524
movl 0x10(%rax), %ecx
movl 0x14(%rax), %edi
subl %edi, %ebp
movl %ebp, %r12d
movl %ecx, %ebp
jmp 0x1ab52f
movl 0x10(%rax), %ecx
movl 0x14(%rax), %edi
subl %edi, %ebp
movl %ecx, %r12d
movq -0x28(%rsp), %rdx
movl (%rdx,%r8,8), %edx
cmpl %r14d, %ebp
movl %r14d, %r15d
cmovll %ebp, %r15d
movl 0x8(%rax), %r9d
movl %edx, %r13d
subl %r9d, %r13d
cmpl %r12d, %r13d
movl %r12d, %ebx
cmovll %r13d, %ebx
cmpl -0x20(%rsp), %r15d
jg 0x1ab5a8
cmpl -0x20(%rsp), %ebx
jg 0x1ab5a8
movl %r9d, %r11d
subl %r14d, %r11d
xorps %xmm1, %xmm1
cvtsi2ss %r11, %xmm1
addl %r15d, %r11d
addl %ebx, %r11d
xorps %xmm2, %xmm2
cvtsi2ss %r11, %xmm2
mulss %xmm0, %xmm2
ucomiss %xmm1, %xmm2
ja 0x1ab5a8
subl %ecx, %edi
xorps %xmm1, %xmm1
cvtsi2ss %rdi, %xmm1
addl %r15d, %ebx
addl %edi, %ebx
xorps %xmm2, %xmm2
cvtsi2ss %rbx, %xmm2
mulss %xmm0, %xmm2
ucomiss %xmm1, %xmm2
jbe 0x1ab5b7
addq $0x28, %rax
decq %r10
jne 0x1ab4e4
jmp 0x1ab633
cmpl %r12d, %r13d
setl %cl
setg %r15b
cmpl %ebp, %r14d
setg %r13b
setl %dil
orb %r15b, %r13b
cmpb $0x1, %r13b
jne 0x1ab5a8
orb %cl, %dil
je 0x1ab5a8
cmpl -0x30(%rsp), %r11d
jl 0x1ab5a8
cmpl -0x30(%rsp), %ebx
jl 0x1ab5a8
addl %r9d, %r12d
subl %r12d, %edx
movl %r14d, %ecx
subl %ebp, %ecx
cmovlel %edx, %ecx
testl %ecx, %ecx
js 0x1ab5a8
xorl %edi, %edi
cmpl %ebp, %r14d
setle %dil
setg %cl
cmpl $0x0, -0x8(%rsp)
setns %dl
shrq $0x1f, %r14
andl $-0x2, %r14d
orl %r14d, %edi
cmpl -0x10(%rsp), %edi
jne 0x1ab5a8
xorb %cl, %dl
movzbl %dl, %ecx
orl -0x34(%rsp), %ecx
cmpl -0x18(%rsp), %ecx
jne 0x1ab5a8
jmp 0x1ab635
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq