// File: /workspace/github_cpp_makefile_star2_O1/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 $0x168, %rsp            # imm = 0x168
movq %rdx, -0xf0(%rbp)
movq %rsi, -0xf8(%rbp)
movq %rdi, -0x78(%rbp)
movl %r8d, -0x84(%rbp)
cmpl %r8d, %ecx
jg 0x2fe4
movl %ecx, %r13d
leaq -0x168(%rbp), %r14
leaq -0x60(%rbp), %r15
leaq -0x178(%rbp), %rbx
leaq 0x95b2(%rip), %rdi      # 0xc072
movl %r13d, %esi
xorl %eax, %eax
callq 0x2040
leaq -0xe8(%rbp), %rdi
movl %r13d, %esi
callq 0x4f6b
movl $0x38, %edi
callq 0x2150
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rax)
movq %rax, -0x48(%rbp)
movq $0x0, 0x30(%rax)
movl $0x28, %edi
callq 0x2150
movq %rax, %r12
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 0x4c3e
movq %r12, -0x38(%rbp)
movq %r14, -0x178(%rbp)
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x4c3e
movq -0x78(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x38(%rbp), %rdx
leaq -0xc8(%rbp), %rcx
movq %rbx, %r8
callq 0x5015
movq -0x178(%rbp), %rdi
cmpq %r14, %rdi
je 0x2b91
callq 0x2130
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x2ba9
callq 0x2130
movq %rsp, -0x108(%rbp)
movq -0x38(%rbp), %rdx
movq 0x18(%rdx), %rax
subq 0x10(%rdx), %rax
sarq %rax
leaq (%rax,%rax,4), %rax
movq %rsp, %rsi
subq %rax, %rsi
movq %rsi, %rsp
movq 0x10(%rdx), %rax
cmpq %rax, 0x18(%rdx)
movq %rsi, -0x110(%rbp)
je 0x2ddd
movq %r13, -0x100(%rbp)
movl (%rdx), %ecx
movl %ecx, -0x2c(%rbp)
xorpd %xmm0, %xmm0
movsd %xmm0, -0x80(%rbp)
movl $0x2, %ecx
movl $0x8, %ebx
movl $0x4, %r14d
movq %rsi, %r13
movsd -0x80(%rbp), %xmm0
addsd 0x14(%rax,%r14), %xmm0
movsd %xmm0, -0x80(%rbp)
movl -0x2c(%rbp), %esi
cmpl %esi, (%rax,%r14)
movq %rcx, %rsi
movq %r14, %rcx
cmoveq %rbx, %rcx
movl (%rax,%rcx), %eax
movl %eax, -0x2c(%rbp)
xorpd %xmm0, %xmm0
movapd %xmm0, -0x70(%rbp)
movq $0x0, -0x60(%rbp)
movq %rsi, -0x40(%rbp)
leal -0x1(%rsi), %ecx
movq -0x78(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x5647
movl $0x50, %edi
callq 0x2150
movq %rax, %r15
movq %rbx, -0x118(%rbp)
callq 0x20d0
movq %rax, %rbx
leaq -0x190(%rbp), %r12
movq %r12, %rdi
leaq -0x70(%rbp), %rsi
callq 0x4bba
movq -0x78(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq %r12, %rdx
movq %r15, %rcx
movl -0x2c(%rbp), %r8d
callq 0x85d4
movl %eax, %r12d
movq -0x190(%rbp), %rdi
testq %rdi, %rdi
je 0x2cb0
callq 0x2130
callq 0x20d0
movq -0x40(%rbp), %rcx
decl %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 0x9340(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x9348(%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 %rbx, %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
divsd 0x933f(%rip), %xmm0     # 0xc050
movsd %xmm0, 0x20(%r15)
movl %ecx, 0x14(%r15)
movl $0x0, 0x10(%r15)
movq -0x48(%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 %r13, %rdi
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x2d89
callq 0x2130
testb %r12b, %r12b
movq -0x38(%rbp), %rdx
movq -0x118(%rbp), %rbx
je 0x2dc6
movq -0x40(%rbp), %rcx
movl %ecx, %edi
movq 0x10(%rdx), %rax
movq 0x18(%rdx), %rsi
subq %rax, %rsi
sarq $0x5, %rsi
addq $0x50, %r13
incq %rcx
addq $0x20, %rbx
addq $0x20, %r14
cmpq %rdi, %rsi
jae 0x2c09
movq -0x40(%rbp), %rax
decl %eax
movq %rax, -0x40(%rbp)
leaq -0x60(%rbp), %r15
movq -0x100(%rbp), %r13
jmp 0x2de5
movq $0x0, -0x40(%rbp)
leaq -0x148(%rbp), %r14
movq %r14, -0x158(%rbp)
movq -0xf0(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x158(%rbp), %rbx
movq %rbx, %rdi
callq 0x4c3e
movq %rbx, %rdi
leaq 0x926a(%rip), %rsi      # 0xc087
callq 0x2250
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movq %rbx, %rdi
callq 0x2060
leaq -0x98(%rbp), %rsi
movq %rsi, -0xa8(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
leaq -0x138(%rbp), %rbx
je 0x2e6f
movq %rdx, -0xa8(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x98(%rbp)
jmp 0x2e77
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 0x9205(%rip), %rsi      # 0xc0a4
callq 0x2250
movq %r15, -0x70(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2ec4
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x2ecd
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
leaq -0x98(%rbp), %rsi
movq 0x8(%rax), %rdx
movq %rdx, -0x68(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0xa8(%rbp), %rdi
cmpq %rsi, %rdi
je 0x2efc
callq 0x2130
movq -0x158(%rbp), %rdi
cmpq %r14, %rdi
je 0x2f0d
callq 0x2130
leaq -0x128(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x4c3e
leaq -0x168(%rbp), %r14
movq -0x110(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq %rbx, %rdx
callq 0x6247
movq -0x138(%rbp), %rdi
leaq -0x128(%rbp), %rax
cmpq %rax, %rdi
je 0x2f60
callq 0x2130
movq -0x48(%rbp), %rax
addq $0x20, %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x2f75
callq 0x2130
movq -0x38(%rbp), %rbx
addq $0x10, %rbx
movq -0x48(%rbp), %rdi
callq 0x2130
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x2f93
callq 0x2130
movq -0x38(%rbp), %rdi
callq 0x2130
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
leaq -0x178(%rbp), %rbx
je 0x2fb1
callq 0x2130
movq -0x108(%rbp), %rsp
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x2fd0
callq 0x2130
leal 0x1(%r13), %eax
cmpl -0x84(%rbp), %r13d
movl %eax, %r13d
jne 0x2ab9
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 0x3050
callq 0x2130
jmp 0x3050
movq %rax, %rbx
jmp 0x3030
movq %rax, %rbx
movq -0x138(%rbp), %rdi
leaq -0x128(%rbp), %rax
cmpq %rax, %rdi
je 0x3030
callq 0x2130
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
jmp 0x305e
jmp 0x309c
movq %rax, %rbx
movq -0x158(%rbp), %rdi
cmpq %r14, %rdi
jne 0x30c7
jmp 0x30cc
movq %rax, %rbx
movq -0x158(%rbp), %rdi
leaq -0x148(%rbp), %rax
cmpq %rax, %rdi
jne 0x30c7
jmp 0x30cc
jmp 0x309c
leaq -0xb8(%rbp), %r15
movq %rax, %rbx
jmp 0x308e
leaq -0xb8(%rbp), %r15
movq %rax, %rbx
movq -0x178(%rbp), %rdi
cmpq %r14, %rdi
je 0x308e
callq 0x2130
movq -0xc8(%rbp), %rdi
cmpq %r15, %rdi
jne 0x30c7
jmp 0x30cc
movq %rax, %rbx
jmp 0x30cc
jmp 0x30bb
jmp 0x30bb
movq %rax, %rbx
movq -0x190(%rbp), %rdi
testq %rdi, %rdi
je 0x30be
callq 0x2130
jmp 0x30be
movq %rax, %rbx
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x30cc
callq 0x2130
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x30e4
callq 0x2130
movq %rbx, %rdi
callq 0x2220