// File: chhylp123[P]hifiasm/inter.cpp
// Function: is_compat_contig_chain(asg_t const*, ul_ov_t*, ul_ov_t*, mg_lchain_t*, double)
inline uint32_t is_compat_contig_chain(const asg_t *g, ul_ov_t *p, ul_ov_t *m, mg_lchain_t *a, double overhead)
{
	uint64_t ovlp;
	ovlp = ((MIN(m->qe, p->qe) > MAX(m->qs, p->qs))? (MIN(m->qe, p->qe) - MAX(m->qs, p->qs)):0);
	if(ovlp == 0) return 1;
	if(ovlp == (m->qe - m->qs)) return 0;////contain
	if(ovlp == (p->qe - p->qs)) return 0;////contain
	ul_ov_t *i0, *i1; 
	if(p->qs <= m->qs) {
		i0 = p; i1 = m;
	} else {
		i0 = m; i1 = p;
	}

	uint64_t o0 = max_ovlp(g,a[i0->te-1].v);
	uint64_t o1 = max_ovlp(g,a[i1->ts].v^1);
	uint64_t cut = MIN(o0, o1); cut *= (1 + overhead);
	if(ovlp > cut) return 0;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movsd %xmm0, -0x30(%rbp)
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x8(%rcx), %eax
ja 0x30d00c
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x64(%rbp)
jmp 0x30d016
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl %eax, -0x68(%rbp)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jb 0x30d038
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x6c(%rbp)
jmp 0x30d042
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x6c(%rbp)
movl -0x68(%rbp), %eax
movl -0x6c(%rbp), %ecx
cmpl %ecx, %eax
jbe 0x30d0ab
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x8(%rcx), %eax
ja 0x30d068
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x70(%rbp)
jmp 0x30d072
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %eax
movl %eax, -0x74(%rbp)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jb 0x30d094
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x78(%rbp)
jmp 0x30d09e
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x78(%rbp)
movl -0x74(%rbp), %eax
movl -0x78(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x7c(%rbp)
jmp 0x30d0b2
xorl %eax, %eax
movl %eax, -0x7c(%rbp)
jmp 0x30d0b2
movl -0x7c(%rbp), %eax
movl %eax, %eax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x30d0ce
movl $0x1, -0x4(%rbp)
jmp 0x30d243
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
movl 0x8(%rcx), %ecx
movq -0x20(%rbp), %rdx
subl 0x4(%rdx), %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jne 0x30d0f3
movl $0x0, -0x4(%rbp)
jmp 0x30d243
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x8(%rcx), %ecx
movq -0x18(%rbp), %rdx
subl 0x4(%rdx), %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jne 0x30d118
movl $0x0, -0x4(%rbp)
jmp 0x30d243
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x20(%rbp), %rcx
cmpl 0x4(%rcx), %eax
ja 0x30d13a
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x30d14a
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rax
movq -0x40(%rbp), %rcx
movl 0x14(%rcx), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
callq 0x287d20
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rax
movq -0x48(%rbp), %rcx
movl 0x10(%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
xorl $0x1, %esi
callq 0x287d20
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x58(%rbp), %rax
ja 0x30d1ad
movq -0x50(%rbp), %rax
movq %rax, -0x88(%rbp)
jmp 0x30d1b8
movq -0x58(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x60(%rbp)
movsd -0x30(%rbp), %xmm1
movsd 0x74e30(%rip), %xmm0    # 0x382000
addsd %xmm0, %xmm1
movaps 0x74e35(%rip), %xmm2    # 0x382010
movq -0x60(%rbp), %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x74e34(%rip), %xmm2    # 0x382020
subpd %xmm2, %xmm0
movaps %xmm0, %xmm2
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm2, %xmm0
mulsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x74de2(%rip), %xmm1    # 0x381ff8
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x60(%rbp), %rax
jbe 0x30d23c
movl $0x0, -0x4(%rbp)
jmp 0x30d243
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nop