// File: /workspace/github_cpp_makefile_star2_O3/Proudc[P]CTSS/src/ContinuousQuery/Frechet.cpp
// Function: (anonymous namespace)::dist(std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>>&, int, int, Point*, Point*)
double dist(std::vector<std::vector<double>>& ca, int i, int j, Point* p, Point* q)
{
	if (ca[i][j] > -1)
	{
		return ca[i][j];
	}
	else if (i == 0 && j == 0)
	{
		ca[i][j] = euc(p[0], q[0]);
	}
	else if (i > 0 && j == 0)
	{
		ca[i][j] = max(dist(ca, i - 1, 0, p, q), euc(p[i], q[0]));
	}
	else if (i == 0 && j > 0)
	{
		ca[i][j] = max(dist(ca, 0, j - 1, p, q), euc(p[0], q[j]));
	}
	else if (i > 0 && j > 0)
	{
		ca[i][j] = max(
			min(
				dist(ca, i - 1, j, p, q),
				dist(ca, i - 1, j - 1, p, q),
				dist(ca, i, j - 1, p, q)),
			euc(p[i], q[j]));
	}
	else
	{
		ca[i][j] = DBL_MAX;
	}
	return ca[i][j];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movslq %esi, %r14
movq (%rdi), %rax
leaq (%r14,%r14,2), %rdi
movslq %edx, %r9
movq (%rax,%rdi,8), %rax
movsd (%rax,%r9,8), %xmm2
ucomisd 0x4f87(%rip), %xmm2     # 0xc998
ja 0x7c2d
movq %rcx, %r15
movl %edx, %r12d
movl %esi, %r13d
movl %edx, %ecx
orl %esi, %ecx
je 0x7aa2
testl %r12d, %r12d
sete %cl
testl %r13d, %r13d
setg %dl
testb %cl, %dl
je 0x7ad6
decl %r13d
movq %rdi, -0x38(%rbp)
movq %rbx, %rdi
movq %r9, %r12
movl %r13d, %esi
xorl %edx, %edx
movq %r15, %rcx
movq %r8, %r13
callq 0x79de
movapd %xmm0, %xmm2
shlq $0x4, %r14
movsd (%r15,%r14), %xmm0
movsd 0x8(%r15,%r14), %xmm1
subsd (%r13), %xmm0
subsd 0x8(%r13), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
maxsd %xmm0, %xmm2
movq (%rbx), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm2, (%rax,%r12,8)
jmp 0x7c2d
movsd (%r15), %xmm0
subsd (%r8), %xmm0
movsd 0x8(%r15), %xmm1
subsd 0x8(%r8), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
xorps %xmm2, %xmm2
sqrtsd %xmm0, %xmm2
movsd %xmm2, (%rax,%r9,8)
jmp 0x7c2d
testl %r13d, %r13d
setne %cl
testl %r12d, %r12d
setle %dl
orb %cl, %dl
jne 0x7b4b
decl %r12d
movq %rdi, %r13
movq %rbx, %rdi
movq %r9, %r14
xorl %esi, %esi
movl %r12d, %edx
movq %r15, %rcx
movq %r8, %r12
callq 0x79de
movapd %xmm0, %xmm2
movsd (%r15), %xmm0
movsd 0x8(%r15), %xmm1
movq %r14, %rax
shlq $0x4, %rax
subsd (%r12,%rax), %xmm0
subsd 0x8(%r12,%rax), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
maxsd %xmm0, %xmm2
movq (%rbx), %rax
movq (%rax,%r13,8), %rax
movsd %xmm2, (%rax,%r14,8)
jmp 0x7c2d
testl %r12d, %r12d
setle %cl
testl %r13d, %r13d
setle %dl
orb %cl, %dl
jne 0x7c17
leal -0x1(%r13), %esi
movl %esi, -0x30(%rbp)
movq %rdi, -0x38(%rbp)
movq %rbx, %rdi
movq %r9, -0x50(%rbp)
movl %r12d, %edx
movq %r15, %rcx
movq %r8, -0x40(%rbp)
callq 0x79de
movsd %xmm0, -0x48(%rbp)
decl %r12d
movq %rbx, %rdi
movl -0x30(%rbp), %esi
movl %r12d, %edx
movq %r15, %rcx
movq -0x40(%rbp), %r8
callq 0x79de
movsd %xmm0, -0x30(%rbp)
movq %rbx, %rdi
movl %r13d, %esi
movl %r12d, %edx
movq %r15, %rcx
movq -0x40(%rbp), %r12
movq %r12, %r8
callq 0x79de
movsd -0x48(%rbp), %xmm2
minsd -0x30(%rbp), %xmm2
minsd %xmm0, %xmm2
shlq $0x4, %r14
movsd (%r15,%r14), %xmm0
movsd 0x8(%r15,%r14), %xmm1
movq -0x50(%rbp), %rcx
movq %rcx, %rax
shlq $0x4, %rax
subsd (%r12,%rax), %xmm0
subsd 0x8(%r12,%rax), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm0
maxsd %xmm0, %xmm2
movq (%rbx), %rax
movq -0x38(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movsd %xmm2, (%rax,%rcx,8)
jmp 0x7c2d
movabsq $0x7fefffffffffffff, %rcx # imm = 0x7FEFFFFFFFFFFFFF
movq %rcx, (%rax,%r9,8)
movsd 0x454b(%rip), %xmm2     # 0xc178
movapd %xmm2, %xmm0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq