// File: /workspace/github_cpp_makefile_star2_O2/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 $0x178, %rsp            # imm = 0x178
movl %r8d, -0x54(%rbp)
movl %ecx, %ebx
movq %rdx, -0x88(%rbp)
movq %rsi, -0x90(%rbp)
movq %rdi, -0x48(%rbp)
leaq -0x128(%rbp), %r15
leaq -0x108(%rbp), %r12
cmpl -0x54(%rbp), %ebx
jg 0x2ffd
leaq 0x7454(%rip), %rdi      # 0xa072
movl %ebx, %esi
xorl %eax, %eax
callq 0x2040
movq %r15, %rdi
movl %ebx, %esi
callq 0x432e
pushq $0x38
popq %rdi
callq 0x2110
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rax)
movq %rax, -0x38(%rbp)
andq $0x0, 0x30(%rax)
pushq $0x28
popq %rdi
callq 0x2110
movq %rax, %r14
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rax)
andq $0x0, 0x20(%rax)
movq %r12, %rdi
movq -0x90(%rbp), %rsi
callq 0x2160
movq %r14, -0x40(%rbp)
leaq -0x1a0(%rbp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x2160
movl %ebx, -0x58(%rbp)
movq -0x48(%rbp), %rdi
movq -0x38(%rbp), %rbx
movq %rbx, %rsi
movq -0x40(%rbp), %r14
movq %r14, %rdx
movq %r12, %rcx
movq %r13, %r8
callq 0x4346
addq $0x20, %rbx
movq %rbx, -0x98(%rbp)
movq %r14, %rax
addq $0x10, %rax
movq %rax, -0xa8(%rbp)
movq %r13, %rdi
callq 0x2090
movq %r12, %rdi
callq 0x2090
movq %rsp, -0xa0(%rbp)
movl (%r14), %r12d
movq 0x18(%r14), %rax
subq 0x10(%r14), %rax
sarq $0x5, %rax
imulq $0x50, %rax, %rax
movq %rsp, %rbx
subq %rax, %rbx
movq %rbx, %rsp
xorpd %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
movl $0x0, -0x30(%rbp)
callq 0x20c0
movq %rax, -0xb0(%rbp)
movq %rbx, -0xb8(%rbp)
movq %rbx, -0x60(%rbp)
pushq $0x1
popq %rbx
pushq $0x4
popq %r15
pushq $0x8
popq %rsi
movl $0x0, -0x2c(%rbp)
movq %r14, %rdx
movq 0x10(%rdx), %rax
movq 0x18(%rdx), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %rbx, %rcx
xorpd %xmm0, %xmm0
jbe 0x2eff
movsd -0x50(%rbp), %xmm1
addsd 0x14(%rax,%r15), %xmm1
movsd %xmm1, -0x50(%rbp)
cmpl %r12d, (%rax,%r15)
movq %r15, -0xc8(%rbp)
movq %r15, %rcx
movq %rsi, -0xc0(%rbp)
cmoveq %rsi, %rcx
movl (%rax,%rcx), %r12d
movapd %xmm0, -0x80(%rbp)
andq $0x0, -0x70(%rbp)
movq -0x48(%rbp), %rdi
leaq -0x80(%rbp), %rsi
movq %rbx, %r15
movl %ebx, %ecx
callq 0x4709
movq -0x38(%rbp), %rbx
pushq $0x50
popq %rdi
callq 0x2110
movq %rax, %r14
movslq %r12d, %rax
movl %r15d, %ecx
cvtsi2sd %rcx, %xmm0
movq -0x40(%rbp), %rdx
movq 0x18(%rdx), %rcx
subq 0x10(%rdx), %rcx
sarq $0x5, %rcx
movq %rcx, %xmm1
punpckldq 0x7253(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x725b(%rip), %xmm1     # 0xa030
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
movsd %xmm0, 0x38(%r14)
andq $0x0, 0x20(%r14)
movl %ecx, 0x14(%r14)
andl $0x0, 0x10(%r14)
movsd 0x18(%rbx), %xmm0
movsd %xmm0, 0x48(%r14)
movsd 0x8(%rdx), %xmm0
movsd -0x50(%rbp), %xmm2
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%r14)
movsd %xmm2, 0x28(%r14)
movsd %xmm0, 0x30(%r14)
pushq $0xa
popq %rcx
movq -0x60(%rbp), %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x48(%rbp), %r13
movq 0x10(%r13), %rcx
imulq $0x70, %rax, %rax
movsd 0x18(%rcx,%rax), %xmm0
movsd 0x20(%rcx,%rax), %xmm1
movq 0x10(%rbx), %rax
movslq -0x30(%rbp), %rcx
shlq $0x4, %rcx
movsd (%rax,%rcx), %xmm2
movsd 0x8(%rax,%rcx), %xmm3
callq 0x4c79
movsd 0x18(%r13), %xmm1
ucomisd %xmm0, %xmm1
jae 0x2ebc
movl -0x30(%rbp), %eax
movl %eax, 0x1c(%r14)
leaq -0x140(%rbp), %rbx
movq %rbx, %rdi
leaq -0x80(%rbp), %rsi
callq 0x3fbc
movq -0x48(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %rbx, %rdx
movq %r14, %rcx
movl %r12d, %r8d
callq 0x7124
movl %eax, %r13d
movq %rbx, %rdi
callq 0x4092
testb %r13b, %r13b
je 0x2ef2
movl 0x1c(%r14), %eax
movl %eax, -0x30(%rbp)
movq %r15, %rbx
leaq -0x80(%rbp), %rdi
callq 0x4092
movq -0xc0(%rbp), %rsi
addq $0x20, %rsi
movq -0xc8(%rbp), %r15
addq $0x20, %r15
incq %rbx
addq $0x50, -0x60(%rbp)
incl -0x2c(%rbp)
movq -0x40(%rbp), %rdx
jmp 0x2d30
leaq -0x80(%rbp), %rdi
callq 0x4092
movl %r15d, -0x2c(%rbp)
callq 0x20c0
movq %rax, %rbx
leaq -0xe8(%rbp), %r13
movq %r13, %rdi
movq -0x88(%rbp), %rsi
leaq 0x7168(%rip), %rdx      # 0xa087
callq 0x3f83
leaq -0x128(%rbp), %r15
leaq -0x108(%rbp), %r12
leaq -0x180(%rbp), %r14
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x403c
leaq -0x80(%rbp), %r13
movq %r13, %rdi
movq %r14, %rsi
leaq 0x7131(%rip), %rdx      # 0xa089
callq 0x4013
movq %r14, %rdi
callq 0x2090
leaq -0xe8(%rbp), %rdi
callq 0x2090
leaq -0x160(%rbp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x2160
subq -0xb0(%rbp), %rbx
cvtsi2sd %rbx, %xmm0
divsd 0x70b9(%rip), %xmm0     # 0xa050
movq -0xb8(%rbp), %rdi
movl -0x2c(%rbp), %esi
movq %r14, %rdx
callq 0x5165
movq %r14, %rdi
callq 0x2090
movq -0x98(%rbp), %rdi
callq 0x4092
movq -0x38(%rbp), %rdi
callq 0x20f0
movq -0xa8(%rbp), %rdi
callq 0x4092
movq -0x40(%rbp), %rdi
callq 0x20f0
movl -0x58(%rbp), %ebx
incl %ebx
leaq -0x80(%rbp), %rdi
callq 0x2090
movq -0xa0(%rbp), %rsp
movq %r15, %rdi
callq 0x2090
jmp 0x2c0e
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3020
movq %rax, %rbx
leaq -0x180(%rbp), %rdi
callq 0x2090
leaq -0xe8(%rbp), %rdi
jmp 0x3062
movq %rax, %rbx
jmp 0x303d
movq %rax, %rbx
leaq -0x160(%rbp), %rdi
callq 0x2090
leaq -0x80(%rbp), %rdi
jmp 0x3062
jmp 0x3069
movq %rax, %rbx
leaq -0x1a0(%rbp), %rdi
callq 0x2090
jmp 0x305b
jmp 0x3069
movq %rax, %rbx
leaq -0x108(%rbp), %rdi
callq 0x2090
jmp 0x3091
movq %rax, %rbx
jmp 0x3091
movq %rax, %rbx
leaq -0x140(%rbp), %rdi
callq 0x4092
jmp 0x3088
jmp 0x3085
jmp 0x3085
jmp 0x3085
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x4092
leaq -0x128(%rbp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x2200