// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/inter.cpp
// Function: query_ovlp_src(ug_opt_t const*, unsigned int, unsigned int, long, double, unsigned int*)
ma_hit_t* query_ovlp_src(const ug_opt_t *uopt, uint32_t v, uint32_t w, int64_t o, double diff_ec_ul, uint32_t *ol)
{
	ma_hit_t_alloc* src = uopt->sources;
    int64_t min_ovlp = uopt->min_ovlp;
    int64_t max_hang = uopt->max_hang, d, l, max_l;
    uint64_t z, qn, tn, x = v>>1; int32_t r = 1; asg_arc_t e;
	l = (o>=0?o:-o); //l *= diff_ec_ul;
	if(l <= 0) return NULL;
    for (z = 0; z < src[x].length; z++) {
        qn = Get_qn(src[x].buffer[z]); tn = Get_tn(src[x].buffer[z]);
        if(tn != (w>>1)) continue;
        r = ma_hit2arc(&(src[x].buffer[z]), Get_READ_LENGTH(R_INF, qn), Get_READ_LENGTH(R_INF, tn), max_hang, asm_opt.max_hang_rate, min_ovlp, &e);
        if(r < 0) continue;
		if((e.ul>>32) != v || e.v != w) continue;
		// if(v == 56 && w == 25) fprintf(stderr, "+xxxx, o:%ld, e.ol:%u\n", o, e.ol);
		// if(v == 25 && w == 56) fprintf(stderr, "-xxxx, o:%ld, e.ol:%u\n", o, e.ol);
		d = (o>=e.ol?o-e.ol:e.ol-o);
		max_l = MAX(l, e.ol);
		if(d <= (max_l*diff_ec_ul)) {
			if(ol) (*ol) = e.ol;
			return &(src[x].buffer[z]);
		}
    }
	return NULL;
}

// Assembly:
movq %rcx, %r11
negq %r11
cmovsq %rcx, %r11
jae 0x1aa4ce
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %esi, %r9d
shrl %r9d
movq 0x8(%rdi), %rax
leaq (%r9,%r9,2), %r9
movl 0xc(%rax,%r9,8), %r10d
testq %r10, %r10
je 0x1aa4c1
movq %r11, -0x18(%rsp)
movq %rcx, -0x10(%rsp)
movq %r8, -0x20(%rsp)
movl 0x40(%rdi), %ecx
movl %ecx, -0x34(%rsp)
movl 0x44(%rdi), %ecx
movl %ecx, -0x38(%rsp)
leaq (%rax,%r9,8), %rax
movq (%rax), %rax
movl %edx, %ebx
shrl %ebx
leaq 0xebf40(%rip), %rcx     # 0x296230
movq 0x18(%rcx), %rcx
movq %rcx, -0x28(%rsp)
leaq 0xeb458(%rip), %rcx     # 0x295758
movss 0x158(%rcx), %xmm1
movl %esi, %ecx
movq %rcx, -0x8(%rsp)
movl %edx, -0x2c(%rsp)
andl $-0x2, %edx
movl %edx, -0x30(%rsp)
cmpl %ebx, 0xc(%rax)
jne 0x1aa3d5
movq 0x18(%rax), %r12
movq -0x28(%rsp), %rcx
movl (%rcx,%rbx,8), %r13d
testl %r12d, %r12d
js 0x1aa346
movl 0x10(%rax), %ecx
movl 0x14(%rax), %ebp
subl %ebp, %r13d
movl %r13d, %edi
movl %ecx, %r13d
jmp 0x1aa351
movl 0x10(%rax), %ecx
movl 0x14(%rax), %ebp
subl %ebp, %r13d
movl %ecx, %edi
movq (%rax), %rsi
movq %rsi, %rdx
shrq $0x20, %rdx
movq -0x28(%rsp), %r8
movl (%r8,%rdx,8), %r11d
cmpl %esi, %r13d
movl %esi, %r14d
cmovll %r13d, %r14d
movl 0x8(%rax), %r8d
movl %r11d, %r15d
subl %r8d, %r15d
cmpl %edi, %r15d
movl %edi, %r9d
cmovll %r15d, %r9d
cmpl -0x34(%rsp), %r14d
jg 0x1aa3d5
cmpl -0x34(%rsp), %r9d
jg 0x1aa3d5
movl %r8d, %edx
subl %esi, %edx
xorps %xmm2, %xmm2
cvtsi2ss %rdx, %xmm2
addl %r14d, %edx
addl %r9d, %edx
xorps %xmm3, %xmm3
cvtsi2ss %rdx, %xmm3
mulss %xmm1, %xmm3
ucomiss %xmm2, %xmm3
ja 0x1aa3d5
subl %ecx, %ebp
xorps %xmm2, %xmm2
cvtsi2ss %rbp, %xmm2
addl %r14d, %r9d
addl %ebp, %r9d
xorps %xmm3, %xmm3
cvtsi2ss %r9, %xmm3
mulss %xmm1, %xmm3
ucomiss %xmm2, %xmm3
jbe 0x1aa3e7
addq $0x28, %rax
decq %r10
jne 0x1aa31a
jmp 0x1aa4c1
cmpl %edi, %r15d
setl %cl
setg %r14b
cmpl %r13d, %esi
setg %r15b
setl %bpl
orb %r14b, %r15b
cmpb $0x1, %r15b
jne 0x1aa3d5
orb %cl, %bpl
je 0x1aa3d5
cmpl -0x38(%rsp), %edx
jl 0x1aa3d5
cmpl -0x38(%rsp), %r9d
jl 0x1aa3d5
addl %r8d, %edi
movl %r11d, %edx
subl %edi, %edx
movl %esi, %ecx
subl %r13d, %ecx
cmovlel %edx, %ecx
testl %ecx, %ecx
js 0x1aa3d5
xorl %r8d, %r8d
cmpl %r13d, %esi
setle %r8b
setg %dl
testl %r12d, %r12d
setns %dil
shrq $0x1f, %rsi
andl $-0x2, %esi
orl %esi, %r8d
cmpl -0x8(%rsp), %r8d
jne 0x1aa3d5
xorb %dl, %dil
movzbl %dil, %edx
orl -0x30(%rsp), %edx
cmpl -0x2c(%rsp), %edx
jne 0x1aa3d5
subl %ecx, %r11d
andl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
movl %r11d, %ecx
movq %rcx, %rsi
subq -0x10(%rsp), %rsi
movq %rsi, %rdx
negq %rdx
cmovsq %rsi, %rdx
movq -0x18(%rsp), %rdi
movq %rdi, %rsi
cmpq %rcx, %rdi
ja 0x1aa494
movq %rcx, %rsi
xorps %xmm2, %xmm2
cvtsi2sd %rdx, %xmm2
xorps %xmm3, %xmm3
cvtsi2sd %rsi, %xmm3
mulsd %xmm0, %xmm3
ucomisd %xmm2, %xmm3
jb 0x1aa3d5
movq -0x20(%rsp), %rcx
testq %rcx, %rcx
je 0x1aa4c3
movl %r11d, (%rcx)
jmp 0x1aa4c3
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
retq