// File: /workspace/github_cpp_makefile_star2_O2/Proudc[P]CTSS/src/Test.cpp
// Function: roadContinuousQuery(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 roadContinuousQuery(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;
		int    timeFlag  = 0;
		int    ifCalFlag = 0;
		Record record[completePath->edges.size()];
		double currPathLength = 0.0;
		double boundDistance  = 0.0;
		double pathDistance;
		vector<Edge> temPath;
		vector<Edge> lastPath;
		initializeLastPath(referencePath, lastPath);
		
		clock_t startTime = clock();
		for (unsigned int i = 1; i < completePath->edges.size(); i++)
		{
			ifCalFlag = 0;
			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);

			if (lastPath[i - 1].edgeID == currentPath[i - 1].edgeID)
			{
				continue;
			}
			else
			{
				int firstVertexID;
				int secVertexID;
				int endVertexID;
				if (currentPath[i - 1].firstVertexID == currentVertex)
				{
					firstVertexID = currentPath[i - 1].secVertexID;
					secVertexID   = currentPath[i - 1].firstVertexID;
				}
				else
				{
					firstVertexID = currentPath[i - 1].firstVertexID;
					secVertexID   = currentPath[i - 1].secVertexID;
				}													
				vector<Edge> localPath;
				maxmalOverlapPath(myGraph, localPath, lastPath, firstVertexID, secVertexID, &endVertexID);
				if (localPath.size() == 0)
				{
					printf("localPath's size is 0\n");
					int  timeOutFlag = 0;
					bool queryResultFlag = roadSimpleQueryPath(myGraph, referencePath, currentPath, temPath, temRecord, currentVertex, &timeOutFlag, &pathDistance);
					if (queryResultFlag == false)
					{
						if (timeOutFlag == 1)
						{
							timeFlag = 1;
							break;
						}
						else
						{
							timeOutFlag = 0;
							bool queryResultFlagWithLoop = roadSimleQueryPathWithLoop(myGraph, referencePath, currentPath, temPath, temRecord, currentVertex, &timeOutFlag, &pathDistance);
							if (queryResultFlagWithLoop == false)
							{
								if (timeOutFlag == 1)
								{
									timeFlag = 1;
								}
								break;
							}
							else
							{
								updateLastPath(lastPath, temPath, &boundDistance, &pathDistance);
							}
						}
					}
					else
					{
						updateLastPath(lastPath, temPath, &boundDistance, &pathDistance);
					}
				}
				else
				{
					printf("localPath's size is not 0\n");
					vector<Edge> localLastPath;
					int edgePos;
					for (edgePos = i - 1; edgePos < lastPath.size(); edgePos++)
					{
						int temFirstVertexID = lastPath[edgePos].firstVertexID;
						int temSecVertexID   = lastPath[edgePos].secVertexID;
						if (temFirstVertexID == endVertexID || temSecVertexID == endVertexID)
						{
							localLastPath.push_back(lastPath[edgePos]);
							break;
						}
						localLastPath.push_back(lastPath[edgePos]);
					}
					double temDistance = dfdBetweenTwoLocalPaths(myGraph, localPath, localLastPath, firstVertexID);
					boundDistance += temDistance;
					if (boundDistance <= myGraph->delta)
					{
						replacePath(lastPath, localPath, i - 1, edgePos + 1);
					}
					else
					{
						int  timeOutFlag = 0;
						bool queryResultFlag = roadSimpleQueryPath(myGraph, referencePath, currentPath, temPath, temRecord, currentVertex, &timeOutFlag, &pathDistance);
						if (queryResultFlag == false)
						{
							if (timeOutFlag == 1)
							{
								timeFlag = 1;
								break;
							}
							else
							{
								timeOutFlag = 0;
								bool queryResultFlagWithLoop = roadSimleQueryPathWithLoop(myGraph, referencePath, currentPath, temPath, temRecord, currentVertex, &timeOutFlag, &pathDistance);
								if (queryResultFlagWithLoop == false)
								{
									if (timeOutFlag == 1)
									{
										timeFlag = 1;
									}
									break;
								}
								else
								{
									updateLastPath(lastPath, temPath, &boundDistance, &pathDistance);
								}
							}
						}
						else
						{
							updateLastPath(lastPath, temPath, &boundDistance, &pathDistance);
						}
					}
				}
			}
		}
		clock_t stopTime = clock();
		if (timeFlag == 1)
		{
			count++;
			continue;
		}
		string writeFilePath = outputFolder + "/" + strCount + "roadContinuousQuery.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 $0x228, %rsp            # imm = 0x228
movl %r8d, -0xcc(%rbp)
movl %ecx, %ebx
movq %rdx, -0x138(%rbp)
movq %rsi, -0x140(%rbp)
movq %rdi, -0x40(%rbp)
leaq -0x100(%rbp), %r12
cmpl -0xcc(%rbp), %ebx
jg 0x3e62
leaq 0x69df(%rip), %rdi      # 0xa072
movl %ebx, %esi
xorl %eax, %eax
callq 0x2040
leaq -0x188(%rbp), %rdi
movl %ebx, -0xd0(%rbp)
movl %ebx, %esi
callq 0x432e
pushq $0x38
popq %rdi
callq 0x2110
movq %rax, %r15
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rax)
andq $0x0, 0x30(%rax)
pushq $0x28
popq %rdi
callq 0x2110
movq %rax, %rbx
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rax)
andq $0x0, 0x20(%rax)
leaq -0x208(%rbp), %rdi
movq -0x140(%rbp), %rsi
callq 0x2160
movq %rbx, -0x68(%rbp)
leaq -0x248(%rbp), %r14
movq %r14, %rdi
leaq -0x188(%rbp), %rsi
callq 0x2160
movq -0x40(%rbp), %rdi
movq %r15, %rsi
movq -0x68(%rbp), %r13
movq %r13, %rdx
leaq -0x208(%rbp), %rbx
movq %rbx, %rcx
movq %r14, %r8
callq 0x4346
movq %r14, %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x2090
movq %rsp, -0x160(%rbp)
movl (%r13), %eax
movl %eax, -0x30(%rbp)
movq 0x18(%r13), %rax
subq 0x10(%r13), %rax
sarq $0x5, %rax
imulq $0x50, %rax, %rax
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x128(%rbp)
movq %rcx, %rsp
andq $0x0, -0x60(%rbp)
xorpd %xmm0, %xmm0
movapd %xmm0, -0xc0(%rbp)
andq $0x0, -0xb0(%rbp)
movapd %xmm0, -0x80(%rbp)
andq $0x0, -0x70(%rbp)
movq %r15, %rdi
leaq -0x80(%rbp), %rsi
callq 0x5655
movq %r15, -0x58(%rbp)
addq $0x20, %r15
movq %r15, -0x148(%rbp)
addq $0x10, %r13
movq %r13, -0x150(%rbp)
movq $0x0, -0x130(%rbp)
xorpd %xmm0, %xmm0
movsd %xmm0, -0xc8(%rbp)
callq 0x20c0
movq %rax, -0x158(%rbp)
pushq $0x1
popq %rax
movl %eax, %ecx
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x4c(%rbp)
movl %ecx, %r15d
movq -0x68(%rbp), %rdx
movq 0x10(%rdx), %rax
movq 0x18(%rdx), %rsi
subq %rax, %rsi
sarq $0x5, %rsi
cmpq %r15, %rsi
jbe 0x3cf4
leal -0x1(%rcx), %ebx
movq %rbx, %r12
shlq $0x5, %r12
leaq (%rax,%r12), %r8
movsd -0xc8(%rbp), %xmm0
addsd 0x18(%rax,%r12), %xmm0
movsd %xmm0, -0xc8(%rbp)
xorl %esi, %esi
movl -0x30(%rbp), %edi
cmpl %edi, 0x4(%rax,%r12)
sete %sil
movl 0x4(%r8,%rsi,4), %eax
movl %eax, -0x30(%rbp)
xorpd %xmm0, %xmm0
movapd %xmm0, -0x120(%rbp)
andq $0x0, -0x110(%rbp)
movq -0x40(%rbp), %rdi
leaq -0x120(%rbp), %rsi
movq %rcx, -0x168(%rbp)
callq 0x4709
pushq $0x50
popq %rdi
callq 0x2110
movq %rax, %r14
cvtsi2sd %r15, %xmm0
movl -0x4c(%rbp), %edx
movl %edx, %r15d
movq -0x68(%rbp), %rcx
movq 0x18(%rcx), %rax
subq 0x10(%rcx), %rax
sarq $0x5, %rax
movq %rax, %xmm1
punpckldq 0x677c(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x6784(%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 %eax, 0x14(%r14)
andl $0x0, 0x10(%r14)
movq -0x58(%rbp), %rax
movsd 0x18(%rax), %xmm0
movsd %xmm0, 0x48(%r14)
movsd 0x8(%rcx), %xmm0
movsd -0xc8(%rbp), %xmm2
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%r14)
movsd %xmm2, 0x28(%r14)
movsd %xmm0, 0x30(%r14)
incl %edx
movl %edx, -0x4c(%rbp)
imulq $0x50, %r15, %rdi
addq -0x128(%rbp), %rdi
pushq $0xa
popq %rcx
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x80(%rbp), %rax
movl (%rax,%r12), %ecx
movq -0x120(%rbp), %rax
cmpl (%rax,%r12), %ecx
jne 0x394c
leaq -0x120(%rbp), %rdi
callq 0x4092
leaq -0x100(%rbp), %r12
jmp 0x3c41
addq %r12, %rax
movl 0x4(%rax), %r12d
leaq 0x8(%rax), %rcx
cmpl -0x30(%rbp), %r12d
jne 0x3967
addq $0x4, %rax
movl (%rcx), %r12d
movq %rax, %rcx
movl (%rcx), %r8d
xorpd %xmm0, %xmm0
movapd %xmm0, -0x100(%rbp)
andq $0x0, -0xf0(%rbp)
movq -0x40(%rbp), %rdi
leaq -0x100(%rbp), %rsi
leaq -0x80(%rbp), %rdx
movl %r12d, %ecx
leaq -0xd4(%rbp), %r9
callq 0x82a4
movq -0xf8(%rbp), %rax
cmpq -0x100(%rbp), %rax
je 0x3a20
leaq 0x675f(%rip), %rdi      # 0xa112
callq 0x21a0
xorpd %xmm0, %xmm0
movapd %xmm0, -0xa0(%rbp)
andq $0x0, -0x90(%rbp)
movq -0x130(%rbp), %r13
movq -0x80(%rbp), %rax
movq -0x78(%rbp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %r15, %rcx
jbe 0x3ac0
leaq (%rax,%r13), %rsi
movl -0xd4(%rbp), %ecx
cmpl %ecx, 0x4(%rax,%r13)
je 0x3ab4
cmpl %ecx, 0x8(%rax,%r13)
je 0x3ab4
leaq -0xa0(%rbp), %rdi
callq 0x4066
incq %r15
addq $0x20, %r13
jmp 0x39d3
leaq 0x6705(%rip), %rdi      # 0xa12c
callq 0x21a0
andl $0x0, -0xa0(%rbp)
leaq -0x1e8(%rbp), %rdi
leaq -0x120(%rbp), %r15
movq %r15, %rsi
callq 0x3fbc
leaq -0x100(%rbp), %r12
leaq -0xa0(%rbp), %r10
movq -0x40(%rbp), %rdi
movq -0x58(%rbp), %rsi
leaq -0x1e8(%rbp), %r13
movq %r13, %rdx
leaq -0xc0(%rbp), %rcx
movq %r14, %r8
movl -0x30(%rbp), %r9d
leaq -0x48(%rbp), %rax
pushq %rax
pushq %r10
callq 0x7b73
popq %rcx
popq %rdx
movl %eax, %ebx
movq %r13, %rdi
callq 0x4092
testb %bl, %bl
je 0x3bb0
leaq -0x80(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
leaq -0x60(%rbp), %rdx
leaq -0x48(%rbp), %rcx
callq 0x55e5
jmp 0x3c31
leaq -0xa0(%rbp), %rdi
callq 0x4066
movq -0x40(%rbp), %rdi
leaq -0x100(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
movl %r12d, %ecx
callq 0x6b16
addsd -0x60(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movq -0x40(%rbp), %rax
movsd 0x18(%rax), %xmm1
ucomisd %xmm0, %xmm1
jae 0x3b6d
andl $0x0, -0x34(%rbp)
leaq -0x1b8(%rbp), %rdi
leaq -0x120(%rbp), %r15
movq %r15, %rsi
callq 0x3fbc
movq -0x40(%rbp), %rdi
movq -0x58(%rbp), %rsi
leaq -0x1b8(%rbp), %r12
movq %r12, %rdx
leaq -0xc0(%rbp), %rcx
movq %r14, %r8
movl -0x30(%rbp), %r9d
leaq -0x48(%rbp), %rax
pushq %rax
leaq -0x34(%rbp), %rax
pushq %rax
callq 0x7b73
popq %rcx
popq %rdx
movl %eax, %ebx
movq %r12, %rdi
callq 0x4092
testb %bl, %bl
je 0x3c57
movb $0x1, %r14b
leaq -0x80(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
leaq -0x60(%rbp), %rdx
leaq -0x48(%rbp), %rcx
callq 0x55e5
jmp 0x3b88
incl %r15d
movb $0x1, %r14b
leaq -0x80(%rbp), %rdi
leaq -0x100(%rbp), %rsi
movl %ebx, %edx
movl %r15d, %ecx
callq 0x54c4
leaq -0xa0(%rbp), %rdi
callq 0x4092
testb %r14b, %r14b
je 0x3cfd
leaq -0x120(%rbp), %r15
leaq -0x100(%rbp), %r12
jmp 0x3c31
cmpl $0x1, -0xa0(%rbp)
leaq -0xa0(%rbp), %rbx
je 0x3d1d
andl $0x0, -0xa0(%rbp)
leaq -0x1d0(%rbp), %rdi
movq %r15, %rsi
callq 0x3fbc
movq -0x40(%rbp), %rdi
movq -0x58(%rbp), %rsi
leaq -0x1d0(%rbp), %r13
movq %r13, %rdx
leaq -0xc0(%rbp), %rcx
movq %r14, %r8
movl -0x30(%rbp), %r9d
leaq -0x48(%rbp), %rax
pushq %rax
pushq %rbx
callq 0x8193
popq %rcx
popq %rdx
movl %eax, %ebx
movq %r13, %rdi
callq 0x4092
testb %bl, %bl
je 0x3d32
leaq -0x80(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
leaq -0x60(%rbp), %rdx
leaq -0x48(%rbp), %rcx
callq 0x55e5
movq %r12, %rdi
callq 0x4092
movq %r15, %rdi
callq 0x4092
movq -0x168(%rbp), %rcx
incl %ecx
addq $0x20, -0x130(%rbp)
jmp 0x37ec
cmpl $0x1, -0x34(%rbp)
jne 0x3c6b
xorl %r14d, %r14d
pushq $0x1
popq %rax
movl %eax, -0x2c(%rbp)
jmp 0x3b88
andl $0x0, -0x34(%rbp)
leaq -0x1a0(%rbp), %rdi
movq %r15, %rsi
callq 0x3fbc
movq -0x40(%rbp), %rdi
movq -0x58(%rbp), %rsi
leaq -0x1a0(%rbp), %r15
movq %r15, %rdx
leaq -0xc0(%rbp), %rcx
movq %r14, %r8
movl -0x30(%rbp), %r9d
leaq -0x48(%rbp), %rax
pushq %rax
leaq -0x34(%rbp), %rax
pushq %rax
callq 0x8193
popq %rcx
popq %rdx
movl %eax, %ebx
movq %r15, %rdi
callq 0x4092
testb %bl, %bl
je 0x3cdd
movb $0x1, %r14b
leaq -0x80(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
leaq -0x60(%rbp), %rdx
leaq -0x48(%rbp), %rcx
callq 0x55e5
jmp 0x3b88
movl -0x34(%rbp), %eax
cmpl $0x1, %eax
movl -0x2c(%rbp), %ecx
cmovel %eax, %ecx
movl %ecx, -0x2c(%rbp)
xorl %r14d, %r14d
jmp 0x3b88
leaq -0x120(%rbp), %r15
jmp 0x3d54
leaq -0x100(%rbp), %r12
movq %r12, %rdi
callq 0x4092
leaq -0x120(%rbp), %r15
movq %r15, %rdi
callq 0x4092
jmp 0x3d54
movq %r12, %rdi
callq 0x4092
movq %r15, %rdi
callq 0x4092
pushq $0x1
popq %rax
jmp 0x3d51
movl -0xa0(%rbp), %ebx
movq %r12, %rdi
callq 0x4092
movq %r15, %rdi
callq 0x4092
cmpl $0x1, %ebx
movl -0x2c(%rbp), %eax
cmovel %ebx, %eax
movl %eax, -0x2c(%rbp)
callq 0x20c0
cmpl $0x1, -0x2c(%rbp)
je 0x3e2d
movq %rax, %rbx
leaq -0xa0(%rbp), %r14
movq %r14, %rdi
movq -0x138(%rbp), %rsi
leaq 0x6309(%rip), %rdx      # 0xa087
callq 0x3f83
movq %r12, %rdi
movq %r14, %rsi
leaq -0x188(%rbp), %rdx
callq 0x403c
movq %r15, %rdi
movq %r12, %rsi
leaq 0x630e(%rip), %rdx      # 0xa0b0
callq 0x4013
movq %r12, %rdi
callq 0x2090
leaq -0xa0(%rbp), %rdi
callq 0x2090
leaq -0x228(%rbp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x2160
subq -0x158(%rbp), %rbx
cvtsi2sd %rbx, %xmm0
divsd 0x626f(%rip), %xmm0     # 0xa050
movq -0x128(%rbp), %rdi
movl -0x4c(%rbp), %esi
movq %r14, %rdx
callq 0x5165
movq %r14, %rdi
callq 0x2090
movq -0x148(%rbp), %rdi
callq 0x4092
movq -0x58(%rbp), %rdi
callq 0x20f0
movq -0x150(%rbp), %rdi
callq 0x4092
movq -0x68(%rbp), %rdi
callq 0x20f0
movq %r15, %rdi
callq 0x2090
movl -0xd0(%rbp), %ebx
incl %ebx
leaq -0x80(%rbp), %rdi
callq 0x4092
leaq -0xc0(%rbp), %rdi
callq 0x4092
movq -0x160(%rbp), %rsp
leaq -0x188(%rbp), %rdi
callq 0x2090
jmp 0x3680
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3ee8
movq %rax, %rbx
leaq -0x100(%rbp), %rdi
callq 0x2090
jmp 0x3e98
movq %rax, %rbx
leaq -0x228(%rbp), %rdi
callq 0x2090
jmp 0x3ea4
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
jmp 0x3eab
movq %rax, %rbx
leaq -0x120(%rbp), %rdi
callq 0x2090
jmp 0x3f5a
movq %rax, %rbx
leaq -0x1a0(%rbp), %rdi
jmp 0x3f0c
jmp 0x3efb
movq %rax, %rbx
jmp 0x3ed7
movq %rax, %rbx
leaq -0x248(%rbp), %rdi
callq 0x2090
leaq -0x208(%rbp), %rdi
callq 0x2090
jmp 0x3f6f
movq %rax, %rbx
jmp 0x3f5a
jmp 0x3f33
movq %rax, %rbx
leaq -0x1d0(%rbp), %rdi
jmp 0x3f3d
movq %rax, %rbx
jmp 0x3f6f
jmp 0x3f33
movq %rax, %rbx
leaq -0x1b8(%rbp), %rdi
callq 0x4092
jmp 0x3f36
jmp 0x3f27
movq %rax, %rbx
leaq -0x1e8(%rbp), %rdi
jmp 0x3f3d
jmp 0x3f33
jmp 0x3f27
jmp 0x3f33
movq %rax, %rbx
jmp 0x3f42
jmp 0x3f2e
movq %rax, %rbx
jmp 0x3f4e
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x4092
leaq -0x100(%rbp), %rdi
callq 0x4092
leaq -0x120(%rbp), %rdi
callq 0x4092
leaq -0x80(%rbp), %rdi
callq 0x4092
leaq -0xc0(%rbp), %rdi
callq 0x4092
leaq -0x188(%rbp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x2200