// File: /workspace/github_cpp_makefile_star2_O2/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 $0x188, %rsp            # imm = 0x188
movl %r8d, -0x4c(%rbp)
movl %ecx, %ebx
movq %rdx, -0x88(%rbp)
movq %rsi, -0x90(%rbp)
movq %rdi, %r14
leaq -0x130(%rbp), %r15
movq %rdi, -0xb8(%rbp)
cmpl -0x4c(%rbp), %ebx
jg 0x2b2e
leaq 0x78e3(%rip), %rdi      # 0xa072
movl %ebx, %esi
xorl %eax, %eax
callq 0x2040
movq %r15, %rdi
movl %ebx, -0x50(%rbp)
movl %ebx, %esi
callq 0x432e
pushq $0x38
popq %rdi
callq 0x2110
movq %rax, %rbx
movq %r15, %r13
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rax)
andq $0x0, 0x30(%rax)
pushq $0x28
popq %rdi
callq 0x2110
movq %rax, %r12
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rax)
andq $0x0, 0x20(%rax)
leaq -0x110(%rbp), %rdi
movq -0x90(%rbp), %rsi
callq 0x2160
movq %r12, -0x40(%rbp)
leaq -0x1a8(%rbp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x2160
movq %r14, %rdi
movq %rbx, %rsi
movq -0x40(%rbp), %r12
movq %r12, %rdx
leaq -0x110(%rbp), %r13
movq %r13, %rcx
movq %r15, %r8
callq 0x4346
movq %rbx, -0x58(%rbp)
addq $0x20, %rbx
movq %rbx, -0x98(%rbp)
movq %r12, %rax
addq $0x10, %rax
movq %rax, -0xa8(%rbp)
movq %r15, %rdi
callq 0x2090
movq %r13, %rdi
callq 0x2090
movq %rsp, -0xa0(%rbp)
movl (%r12), %eax
movl %eax, -0x38(%rbp)
movq 0x18(%r12), %rax
subq 0x10(%r12), %rax
sarq $0x5, %rax
imulq $0x50, %rax, %rax
movq %rsp, %rcx
subq %rax, %rcx
movq %rcx, %rsp
xorpd %xmm0, %xmm0
movsd %xmm0, -0x48(%rbp)
movq %rcx, -0xb0(%rbp)
pushq $0x4
popq %rdx
movq %rcx, %r15
pushq $0x8
popq %rsi
pushq $0x1
popq %r13
movq 0x10(%r12), %rax
movq 0x18(%r12), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %r13, %rcx
jb 0x2a44
movsd -0x48(%rbp), %xmm0
addsd 0x14(%rax,%rdx), %xmm0
movsd %xmm0, -0x48(%rbp)
movl -0x38(%rbp), %ecx
cmpl %ecx, (%rax,%rdx)
movq %rdx, -0xd0(%rbp)
movq %rdx, %rcx
movq %rsi, -0xc8(%rbp)
cmoveq %rsi, %rcx
movl (%rax,%rcx), %eax
movl %eax, -0x38(%rbp)
xorpd %xmm0, %xmm0
movapd %xmm0, -0x80(%rbp)
andq $0x0, -0x70(%rbp)
movq %r14, %rdi
leaq -0x80(%rbp), %rsi
movq %r12, %rdx
movq %r13, %r12
movl %r13d, %ecx
callq 0x4709
pushq $0x50
popq %rdi
callq 0x2110
movq %rax, %rbx
callq 0x20c0
movq %rax, -0xc0(%rbp)
leaq -0x148(%rbp), %r13
movq %r13, %rdi
leaq -0x80(%rbp), %rsi
callq 0x3fbc
movq %r14, %rdi
movq -0x58(%rbp), %r14
movq %r14, %rsi
movq %r13, %rdx
movq %rbx, %rcx
movl -0x38(%rbp), %r8d
callq 0x7124
movq %r13, %rdi
movb %al, -0x29(%rbp)
callq 0x4092
callq 0x20c0
movq %r12, %r13
movl %r13d, %ecx
cvtsi2sd %rcx, %xmm0
movq -0x40(%rbp), %r12
movq 0x18(%r12), %rcx
subq 0x10(%r12), %rcx
sarq $0x5, %rcx
movq %rcx, %xmm1
punpckldq 0x76a0(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x76a8(%rip), %xmm1     # 0xa030
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
movsd %xmm0, 0x38(%rbx)
subq -0xc0(%rbp), %rax
cvtsi2sd %rax, %xmm0
divsd 0x769f(%rip), %xmm0     # 0xa050
movsd %xmm0, 0x20(%rbx)
movl %ecx, 0x14(%rbx)
andl $0x0, 0x10(%rbx)
movsd 0x18(%r14), %xmm0
movsd %xmm0, 0x48(%rbx)
movsd 0x8(%r12), %xmm0
movsd -0x48(%rbp), %xmm2
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rbx)
movsd %xmm2, 0x28(%rbx)
movsd %xmm0, 0x30(%rbx)
movl 0x8(%r14), %eax
movl %eax, 0x8(%rbx)
movq 0x28(%r14), %rax
subq 0x20(%r14), %rax
shrq $0x5, %rax
movl %eax, 0x18(%rbx)
pushq $0xa
popq %rcx
movq %r15, %rdi
movq %rbx, %rsi
rep  movsq (%rsi), %es:(%rdi)
leaq -0x80(%rbp), %rdi
callq 0x4092
incq %r13
movq -0xc8(%rbp), %rsi
addq $0x20, %rsi
movq -0xd0(%rbp), %rdx
addq $0x20, %rdx
addq $0x50, %r15
cmpb $0x0, -0x29(%rbp)
movq -0xb8(%rbp), %r14
jne 0x2895
decq %r13
movq %r13, -0x38(%rbp)
leaq -0xf0(%rbp), %rbx
movq %rbx, %rdi
movq -0x88(%rbp), %rsi
leaq 0x7624(%rip), %rdx      # 0xa087
callq 0x3f83
movl -0x50(%rbp), %r13d
leaq -0x130(%rbp), %r15
leaq -0x188(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x403c
leaq -0x80(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
leaq 0x760b(%rip), %rdx      # 0xa0a4
callq 0x4013
movq %r12, %rdi
callq 0x2090
leaq -0xf0(%rbp), %rdi
callq 0x2090
leaq -0x168(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2160
movq -0xb0(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %r12, %rdx
callq 0x4fac
movq -0x58(%rbp), %rbx
movq %r12, %rdi
callq 0x2090
movq -0x98(%rbp), %rdi
callq 0x4092
movq %rbx, %rdi
callq 0x20f0
movq -0xa8(%rbp), %rdi
callq 0x4092
movq -0x40(%rbp), %rdi
callq 0x20f0
movl %r13d, %ebx
incl %ebx
leaq -0x80(%rbp), %rdi
callq 0x2090
movq -0xa0(%rbp), %rsp
movq %r15, %rdi
callq 0x2090
jmp 0x277f
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x2b51
movq %rax, %rbx
leaq -0x188(%rbp), %rdi
callq 0x2090
leaq -0xf0(%rbp), %rdi
jmp 0x2b93
movq %rax, %rbx
jmp 0x2b6e
movq %rax, %rbx
leaq -0x168(%rbp), %rdi
callq 0x2090
leaq -0x80(%rbp), %rdi
jmp 0x2b93
jmp 0x2b9a
jmp 0x2b9a
movq %rax, %rbx
jmp 0x2b8c
movq %rax, %rbx
leaq -0x1a8(%rbp), %rdi
callq 0x2090
leaq -0x110(%rbp), %rdi
callq 0x2090
jmp 0x2bc0
movq %rax, %rbx
jmp 0x2bc0
jmp 0x2bb4
movq %rax, %rbx
leaq -0x148(%rbp), %rdi
callq 0x4092
jmp 0x2bb7
jmp 0x2bb4
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x4092
leaq -0x130(%rbp), %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x2200