// File: /workspace/github_cpp_makefile_star2_O2/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
imulq $0x18, %r14, %rdi
movslq %edx, %r9
movq (%rax,%rdi), %rax
movsd (%rax,%r9,8), %xmm2
ucomisd 0x42f9(%rip), %xmm2     # 0xa968
ja 0x6888
movq %rcx, %r15
movl %edx, %r12d
movl %esi, %r13d
movl %edx, %ecx
orl %esi, %ecx
je 0x6700
testl %r12d, %r12d
sete %cl
testl %r13d, %r13d
setg %dl
testb %cl, %dl
je 0x6731
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 0x663c
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), %rax
movsd %xmm2, (%rax,%r12,8)
jmp 0x6888
movsd (%r15), %xmm0
subsd (%r8), %xmm0
movsd 0x8(%r15), %xmm1
subsd 0x8(%r8), %xmm1
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
sqrtsd %xmm0, %xmm2
movsd %xmm2, (%rax,%r9,8)
jmp 0x6888
testl %r13d, %r13d
setne %cl
testl %r12d, %r12d
setle %dl
orb %cl, %dl
jne 0x67a6
decl %r12d
movq %rdi, %r13
movq %rbx, %rdi
movq %r9, %r14
xorl %esi, %esi
movl %r12d, %edx
movq %r15, %rcx
movq %r8, %r12
callq 0x663c
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), %rax
movsd %xmm2, (%rax,%r14,8)
jmp 0x6888
testl %r12d, %r12d
setle %cl
testl %r13d, %r13d
setle %dl
orb %cl, %dl
jne 0x6872
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 0x663c
movsd %xmm0, -0x48(%rbp)
decl %r12d
movq %rbx, %rdi
movl -0x30(%rbp), %esi
movl %r12d, %edx
movq %r15, %rcx
movq -0x40(%rbp), %r8
callq 0x663c
movsd %xmm0, -0x30(%rbp)
movq %rbx, %rdi
movl %r13d, %esi
movl %r12d, %edx
movq %r15, %rcx
movq -0x40(%rbp), %r12
movq %r12, %r8
callq 0x663c
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), %rax
movsd %xmm2, (%rax,%rcx,8)
jmp 0x6888
movabsq $0x7fefffffffffffff, %rcx # imm = 0x7FEFFFFFFFFFFFFF
movq %rcx, (%rax,%r9,8)
movsd 0x38c8(%rip), %xmm2     # 0xa150
movapd %xmm2, %xmm0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq