// File: /workspace/github_cpp_makefile_star2_O3/Proudc[P]CTSS/src/Test.cpp
// Function: roadSimpleQuery(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 roadSimpleQuery(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;
		double temDistance;
		vector<Edge> temPath;
		int    timeFlag = 0;
		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->comPathSize      = completePath->edges.size();
			temRecord->referPathLength  = referencePath->referenceLength;
			temRecord->ratioPathLength  = currPathLength / (completePath->completeLength);
			temRecord->currPathLength   = currPathLength;
			temRecord->comPathLength    = completePath->completeLength;
			temRecord->numReferDiscrete = referencePath->numOfReferPoint;
			temRecord->referPathSize    = referencePath->edges.size();
			
			int     timeOutFlag = 0;
			clock_t startTime = clock();
			bool queryResultFlag = roadSimpleQueryPath(myGraph, referencePath, currentPath, temPath, temRecord, currentVertex, &timeOutFlag, &temDistance);
			if (queryResultFlag == false)
			{
				if (timeOutFlag == 1)
				{
					timeFlag = 1;
					break;
				}
				else
				{
					timeOutFlag = 0;
					bool queryResultFlagWithLoop = roadSimleQueryPathWithLoop(myGraph, referencePath, currentPath, temPath, temRecord, currentVertex, &timeOutFlag, &temDistance);
					if (queryResultFlagWithLoop == false)
					{
						if (timeOutFlag == 1)
						{
							timeFlag = 1;
							break;
						}
						else
						{
							clock_t stopTime = clock();
							temRecord->runTime = (double)(stopTime - startTime) / CLOCKS_PER_SEC;
							record[recordPos++] = (*temRecord);
						}
					}
					else
					{
						clock_t stopTime = clock();
						temRecord->runTime = (double)(stopTime - startTime) / CLOCKS_PER_SEC;
						record[recordPos++] = (*temRecord);
					}
				}

			}
			else
			{
				clock_t stopTime = clock();
				temRecord->runTime = (double)(stopTime - startTime) / CLOCKS_PER_SEC;
				record[recordPos++] = (*temRecord);
			}
		}
		if (timeFlag == 1)
		{
			count++;
			continue;	
		}
		string writeFilePath = outputFolder + "/" + strCount + "roadpartial.txt";
		writeSingleRecordToFile(record, recordPos, writeFilePath);
		
		delete referencePath;
		delete completePath;
		count++;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdx, -0x118(%rbp)
movq %rsi, -0x120(%rbp)
movq %rdi, -0x50(%rbp)
movl %r8d, -0x84(%rbp)
cmpl %r8d, %ecx
jg 0x3e42
movl %ecx, %ebx
leaq -0x168(%rbp), %r12
leaq -0x188(%rbp), %r14
leaq -0x60(%rbp), %r13
leaq 0x8865(%rip), %rdi      # 0xc072
movl %ebx, %esi
xorl %eax, %eax
callq 0x2040
leaq -0xf0(%rbp), %rdi
movl %ebx, %esi
callq 0x4f8b
movl $0x38, %edi
callq 0x2140
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rax)
movq %rax, -0x40(%rbp)
movq $0x0, 0x30(%rax)
movl $0x28, %edi
callq 0x2140
movq %rax, %r15
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rax)
movq $0x0, 0x20(%rax)
movq %r12, -0x178(%rbp)
movq -0x120(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x178(%rbp), %rdi
callq 0x4c5a
movq %r15, -0x48(%rbp)
movq %r14, -0x198(%rbp)
movq -0xf0(%rbp), %rsi
movq -0xe8(%rbp), %rdx
addq %rsi, %rdx
leaq -0x198(%rbp), %r15
movq %r15, %rdi
callq 0x4c5a
movq -0x50(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rdx
leaq -0x178(%rbp), %rcx
movq %r15, %r8
callq 0x5035
movq -0x198(%rbp), %rdi
cmpq %r14, %rdi
je 0x38dc
callq 0x2120
movq %rbx, -0x130(%rbp)
movq -0x178(%rbp), %rdi
cmpq %r12, %rdi
movq -0x48(%rbp), %r15
je 0x38f8
callq 0x2120
movq %rsp, -0x128(%rbp)
movl (%r15), %r14d
movq 0x18(%r15), %rax
subq 0x10(%r15), %rax
sarq %rax
leaq (%rax,%rax,4), %rax
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, -0x78(%rbp)
movq %rcx, %rsp
xorpd %xmm0, %xmm0
movapd %xmm0, -0x110(%rbp)
movq $0x0, -0x100(%rbp)
movq 0x10(%r15), %rax
movq 0x18(%r15), %rcx
subq %rax, %rcx
movq $0x0, -0x38(%rbp)
cmpq $0x21, %rcx
jb 0x3c38
movl $0x1, %r13d
xorpd %xmm0, %xmm0
movsd %xmm0, -0x80(%rbp)
movq $0x0, -0x38(%rbp)
movl $0x0, -0x2c(%rbp)
movq %r15, %r12
leal -0x1(%r13), %ecx
shlq $0x5, %rcx
movsd -0x80(%rbp), %xmm0
addsd 0x18(%rax,%rcx), %xmm0
movsd %xmm0, -0x80(%rbp)
leaq (%rax,%rcx), %rdx
xorl %esi, %esi
cmpl %r14d, 0x4(%rax,%rcx)
sete %sil
movl 0x4(%rdx,%rsi,4), %r15d
xorpd %xmm0, %xmm0
movapd %xmm0, -0x70(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movq %r12, %rdx
movl %r13d, %ecx
callq 0x5667
movl $0x50, %edi
callq 0x2140
movq %rax, %rbx
movl %r13d, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movq 0x18(%r12), %rax
subq 0x10(%r12), %rax
sarq $0x5, %rax
movq %rax, %xmm1
punpckldq 0x862a(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x8632(%rip), %xmm1     # 0xc030
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
movsd %xmm0, 0x38(%rbx)
movl %eax, 0x14(%rbx)
movq -0x40(%rbp), %r14
movsd 0x18(%r14), %xmm0
movsd %xmm0, 0x48(%rbx)
movsd 0x8(%r12), %xmm0
movsd -0x80(%rbp), %xmm2
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rbx)
movsd %xmm2, 0x28(%rbx)
movsd %xmm0, 0x30(%rbx)
movl 0x8(%r14), %eax
movq 0x28(%r14), %rcx
subq 0x20(%r14), %rcx
movl %eax, 0x8(%rbx)
shrq $0x5, %rcx
movl %ecx, 0x18(%rbx)
movl $0x0, -0xa8(%rbp)
callq 0x20d0
movq %rax, -0xb0(%rbp)
leaq -0x1c8(%rbp), %r12
movq %r12, %rdi
leaq -0x70(%rbp), %rsi
callq 0x4bd6
movq -0x50(%rbp), %rdi
movq %r14, %rsi
movq %r12, %rdx
leaq -0x110(%rbp), %rcx
movq %rbx, %r8
movl %r15d, %r14d
movl %r15d, %r9d
leaq -0x138(%rbp), %rax
pushq %rax
leaq -0xa8(%rbp), %rax
pushq %rax
callq 0x8fd3
addq $0x10, %rsp
movl %eax, %r12d
movq -0x1c8(%rbp), %rdi
testq %rdi, %rdi
je 0x3ace
callq 0x2120
testb %r12b, %r12b
je 0x3b1f
callq 0x20d0
subq -0xb0(%rbp), %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0x8561(%rip), %xmm0     # 0xc050
movsd %xmm0, 0x20(%rbx)
movq -0x38(%rbp), %rcx
movslq %ecx, %rax
incl %ecx
movq %rcx, -0x38(%rbp)
leaq (%rax,%rax,4), %rdi
shlq $0x4, %rdi
addq -0x78(%rbp), %rdi
movl $0xa, %ecx
movq %rbx, %rsi
rep  movsq (%rsi), %es:(%rdi)
movb $0x1, %bl
jmp 0x3bec
cmpl $0x1, -0xa8(%rbp)
leaq -0x1b0(%rbp), %r12
je 0x3be3
movl $0x0, -0xa8(%rbp)
movq %r12, %rdi
leaq -0x70(%rbp), %rsi
callq 0x4bd6
movq -0x50(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq %r12, %rdx
leaq -0x110(%rbp), %rcx
movq %rbx, %r8
movl %r14d, %r9d
leaq -0x138(%rbp), %rax
pushq %rax
leaq -0xa8(%rbp), %rax
pushq %rax
callq 0x9851
addq $0x10, %rsp
movl %eax, %r12d
movq -0x1b0(%rbp), %rdi
testq %rdi, %rdi
je 0x3b8e
callq 0x2120
cmpl $0x1, -0xa8(%rbp)
setne %al
orb %al, %r12b
je 0x3be3
callq 0x20d0
subq -0xb0(%rbp), %rax
cvtsi2sd %rax, %xmm0
divsd 0x849a(%rip), %xmm0     # 0xc050
movsd %xmm0, 0x20(%rbx)
movq -0x38(%rbp), %rax
cltq
leaq (%rax,%rax,4), %rdi
shlq $0x4, %rdi
addq -0x78(%rbp), %rdi
movl $0xa, %ecx
movq %rbx, %rsi
rep  movsq (%rsi), %es:(%rdi)
incl %eax
movq %rax, -0x38(%rbp)
jmp 0x3b18
xorl %ebx, %ebx
movl $0x1, -0x2c(%rbp)
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
movq -0x48(%rbp), %r12
je 0x3bfe
callq 0x2120
testb %bl, %bl
je 0x3c1f
incl %r13d
movq 0x10(%r12), %rax
movq 0x18(%r12), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %r13, %rcx
ja 0x3973
cmpl $0x1, -0x2c(%rbp)
movq -0x48(%rbp), %r15
leaq -0x168(%rbp), %r12
leaq -0x60(%rbp), %r13
je 0x3df3
leaq -0xc0(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x118(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0xd0(%rbp), %rbx
movq %rbx, %rdi
callq 0x4c5a
movq %rbx, %rdi
leaq 0x8417(%rip), %rsi      # 0xc087
callq 0x2240
leaq -0x98(%rbp), %r14
movq -0xf0(%rbp), %rsi
movq -0xe8(%rbp), %rdx
movq %rbx, %rdi
callq 0x2060
movq %r14, -0xa8(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3cbb
movq %rdx, -0xa8(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x98(%rbp)
jmp 0x3cc4
movupd (%rcx), %xmm0
movupd %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, -0xa0(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0xa8(%rbp), %rdi
leaq 0x83b4(%rip), %rsi      # 0xc0a0
callq 0x2240
movq %r13, -0x70(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x3d11
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x3d1b
movupd (%rcx), %xmm0
movupd %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, -0x68(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0xa8(%rbp), %rdi
cmpq %r14, %rdi
je 0x3d43
callq 0x2120
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x3d5b
callq 0x2120
leaq -0x148(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
leaq -0x158(%rbp), %rbx
movq %rbx, %rdi
callq 0x4c5a
movq -0x78(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %rbx, %rdx
callq 0x6136
movq -0x158(%rbp), %rdi
leaq -0x148(%rbp), %rax
cmpq %rax, %rdi
je 0x3dab
callq 0x2120
movq -0x40(%rbp), %rax
addq $0x20, %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x3dc0
callq 0x2120
movq %r15, %rbx
addq $0x10, %rbx
movq -0x40(%rbp), %rdi
callq 0x2120
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x3ddd
callq 0x2120
movq %r15, %rdi
callq 0x2120
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0x3df3
callq 0x2120
movq -0x110(%rbp), %rdi
testq %rdi, %rdi
je 0x3e04
callq 0x2120
movq -0x128(%rbp), %rsp
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
movq -0x130(%rbp), %rbx
leaq -0x188(%rbp), %r14
je 0x3e31
callq 0x2120
leal 0x1(%rbx), %eax
cmpl -0x84(%rbp), %ebx
movl %eax, %ebx
jne 0x3806
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3f48
movq %rax, %rbx
movq -0x158(%rbp), %rdi
leaq -0x148(%rbp), %rax
cmpq %rax, %rdi
je 0x3e79
callq 0x2120
jmp 0x3e79
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0x3f48
jmp 0x3f43
leaq -0xc0(%rbp), %r15
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
cmpq %r14, %rdi
je 0x3eb2
callq 0x2120
jmp 0x3eb2
leaq -0xc0(%rbp), %r15
movq %rax, %rbx
movq -0xd0(%rbp), %rdi
cmpq %r15, %rdi
je 0x3f48
jmp 0x3f43
movq %rax, %rbx
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x3f48
jmp 0x3f43
jmp 0x3f05
movq %rax, %rbx
jmp 0x3ef7
movq %rax, %rbx
movq -0x198(%rbp), %rdi
cmpq %r14, %rdi
je 0x3ef7
callq 0x2120
movq -0x178(%rbp), %rdi
cmpq %r12, %rdi
je 0x3f59
jmp 0x3f54
movq %rax, %rbx
jmp 0x3f59
movq %rax, %rbx
movq -0x1b0(%rbp), %rdi
testq %rdi, %rdi
je 0x3f3a
jmp 0x3f2c
jmp 0x3f37
movq %rax, %rbx
movq -0x1c8(%rbp), %rdi
testq %rdi, %rdi
je 0x3f3a
callq 0x2120
jmp 0x3f3a
jmp 0x3f37
jmp 0x3f37
movq %rax, %rbx
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x3f48
callq 0x2120
movq -0x110(%rbp), %rdi
testq %rdi, %rdi
je 0x3f59
callq 0x2120
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x3f71
callq 0x2120
movq %rbx, %rdi
callq 0x2210