// File: Proudc[P]CTSS/src/ContinuousQuery/Base.cpp
// Function: setMinPosAndMaxPos(Graph*, ReferencePath*)
void setMinPosAndMaxPos(Graph* myGraph, ReferencePath* temReferPath)
{
	printf("Start to set the minPos and maxPos of each vertex...\n");
	for (unsigned int i = 0; i < (myGraph->vertexPos); i++)
	{
		myGraph->vertexsVector[i].minPos = 0;
		myGraph->vertexsVector[i].maxPos = 0;
		if (myGraph->vertexsVector[i].locationFlag == true)
		{
			double x1 = myGraph->vertexsVector[i].longitude;
			double y1 = myGraph->vertexsVector[i].latitude;
			for (unsigned int j = 0; j < temReferPath->numOfReferPoint; j++)
			{
				double x2 = temReferPath->pointOfRefer[j].x;
				double y2 = temReferPath->pointOfRefer[j].y;
				double dist = euc(x1, y1, x2, y2);
				if (dist <= (myGraph->delta))
				{
					myGraph->vertexsVector[i].minPos = j;
					break;
				}
			}
			int numOfReferPoint = temReferPath->numOfReferPoint - 1;
			for (int j = numOfReferPoint; j >= 0; j--)
			{
				double x2 = temReferPath->pointOfRefer[j].x;
				double y2 = temReferPath->pointOfRefer[j].y;
				double dist = euc(x1, y1, x2, y2);
				if (dist <= (myGraph->delta))
				{
					myGraph->vertexsVector[i].maxPos = j;
					break;
				}
			}
		}
	}
	printf("The minPos and maxPos of each vertex are set...\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0x11dcc(%rip), %rdi     # 0x19313
movb $0x0, %al
callq 0x2040
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jae 0x7760
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x4(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movb 0x11(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x7750
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movsd 0x18(%rax), %xmm0
movsd %xmm0, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jae 0x769c
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x2c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x2c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x20(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
movsd -0x38(%rbp), %xmm2
movsd -0x40(%rbp), %xmm3
callq 0x7780
movsd %xmm0, -0x48(%rbp)
movsd -0x48(%rbp), %xmm1
movq -0x8(%rbp), %rax
movsd 0x18(%rax), %xmm0
ucomisd %xmm1, %xmm0
jb 0x768c
movl -0x2c(%rbp), %ecx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %edx
imulq $0x70, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
jmp 0x769c
jmp 0x768e
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x75f9
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
subl $0x1, %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x50(%rbp)
cmpl $0x0, -0x50(%rbp)
jl 0x774e
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x50(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x50(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x20(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
movsd -0x58(%rbp), %xmm2
movsd -0x60(%rbp), %xmm3
callq 0x7780
movsd %xmm0, -0x68(%rbp)
movsd -0x68(%rbp), %xmm1
movq -0x8(%rbp), %rax
movsd 0x18(%rax), %xmm0
ucomisd %xmm1, %xmm0
jb 0x773e
movl -0x50(%rbp), %ecx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %edx
imulq $0x70, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
jmp 0x774e
jmp 0x7740
movl -0x50(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x76af
jmp 0x7750
jmp 0x7752
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x7555
leaq 0x11be2(%rip), %rdi     # 0x19349
movb $0x0, %al
callq 0x2040
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)