// File: /workspace/github_cpp_makefile_star2_O3/Proudc[P]CTSS/src/Test.cpp
// Function: eucSimpleQuery(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 eucSimpleQuery(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;
		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;
			
			clock_t startTime = clock();
			bool queryResultFlag = eucSimpleQueryPath(myGraph, referencePath, currentPath, temRecord, currentVertex);
			clock_t stopTime = clock();

			temRecord->ratioNumEdge = ((double)(i)) / completePath->edges.size();
			temRecord->runTime = (double)(stopTime - startTime) / CLOCKS_PER_SEC;
			temRecord->comPathSize = completePath->edges.size();
			temRecord->numOfOutPriQueue = 0;
			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();
			record[recordPos++] = (*temRecord);

			if (queryResultFlag == false)
			{
				break;
			}
		}
		string writeFilePath = outputFolder + "/" + strCount + "partial.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 $0x178, %rsp            # imm = 0x178
movq %rdx, -0xf0(%rbp)
movq %rsi, -0xf8(%rbp)
movq %rdi, -0x78(%rbp)
movl %r8d, -0x84(%rbp)
cmpl %r8d, %ecx
jg 0x2ff3
movl %ecx, %r13d
leaq -0x60(%rbp), %r15
leaq -0x140(%rbp), %r14
leaq -0x198(%rbp), %r12
movq %r15, %rbx
leaq 0x95bf(%rip), %rdi      # 0xc072
movl %r13d, %esi
xorl %eax, %eax
callq 0x2040
leaq -0xe8(%rbp), %rdi
movl %r13d, %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)
leaq -0xb8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xf8(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0xc8(%rbp), %rdi
callq 0x4c5a
movq %r15, -0x38(%rbp)
leaq -0x130(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x4c5a
movq -0x78(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
leaq -0xc8(%rbp), %rcx
movq %r14, %r8
callq 0x5035
movq %rbx, %r15
movq -0x140(%rbp), %rdi
leaq -0x130(%rbp), %rax
cmpq %rax, %rdi
je 0x2b95
callq 0x2120
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
movq -0x38(%rbp), %r14
je 0x2bb1
callq 0x2120
movq %rsp, -0x108(%rbp)
movq 0x18(%r14), %rax
subq 0x10(%r14), %rax
sarq %rax
leaq (%rax,%rax,4), %rax
movq %rsp, %rbx
subq %rax, %rbx
movq %rbx, %rsp
movq 0x10(%r14), %rax
cmpq %rax, 0x18(%r14)
movq %rbx, -0x110(%rbp)
je 0x2dec
movq %r13, -0x100(%rbp)
movl (%r14), %ecx
movl %ecx, -0x2c(%rbp)
xorpd %xmm0, %xmm0
movsd %xmm0, -0x80(%rbp)
movl $0x2, %ecx
movl $0x8, %r8d
movl $0x4, %r13d
movq %rbx, -0x118(%rbp)
movsd -0x80(%rbp), %xmm0
addsd 0x14(%rax,%r13), %xmm0
movsd %xmm0, -0x80(%rbp)
movl -0x2c(%rbp), %edx
cmpl %edx, (%rax,%r13)
movq %rcx, %rdx
movq %r13, %rcx
movq %r8, -0x120(%rbp)
cmoveq %r8, %rcx
movl (%rax,%rcx), %eax
movl %eax, -0x2c(%rbp)
xorpd %xmm0, %xmm0
movapd %xmm0, -0x70(%rbp)
movq $0x0, -0x60(%rbp)
movq %rdx, -0x48(%rbp)
leaq -0x1(%rdx), %rbx
movq -0x78(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movq %r14, %rdx
movl %ebx, %ecx
callq 0x5667
movl $0x50, %edi
callq 0x2140
movq %rax, %r15
callq 0x20d0
movq %rax, %r14
movq %r12, %rdi
leaq -0x70(%rbp), %rsi
callq 0x4bd6
movq -0x78(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq %r12, %rdx
movq %r15, %rcx
movl -0x2c(%rbp), %r8d
callq 0x841c
movl %eax, %r12d
movq -0x198(%rbp), %rdi
testq %rdi, %rdi
je 0x2cb9
callq 0x2120
callq 0x20d0
movl %ebx, %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 0x933b(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x9343(%rip), %xmm1     # 0xc030
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
movsd %xmm0, 0x38(%r15)
subq %r14, %rax
movq %rdx, %r14
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0x9337(%rip), %xmm0     # 0xc050
movsd %xmm0, 0x20(%r15)
movl %ecx, 0x14(%r15)
movl $0x0, 0x10(%r15)
movq -0x40(%rbp), %rcx
movsd 0x18(%rcx), %xmm0
movsd %xmm0, 0x48(%r15)
movsd 0x8(%rdx), %xmm0
movsd -0x80(%rbp), %xmm2
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%r15)
movsd %xmm2, 0x28(%r15)
movsd %xmm0, 0x30(%r15)
movl 0x8(%rcx), %eax
movl %eax, 0x8(%r15)
movq 0x28(%rcx), %rax
subq 0x20(%rcx), %rax
shrq $0x5, %rax
movl %eax, 0x18(%r15)
movl $0xa, %ecx
movq -0x118(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x2d98
callq 0x2120
testb %r12b, %r12b
leaq -0x198(%rbp), %r12
movq -0x48(%rbp), %rdi
movq -0x120(%rbp), %r8
je 0x2dd9
movl %edi, %edx
movq 0x10(%r14), %rax
movq 0x18(%r14), %rsi
subq %rax, %rsi
sarq $0x5, %rsi
addq $0x50, %rbx
leaq 0x1(%rdi), %rcx
addq $0x20, %r8
addq $0x20, %r13
cmpq %rdx, %rsi
jae 0x2c0c
decl %edi
movq %rdi, -0x48(%rbp)
leaq -0x60(%rbp), %r15
movq -0x100(%rbp), %r13
jmp 0x2df4
movq $0x0, -0x48(%rbp)
leaq -0x170(%rbp), %r14
movq %r14, -0x180(%rbp)
movq -0xf0(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x180(%rbp), %r12
movq %r12, %rdi
callq 0x4c5a
movq %r12, %rdi
leaq 0x925b(%rip), %rsi      # 0xc087
callq 0x2240
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movq %r12, %rdi
callq 0x2060
leaq -0x98(%rbp), %rsi
movq %rsi, -0xa8(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq -0x198(%rbp), %r12
je 0x2e7e
movq %rdx, -0xa8(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x98(%rbp)
jmp 0x2e86
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0xa0(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0xa8(%rbp), %rdi
leaq 0x91f6(%rip), %rsi      # 0xc0a4
callq 0x2240
movq %r15, -0x70(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2ed3
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x2edc
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, -0x68(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x2f0b
callq 0x2120
movq -0x180(%rbp), %rdi
cmpq %r14, %rdi
leaq -0x160(%rbp), %rbx
je 0x2f23
callq 0x2120
leaq -0x150(%rbp), %rax
movq %rax, -0x160(%rbp)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x4c5a
leaq -0x140(%rbp), %r14
movq -0x110(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq %rbx, %rdx
callq 0x6136
movq -0x160(%rbp), %rdi
leaq -0x150(%rbp), %rax
cmpq %rax, %rdi
je 0x2f76
callq 0x2120
movq -0x40(%rbp), %rax
addq $0x20, %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x2f8b
callq 0x2120
movq -0x38(%rbp), %rbx
addq $0x10, %rbx
movq -0x40(%rbp), %rdi
callq 0x2120
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x2fa9
callq 0x2120
movq -0x38(%rbp), %rdi
callq 0x2120
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0x2fc0
callq 0x2120
movq -0x108(%rbp), %rsp
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x2fdf
callq 0x2120
leal 0x1(%r13), %eax
cmpl -0x84(%rbp), %r13d
movl %eax, %r13d
jne 0x2aa9
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x3066
callq 0x2120
jmp 0x3066
movq %rax, %rbx
jmp 0x303f
movq %rax, %rbx
movq -0x160(%rbp), %rdi
leaq -0x150(%rbp), %rax
cmpq %rax, %rdi
je 0x303f
callq 0x2120
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
jmp 0x3074
jmp 0x30b9
movq %rax, %rbx
movq -0x180(%rbp), %rdi
cmpq %r14, %rdi
jne 0x30e4
jmp 0x30e9
movq %rax, %rbx
movq -0x180(%rbp), %rdi
leaq -0x170(%rbp), %rax
cmpq %rax, %rdi
jne 0x30e4
jmp 0x30e9
jmp 0x30b9
leaq -0xb8(%rbp), %r15
movq %rax, %rbx
jmp 0x30ab
leaq -0xb8(%rbp), %r15
movq %rax, %rbx
movq -0x140(%rbp), %rdi
leaq -0x130(%rbp), %rax
cmpq %rax, %rdi
je 0x30ab
callq 0x2120
movq -0xc8(%rbp), %rdi
cmpq %r15, %rdi
jne 0x30e4
jmp 0x30e9
movq %rax, %rbx
jmp 0x30e9
jmp 0x30d8
jmp 0x30d8
movq %rax, %rbx
movq -0x198(%rbp), %rdi
testq %rdi, %rdi
je 0x30db
callq 0x2120
jmp 0x30db
movq %rax, %rbx
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x30e9
callq 0x2120
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x3101
callq 0x2120
movq %rbx, %rdi
callq 0x2210