// File: Proudc[P]CTSS/src/Test.cpp
// Function: eucContinuousQuery(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 eucContinuousQuery(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;
		int    temConQueryPos = 0;
		clock_t startTime = clock();
		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->runTime          = 0;
			temRecord->comPathSize      = completePath->edges.size();
			temRecord->numOfOutPriQueue = 0;
			temRecord->referPathLength  = referencePath->referenceLength;
			temRecord->ratioPathLength  = currPathLength / (completePath->completeLength);
			temRecord->currPathLength   = currPathLength;
			temRecord->comPathLength    = completePath->completeLength;
			record[recordPos++] = (*temRecord);

			
			double x1 = myGraph->vertexsVector[currentVertex].longitude;
			double y1 = myGraph->vertexsVector[currentVertex].latitude;
			double x2 = referencePath->pointOfRefer[temConQueryPos].x;
			double y2 = referencePath->pointOfRefer[temConQueryPos].y;
			if (euc(x1, y1, x2, y2) <= (myGraph->delta))
			{
				continue;
			}
			else
			{
				temRecord->eucConQueryPos = temConQueryPos;
				bool queryResultFlag = eucSimpleQueryPath(myGraph, referencePath, currentPath, temRecord, currentVertex);
				temConQueryPos = temRecord->eucConQueryPos;
				if (queryResultFlag == false)
				{
					break;
				}
			}

		}
		clock_t stopTime = clock();
		string writeFilePath = outputFolder + "/" + strCount + "eucContinuousQuery.txt";
		writeContinuousRecordToFile(record, recordPos, writeFilePath, (double)(stopTime - startTime) / CLOCKS_PER_SEC);
		
		delete referencePath;
		delete completePath;
		count++;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movq %rsi, -0x1d8(%rbp)
movq %rdx, -0x1d0(%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 0x3953
movl -0x24(%rbp), %esi
leaq 0x15f23(%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, -0x1e0(%rbp)
jmp 0x317e
movq -0x1e0(%rbp), %rdi
callq 0x5320
movq -0x1e0(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x28, %edi
callq 0x2170
movq %rax, -0x1e8(%rbp)
jmp 0x31a8
movq -0x1e8(%rbp), %rdi
callq 0x5340
movq -0x1e8(%rbp), %rax
movq -0x1d8(%rbp), %rsi
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x200(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x1f8(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x1f0(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x2090
jmp 0x31f5
leaq -0xa8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x2090
jmp 0x3207
movq -0x1f0(%rbp), %rdx
movq -0x1f8(%rbp), %rsi
movq -0x200(%rbp), %rdi
leaq -0x88(%rbp), %rcx
leaq -0xa8(%rbp), %r8
callq 0x66b0
jmp 0x3231
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, -0x208(%rbp)
movq %rcx, %rsp
movq %rax, -0xc0(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xc8(%rbp)
movl $0x0, -0xcc(%rbp)
callq 0x2100
movq %rax, -0xd8(%rbp)
movl $0x1, -0xdc(%rbp)
movl -0xdc(%rbp), %eax
movq %rax, -0x210(%rbp)
movq -0x68(%rbp), %rdi
addq $0x10, %rdi
callq 0x5360
movq %rax, %rcx
movq -0x210(%rbp), %rax
cmpq %rcx, %rax
jae 0x3784
movq -0x68(%rbp), %rdi
addq $0x10, %rdi
movl -0xdc(%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 -0xdc(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x5380
movl 0x4(%rax), %eax
cmpl -0xac(%rbp), %eax
jne 0x33b4
movq -0x68(%rbp), %rdi
addq $0x10, %rdi
movl -0xdc(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x5380
movl 0x8(%rax), %eax
movl %eax, -0xac(%rbp)
jmp 0x33d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3948
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x33a3
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 0x3948
movq -0x68(%rbp), %rdi
addq $0x10, %rdi
movl -0xdc(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x5380
movl 0x4(%rax), %eax
movl %eax, -0xac(%rbp)
leaq -0xf8(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x53a0
movq -0x218(%rbp), %rsi
movq -0x8(%rbp), %rdi
movq -0x68(%rbp), %rdx
movl -0xdc(%rbp), %ecx
callq 0x6c40
jmp 0x3406
movl $0x50, %edi
callq 0x2170
movq %rax, -0x220(%rbp)
jmp 0x3419
movq -0x220(%rbp), %rax
movq %rax, -0x100(%rbp)
movl -0xdc(%rbp), %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x230(%rbp)
movq -0x68(%rbp), %rdi
addq $0x10, %rdi
callq 0x5360
movsd -0x230(%rbp), %xmm0
movq %rax, %xmm1
movaps 0x15bb5(%rip), %xmm2    # 0x19010
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x15bb9(%rip), %xmm2    # 0x19020
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movq -0x100(%rbp), %rax
movsd %xmm0, 0x38(%rax)
movq -0x100(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x68(%rbp), %rdi
addq $0x10, %rdi
callq 0x5360
movq %rax, %rcx
movq -0x208(%rbp), %rax
movl %ecx, %edx
movq -0x100(%rbp), %rcx
movl %edx, 0x14(%rcx)
movq -0x100(%rbp), %rcx
movl $0x0, 0x10(%rcx)
movq -0x50(%rbp), %rcx
movsd 0x18(%rcx), %xmm0
movq -0x100(%rbp), %rcx
movsd %xmm0, 0x48(%rcx)
movsd -0xc8(%rbp), %xmm0
movq -0x68(%rbp), %rcx
movsd 0x8(%rcx), %xmm1
divsd %xmm1, %xmm0
movq -0x100(%rbp), %rcx
movsd %xmm0, 0x40(%rcx)
movsd -0xc8(%rbp), %xmm0
movq -0x100(%rbp), %rcx
movsd %xmm0, 0x28(%rcx)
movq -0x68(%rbp), %rcx
movsd 0x8(%rcx), %xmm0
movq -0x100(%rbp), %rcx
movsd %xmm0, 0x30(%rcx)
movq -0x100(%rbp), %rdx
movslq -0xb0(%rbp), %rcx
movl %ecx, %esi
incl %esi
movl %esi, -0xb0(%rbp)
leaq (%rcx,%rcx,4), %rcx
shlq $0x4, %rcx
movups 0x40(%rdx), %xmm0
movups %xmm0, 0x40(%rax,%rcx)
movups (%rdx), %xmm0
movups 0x10(%rdx), %xmm1
movups 0x20(%rdx), %xmm2
movups 0x30(%rdx), %xmm3
movups %xmm3, 0x30(%rax,%rcx)
movups %xmm2, 0x20(%rax,%rcx)
movups %xmm1, 0x10(%rax,%rcx)
movups %xmm0, (%rax,%rcx)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xac(%rbp), %rcx
imulq $0x70, %rcx, %rcx
movsd 0x18(%rax,%rcx), %xmm0
movsd %xmm0, -0x108(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xac(%rbp), %rcx
imulq $0x70, %rcx, %rcx
movsd 0x20(%rax,%rcx), %xmm0
movsd %xmm0, -0x110(%rbp)
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xcc(%rbp), %rcx
shlq $0x4, %rcx
movsd (%rax,%rcx), %xmm0
movsd %xmm0, -0x118(%rbp)
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xcc(%rbp), %rcx
shlq $0x4, %rcx
movsd 0x8(%rax,%rcx), %xmm0
movsd %xmm0, -0x120(%rbp)
movsd -0x108(%rbp), %xmm0
movsd -0x110(%rbp), %xmm1
movsd -0x118(%rbp), %xmm2
movsd -0x120(%rbp), %xmm3
callq 0x7780
movsd %xmm0, -0x228(%rbp)
jmp 0x3622
movsd -0x228(%rbp), %xmm1
movq -0x8(%rbp), %rax
movsd 0x18(%rax), %xmm0
ucomisd %xmm1, %xmm0
jb 0x3659
movl $0x6, -0x124(%rbp)
jmp 0x3730
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3773
movl -0xcc(%rbp), %ecx
movq -0x100(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x8(%rbp), %rax
movq %rax, -0x240(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x238(%rbp)
leaq -0x140(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x53c0
jmp 0x3694
movq -0x238(%rbp), %rsi
movq -0x240(%rbp), %rdi
movq -0x100(%rbp), %rcx
movl -0xac(%rbp), %r8d
leaq -0x140(%rbp), %rdx
callq 0xf080
movb %al, -0x241(%rbp)
jmp 0x36c4
leaq -0x140(%rbp), %rdi
callq 0x54b0
movb -0x241(%rbp), %al
andb $0x1, %al
movb %al, -0x125(%rbp)
movq -0x100(%rbp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0xcc(%rbp)
movb -0x125(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x3724
movl $0x4, -0x124(%rbp)
jmp 0x3730
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x54b0
jmp 0x3773
jmp 0x3726
movl $0x0, -0x124(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x54b0
movl -0x124(%rbp), %eax
movl %eax, -0x248(%rbp)
testl %eax, %eax
je 0x375d
jmp 0x374e
movl -0x248(%rbp), %eax
subl $0x4, %eax
je 0x3784
jmp 0x375b
jmp 0x375f
jmp 0x375f
movl -0xdc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xdc(%rbp)
jmp 0x32c6
leaq -0xf8(%rbp), %rdi
callq 0x54b0
jmp 0x3948
callq 0x2100
movq -0x1d0(%rbp), %rsi
movq %rax, -0x148(%rbp)
leaq 0x158f2(%rip), %rdx     # 0x19090
leaq -0x1a8(%rbp), %rdi
callq 0x52a0
jmp 0x37ac
leaq -0x188(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x5560
jmp 0x37c5
leaq 0x158c6(%rip), %rdx     # 0x19092
leaq -0x168(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x5510
jmp 0x37e1
leaq -0x188(%rbp), %rdi
callq 0x20d0
leaq -0x1a8(%rbp), %rdi
callq 0x20d0
movl -0xb0(%rbp), %eax
movl %eax, -0x24c(%rbp)
leaq -0x1c8(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x2090
jmp 0x381a
movl -0x24c(%rbp), %esi
movq -0x208(%rbp), %rdi
movq -0x148(%rbp), %rax
movq -0xd8(%rbp), %rcx
subq %rcx, %rax
cvtsi2sd %rax, %xmm0
movsd 0x157c3(%rip), %xmm1    # 0x19008
divsd %xmm1, %xmm0
leaq -0x1c8(%rbp), %rdx
callq 0x8180
jmp 0x3857
leaq -0x1c8(%rbp), %rdi
callq 0x20d0
movq -0x50(%rbp), %rax
movq %rax, -0x258(%rbp)
cmpq $0x0, %rax
je 0x388c
movq -0x258(%rbp), %rdi
callq 0x55b0
movq -0x258(%rbp), %rdi
callq 0x2150
movq -0x68(%rbp), %rax
movq %rax, -0x260(%rbp)
cmpq $0x0, %rax
je 0x38b5
movq -0x260(%rbp), %rdi
callq 0x55d0
movq -0x260(%rbp), %rdi
callq 0x2150
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x20d0
movq -0xb8(%rbp), %rax
movq %rax, %rsp
leaq -0x48(%rbp), %rdi
callq 0x20d0
jmp 0x3142
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3908
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x20d0
leaq -0x1a8(%rbp), %rdi
callq 0x20d0
jmp 0x3948
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x393c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x20d0
leaq -0x168(%rbp), %rdi
callq 0x20d0
leaq -0x48(%rbp), %rdi
callq 0x20d0
jmp 0x3958
movq %rbp, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x2240
nopw %cs:(%rax,%rax)