// File: 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
subq $0x240, %rsp            # imm = 0x240
movq %rsi, -0x1b8(%rbp)
movq %rdx, -0x1b0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x20(%rbp), %eax
jg 0x30f6
movl -0x24(%rbp), %esi
leaq 0x16663(%rip), %rdi     # 0x1907b
xorl %eax, %eax
callq 0x2040
movl -0x24(%rbp), %esi
leaq -0x48(%rbp), %rdi
callq 0x6680
movl $0x38, %edi
callq 0x2170
movq %rax, -0x1c0(%rbp)
jmp 0x2a3e
movq -0x1c0(%rbp), %rdi
callq 0x5320
movq -0x1c0(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x28, %edi
callq 0x2170
movq %rax, -0x1c8(%rbp)
jmp 0x2a68
movq -0x1c8(%rbp), %rdi
callq 0x5340
movq -0x1c8(%rbp), %rax
movq -0x1b8(%rbp), %rsi
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x1e0(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x1d0(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x2090
jmp 0x2ab5
leaq -0xa8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x2090
jmp 0x2ac7
movq -0x1d0(%rbp), %rdx
movq -0x1d8(%rbp), %rsi
movq -0x1e0(%rbp), %rdi
leaq -0x88(%rbp), %rcx
leaq -0xa8(%rbp), %r8
callq 0x66b0
jmp 0x2af1
leaq -0xa8(%rbp), %rdi
callq 0x20d0
leaq -0x88(%rbp), %rdi
callq 0x20d0
movq -0x68(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xac(%rbp)
movl $0x0, -0xb0(%rbp)
movq -0x68(%rbp), %rdi
addq $0x10, %rdi
callq 0x5360
movq %rax, %rcx
movq %rcx, %rax
movq %rsp, %rdx
movq %rdx, -0xb8(%rbp)
shlq $0x4, %rcx
leaq (%rcx,%rcx,4), %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x1e8(%rbp)
movq %rcx, %rsp
movq %rax, -0xc0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xc8(%rbp)
movl $0x1, -0xcc(%rbp)
movl -0xcc(%rbp), %eax
movq %rax, -0x1f0(%rbp)
movq -0x68(%rbp), %rdi
addq $0x10, %rdi
callq 0x5360
movq %rax, %rcx
movq -0x1f0(%rbp), %rax
cmpq %rcx, %rax
ja 0x2f55
movq -0x68(%rbp), %rdi
addq $0x10, %rdi
movl -0xcc(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x5380
movsd 0x18(%rax), %xmm0
addsd -0xc8(%rbp), %xmm0
movsd %xmm0, -0xc8(%rbp)
movq -0x68(%rbp), %rdi
addq $0x10, %rdi
movl -0xcc(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x5380
movl 0x4(%rax), %eax
cmpl -0xac(%rbp), %eax
jne 0x2c5e
movq -0x68(%rbp), %rdi
addq $0x10, %rdi
movl -0xcc(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x5380
movl 0x8(%rax), %eax
movl %eax, -0xac(%rbp)
jmp 0x2c81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x30eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x2c4d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x20d0
leaq -0x88(%rbp), %rdi
callq 0x20d0
jmp 0x30eb
movq -0x68(%rbp), %rdi
addq $0x10, %rdi
movl -0xcc(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x5380
movl 0x4(%rax), %eax
movl %eax, -0xac(%rbp)
leaq -0xe8(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
callq 0x53a0
movq -0x1f8(%rbp), %rsi
movq -0x8(%rbp), %rdi
movq -0x68(%rbp), %rdx
movl -0xcc(%rbp), %ecx
callq 0x6c40
jmp 0x2cb0
movl $0x50, %edi
callq 0x2170
movq %rax, -0x200(%rbp)
jmp 0x2cc3
movq -0x200(%rbp), %rax
movq %rax, -0xf0(%rbp)
callq 0x2100
movq %rax, -0xf8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x210(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x208(%rbp)
leaq -0x118(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x53c0
jmp 0x2d08
movq -0x208(%rbp), %rsi
movq -0x210(%rbp), %rdi
movq -0xf0(%rbp), %rcx
movl -0xac(%rbp), %r8d
leaq -0x118(%rbp), %rdx
callq 0xf080
movb %al, -0x211(%rbp)
jmp 0x2d38
leaq -0x118(%rbp), %rdi
callq 0x54b0
movb -0x211(%rbp), %al
andb $0x1, %al
movb %al, -0xf9(%rbp)
callq 0x2100
movq %rax, -0x120(%rbp)
movl -0xcc(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x220(%rbp)
movq -0x68(%rbp), %rdi
addq $0x10, %rdi
callq 0x5360
movsd -0x220(%rbp), %xmm0
movq %rax, %xmm1
movaps 0x1627e(%rip), %xmm2    # 0x19010
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x16282(%rip), %xmm2    # 0x19020
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movq -0xf0(%rbp), %rax
movsd %xmm0, 0x38(%rax)
movq -0x120(%rbp), %rax
subq -0xf8(%rbp), %rax
cvtsi2sd %rax, %xmm0
movsd 0x16230(%rip), %xmm1    # 0x19008
divsd %xmm1, %xmm0
movq -0xf0(%rbp), %rax
movsd %xmm0, 0x20(%rax)
movq -0x68(%rbp), %rdi
addq $0x10, %rdi
callq 0x5360
movl %eax, %ecx
movq -0xf0(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0xf0(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x50(%rbp), %rax
movsd 0x18(%rax), %xmm0
movq -0xf0(%rbp), %rax
movsd %xmm0, 0x48(%rax)
movsd -0xc8(%rbp), %xmm0
movq -0x68(%rbp), %rax
divsd 0x8(%rax), %xmm0
movq -0xf0(%rbp), %rax
movsd %xmm0, 0x40(%rax)
movsd -0xc8(%rbp), %xmm0
movq -0xf0(%rbp), %rax
movsd %xmm0, 0x28(%rax)
movq -0x68(%rbp), %rax
movsd 0x8(%rax), %xmm0
movq -0xf0(%rbp), %rax
movsd %xmm0, 0x30(%rax)
movq -0x50(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0xf0(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x50(%rbp), %rdi
addq $0x20, %rdi
callq 0x5360
movq -0x1e8(%rbp), %rdi
movl %eax, %ecx
movq -0xf0(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0xf0(%rbp), %rsi
movl -0xb0(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0xb0(%rbp)
cltq
imulq $0x50, %rax, %rax
addq %rax, %rdi
movl $0x50, %edx
callq 0x2130
movb -0xf9(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x2f0a
movl $0x4, -0x124(%rbp)
jmp 0x2f14
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x2f44
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x54b0
jmp 0x2f44
movl $0x0, -0x124(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x54b0
movl -0x124(%rbp), %eax
testl %eax, %eax
je 0x2f2e
jmp 0x2f2c
jmp 0x2f55
jmp 0x2f30
movl -0xcc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
jmp 0x2b70
leaq -0xe8(%rbp), %rdi
callq 0x54b0
jmp 0x30eb
movq -0x1b0(%rbp), %rsi
leaq 0x1612d(%rip), %rdx     # 0x19090
leaq -0x188(%rbp), %rdi
callq 0x52a0
jmp 0x2f71
leaq -0x168(%rbp), %rdi
leaq -0x188(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x5560
jmp 0x2f8a
leaq 0x1611c(%rip), %rdx     # 0x190ad
leaq -0x148(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x5510
jmp 0x2fa6
leaq -0x168(%rbp), %rdi
callq 0x20d0
leaq -0x188(%rbp), %rdi
callq 0x20d0
movl -0xb0(%rbp), %eax
movl %eax, -0x224(%rbp)
leaq -0x1a8(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x2090
jmp 0x2fdf
movl -0x224(%rbp), %esi
movq -0x1e8(%rbp), %rdi
leaq -0x1a8(%rbp), %rdx
callq 0x7ee0
jmp 0x2ffa
leaq -0x1a8(%rbp), %rdi
callq 0x20d0
movq -0x50(%rbp), %rax
movq %rax, -0x230(%rbp)
cmpq $0x0, %rax
je 0x302f
movq -0x230(%rbp), %rdi
callq 0x55b0
movq -0x230(%rbp), %rdi
callq 0x2150
movq -0x68(%rbp), %rax
movq %rax, -0x238(%rbp)
cmpq $0x0, %rax
je 0x3058
movq -0x238(%rbp), %rdi
callq 0x55d0
movq -0x238(%rbp), %rdi
callq 0x2150
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x20d0
movq -0xb8(%rbp), %rax
movq %rax, %rsp
leaq -0x48(%rbp), %rdi
callq 0x20d0
jmp 0x2a02
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x30ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x20d0
leaq -0x188(%rbp), %rdi
callq 0x20d0
jmp 0x30eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x30df
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x20d0
leaq -0x148(%rbp), %rdi
callq 0x20d0
leaq -0x48(%rbp), %rdi
callq 0x20d0
jmp 0x30fb
movq %rbp, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x2240
nopw %cs:(%rax,%rax)