// File: /workspace/github_cpp_makefile_star2_O1/Proudc[P]CTSS/src/Test.cpp
// Function: eucContinuousQuery(Graph*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, int)
void eucContinuousQuery(Graph* myGraph, string inputFolder, string outputFolder, const int startCount, const int stopCount)
{
	int count = startCount;
	while (count <= stopCount)
	{
		printf("Start %dth query...\n", count);
		string strCount = changeIntToStr(count);
		ReferencePath* referencePath = new ReferencePath;
		CompletePath*  completePath  = new CompletePath;
		setQueryEnv(myGraph, referencePath, completePath, inputFolder, strCount);
		
		int    currentVertex = completePath->initialVertex;
		int    recordPos = 0;
		Record record[completePath->edges.size()];
		double currPathLength = 0.0;
		int    temConQueryPos = 0;
		clock_t startTime = clock();
		for (unsigned int i = 1; i < completePath->edges.size(); i++)
		{
			currPathLength += completePath->edges[i - 1].realLength;
			if (completePath->edges[i - 1].firstVertexID == currentVertex)
			{
				currentVertex = completePath->edges[i - 1].secVertexID;
			}
			else
			{
				currentVertex = completePath->edges[i - 1].firstVertexID;
			}

			vector<Edge> currentPath;
			setCurrPath(myGraph, &currentPath, completePath, i);
			
			Record* temRecord = new Record;
			temRecord->ratioNumEdge     = ((double)(i)) / completePath->edges.size();
			temRecord->runTime          = 0;
			temRecord->comPathSize      = completePath->edges.size();
			temRecord->numOfOutPriQueue = 0;
			temRecord->referPathLength  = referencePath->referenceLength;
			temRecord->ratioPathLength  = currPathLength / (completePath->completeLength);
			temRecord->currPathLength   = currPathLength;
			temRecord->comPathLength    = completePath->completeLength;
			record[recordPos++] = (*temRecord);

			
			double x1 = myGraph->vertexsVector[currentVertex].longitude;
			double y1 = myGraph->vertexsVector[currentVertex].latitude;
			double x2 = referencePath->pointOfRefer[temConQueryPos].x;
			double y2 = referencePath->pointOfRefer[temConQueryPos].y;
			if (euc(x1, y1, x2, y2) <= (myGraph->delta))
			{
				continue;
			}
			else
			{
				temRecord->eucConQueryPos = temConQueryPos;
				bool queryResultFlag = eucSimpleQueryPath(myGraph, referencePath, currentPath, temRecord, currentVertex);
				temConQueryPos = temRecord->eucConQueryPos;
				if (queryResultFlag == false)
				{
					break;
				}
			}

		}
		clock_t stopTime = clock();
		string writeFilePath = outputFolder + "/" + strCount + "eucContinuousQuery.txt";
		writeContinuousRecordToFile(record, recordPos, writeFilePath, (double)(stopTime - startTime) / CLOCKS_PER_SEC);
		
		delete referencePath;
		delete completePath;
		count++;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rdx, -0xb8(%rbp)
movq %rsi, -0xc0(%rbp)
movq %rdi, -0x78(%rbp)
movl %r8d, -0x84(%rbp)
cmpl %r8d, %ecx
jg 0x36b1
movl %ecx, %ebx
leaq -0x148(%rbp), %r12
leaq -0x168(%rbp), %r15
leaq -0x128(%rbp), %r14
leaq 0x8f32(%rip), %rdi      # 0xc072
movl %ebx, %esi
xorl %eax, %eax
callq 0x2040
leaq -0xb0(%rbp), %rdi
movl %ebx, %esi
callq 0x4f6b
movl $0x38, %edi
callq 0x2150
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rax)
movq %rax, -0x40(%rbp)
movq $0x0, 0x30(%rax)
movl $0x28, %edi
callq 0x2150
movq %rax, %r13
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rax)
movq $0x0, 0x20(%rax)
movq %r12, -0x158(%rbp)
movq -0xc0(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x158(%rbp), %rdi
callq 0x4c3e
movq %r13, -0x38(%rbp)
movq %r15, -0x178(%rbp)
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
addq %rsi, %rdx
leaq -0x178(%rbp), %r13
movq %r13, %rdi
callq 0x4c3e
movq -0x78(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
leaq -0x158(%rbp), %rcx
movq %r13, %r8
callq 0x5015
movq -0x178(%rbp), %rdi
cmpq %r15, %rdi
je 0x320f
callq 0x2130
movq %rbx, -0xd0(%rbp)
movq -0x158(%rbp), %rdi
cmpq %r12, %rdi
movq -0x38(%rbp), %rbx
je 0x322b
callq 0x2130
movq %rsp, -0xc8(%rbp)
movl (%rbx), %eax
movl %eax, -0x2c(%rbp)
movq 0x18(%rbx), %rax
subq 0x10(%rbx), %rax
sarq %rax
leaq (%rax,%rax,4), %rax
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x90(%rbp)
movq %rcx, %rsp
callq 0x20d0
movq %rax, -0xd8(%rbp)
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %rcx
subq %rax, %rcx
movq $0x0, -0x48(%rbp)
cmpq $0x21, %rcx
jb 0x3493
movl $0x0, -0x30(%rbp)
xorpd %xmm0, %xmm0
movsd %xmm0, -0x80(%rbp)
movl $0x1, %ecx
movl $0x8, %ebx
movl $0x4, %r15d
movq -0x90(%rbp), %r13
movsd -0x80(%rbp), %xmm0
addsd 0x14(%rax,%r15), %xmm0
movsd %xmm0, -0x80(%rbp)
movl -0x2c(%rbp), %edx
cmpl %edx, (%rax,%r15)
movq %r15, %rdx
cmoveq %rbx, %rdx
movl (%rax,%rdx), %eax
movl %eax, -0x2c(%rbp)
xorpd %xmm0, %xmm0
movapd %xmm0, -0x70(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x78(%rbp), %r12
movq %r12, %rdi
leaq -0x70(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq %rcx, -0x48(%rbp)
callq 0x5647
movl $0x50, %edi
callq 0x2150
movq %rax, %r14
movslq -0x2c(%rbp), %rax
movl -0x48(%rbp), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
movq -0x38(%rbp), %rdx
movq 0x18(%rdx), %rcx
subq 0x10(%rdx), %rcx
sarq $0x5, %rcx
movq %rcx, %xmm1
punpckldq 0x8cf3(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x8cfb(%rip), %xmm1     # 0xc030
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
movsd %xmm0, 0x38(%r14)
movq $0x0, 0x20(%r14)
movl %ecx, 0x14(%r14)
movl $0x0, 0x10(%r14)
movq -0x40(%rbp), %r8
movsd 0x18(%r8), %xmm0
movsd %xmm0, 0x48(%r14)
movsd 0x8(%rdx), %xmm0
movsd -0x80(%rbp), %xmm2
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%r14)
movsd %xmm2, 0x28(%r14)
movsd %xmm0, 0x30(%r14)
movl $0xa, %ecx
movq %r13, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq 0x10(%r12), %rcx
imulq $0x70, %rax, %rax
movsd 0x18(%rcx,%rax), %xmm0
movsd 0x20(%rcx,%rax), %xmm1
movq 0x10(%r8), %rax
movslq -0x30(%rbp), %rcx
shlq $0x4, %rcx
movsd (%rax,%rcx), %xmm2
movsd 0x8(%rax,%rcx), %xmm3
callq 0x5db5
movsd 0x18(%r12), %xmm1
movl $0x6, %r12d
ucomisd %xmm0, %xmm1
jae 0x343d
movl -0x30(%rbp), %eax
movl %eax, 0x1c(%r14)
leaq -0x190(%rbp), %r12
movq %r12, %rdi
leaq -0x70(%rbp), %rsi
callq 0x4bba
movq -0x78(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq %r12, %rdx
movq %r14, %rcx
movl -0x2c(%rbp), %r8d
callq 0x85d4
movl %eax, %r12d
movq -0x190(%rbp), %rdi
testq %rdi, %rdi
je 0x342a
callq 0x2130
movl 0x1c(%r14), %eax
movl %eax, -0x30(%rbp)
xorb $0x1, %r12b
movzbl %r12b, %r12d
shll $0x2, %r12d
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x344b
callq 0x2130
cmpl $0x6, %r12d
je 0x3456
testl %r12d, %r12d
jne 0x3485
movq -0x38(%rbp), %rcx
movq 0x10(%rcx), %rax
movq 0x18(%rcx), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
movq -0x48(%rbp), %rcx
incq %rcx
addq $0x50, %r13
addq $0x20, %rbx
addq $0x20, %r15
cmpq %rcx, %rdx
ja 0x32a6
leaq -0x128(%rbp), %r14
leaq -0x148(%rbp), %r12
callq 0x20d0
movq %rax, %r15
movq %r14, -0x138(%rbp)
movq -0xb8(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x138(%rbp), %r13
movq %r13, %rdi
callq 0x4c3e
leaq -0xe8(%rbp), %rbx
movq %r13, %rdi
leaq 0x8bb4(%rip), %rsi      # 0xc087
callq 0x2250
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
movq %r13, %rdi
callq 0x2060
movq %rbx, -0xf8(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq -0x118(%rbp), %r13
je 0x351e
movq %rdx, -0xf8(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xe8(%rbp)
jmp 0x3526
movupd (%rcx), %xmm0
movupd %xmm0, (%rbx)
movq 0x8(%rax), %rdx
movq %rdx, -0xf0(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0xf8(%rbp), %rdi
leaq 0x8b3b(%rip), %rsi      # 0xc089
callq 0x2250
leaq -0x60(%rbp), %rsi
movq %rsi, -0x70(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3577
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x357f
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x68(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0xf8(%rbp), %rdi
cmpq %rbx, %rdi
je 0x35a7
callq 0x2130
movq -0x138(%rbp), %rdi
cmpq %r14, %rdi
je 0x35b8
callq 0x2130
leaq -0x108(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x4c3e
subq -0xd8(%rbp), %r15
xorps %xmm0, %xmm0
cvtsi2sd %r15, %xmm0
divsd 0x8a60(%rip), %xmm0     # 0xc050
movq -0x90(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq %r13, %rdx
callq 0x640c
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
movq -0xd0(%rbp), %r15
movq -0x38(%rbp), %r13
je 0x3626
callq 0x2130
movq -0x40(%rbp), %rcx
movq %rcx, %rax
addq $0x20, %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x3642
callq 0x2130
movq -0x40(%rbp), %rcx
movq %r13, %rbx
addq $0x10, %rbx
movq %rcx, %rdi
callq 0x2130
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x365e
callq 0x2130
movq %r13, %rdi
callq 0x2130
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x3678
callq 0x2130
movq -0xc8(%rbp), %rsp
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x3697
callq 0x2130
leal 0x1(%r15), %eax
cmpl -0x84(%rbp), %r15d
movl %eax, %ebx
leaq -0x168(%rbp), %r15
jne 0x3139
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x36c2
movq %rax, %rbx
jmp 0x36de
movq %rbx, %rcx
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
cmpq %rcx, %rdi
je 0x36de
callq 0x2130
movq -0x138(%rbp), %rdi
cmpq %r14, %rdi
jne 0x377a
jmp 0x377f
movq %rax, %rbx
jmp 0x3713
movq %rax, %rbx
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x3713
callq 0x2130
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
jne 0x377a
jmp 0x377f
jmp 0x374d
jmp 0x374d
movq %rax, %rbx
jmp 0x373f
movq %rax, %rbx
movq -0x178(%rbp), %rdi
cmpq %r15, %rdi
je 0x373f
callq 0x2130
movq -0x158(%rbp), %rdi
cmpq %r12, %rdi
jne 0x377a
jmp 0x377f
movq %rax, %rbx
jmp 0x377f
movq %rax, %rbx
movq -0x190(%rbp), %rdi
testq %rdi, %rdi
je 0x3771
callq 0x2130
jmp 0x3771
jmp 0x376e
jmp 0x376e
jmp 0x376e
movq %rax, %rbx
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x377f
callq 0x2130
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x3797
callq 0x2130
movq %rbx, %rdi
callq 0x2220