// File: /workspace/github_cpp_makefile_star2_O3/Proudc[P]CTSS/src/ContinuousQuery/Discrete.cpp
// Function: creatTrajPoint(Graph*, std::vector<Edge, std::allocator<Edge>>&, int)
std::vector<Point> creatTrajPoint(Graph* myGraph, std::vector<Edge>& temPath, int initialVertex)
{
	// printf("Start discretizing the path...\n");
	std::vector<Point> temPointList;
	Vertex helpFirst, helpSec;
	helpFirst.vertexID = initialVertex;
	for (unsigned int i = 0; i < temPath.size(); i++)
	{
		Edge helpEdge = temPath[i];
		if (helpFirst.vertexID == helpEdge.firstVertexID)
		{
			helpFirst.longitude = myGraph->vertexsVector[helpEdge.firstVertexID].longitude;
			helpFirst.latitude  = myGraph->vertexsVector[helpEdge.firstVertexID].latitude;
			helpSec.longitude   = myGraph->vertexsVector[helpEdge.secVertexID].longitude;
			helpSec.latitude    = myGraph->vertexsVector[helpEdge.secVertexID].latitude;
			helpFirst.vertexID  = helpEdge.secVertexID;
		}
		else
		{
			helpFirst.longitude = myGraph->vertexsVector[helpEdge.secVertexID].longitude;
			helpFirst.latitude  = myGraph->vertexsVector[helpEdge.secVertexID].latitude;
			helpSec.longitude   = myGraph->vertexsVector[helpEdge.firstVertexID].longitude;
			helpSec.latitude    = myGraph->vertexsVector[helpEdge.firstVertexID].latitude;
			helpFirst.vertexID  = helpEdge.firstVertexID;
		}
		double x1 = helpFirst.longitude;
		double y1 = helpFirst.latitude;
		double x2 = helpSec.longitude;
		double y2 = helpSec.latitude;

		double xLength = (x2 - x1) * (myGraph->SECTION_LENGTH) / (helpEdge.realLength);
		double yLength = (y2 - y1) * (myGraph->SECTION_LENGTH) / (helpEdge.realLength);
		double x = x1;
		double y = y1;
		while (realDistance((x1 - x), (y1 - y), y1) < helpEdge.realLength)
		{
			Point* temPoint = new Point;
			temPoint->x = x;
			temPoint->y = y;
			temPointList.push_back(*temPoint);
			x += xLength;
			y += yLength;
		}
	}
	Point* temPoint = new Point;
	temPoint->x = helpSec.longitude;
	temPoint->y = helpSec.latitude;
	temPointList.push_back(*temPoint);
	// printf("The temPointList's size is :%d\n", temPointList.size());
	// printf("Discretization of the path completed!!!\n");
	return temPointList;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rdi, %rbx
xorpd %xmm0, %xmm0
movupd %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movupd %xmm0, -0x80(%rbp)
movupd %xmm0, -0x90(%rbp)
movupd %xmm0, -0xa0(%rbp)
movupd %xmm0, -0xf0(%rbp)
movupd %xmm0, -0x100(%rbp)
movupd %xmm0, -0x110(%rbp)
movl %ecx, -0xe0(%rbp)
movq (%rdx), %rax
cmpq %rax, 0x8(%rdx)
je 0x774a
movl %ecx, %r12d
movq %rdx, %r14
movq %rsi, %r15
xorl %ecx, %ecx
xorl %r13d, %r13d
shlq $0x5, %rcx
movl 0x4(%rax,%rcx), %edx
movl 0x8(%rax,%rcx), %esi
movsd 0x18(%rax,%rcx), %xmm2
cmpl %edx, %r12d
cmovnel %esi, %r12d
movslq %r12d, %rax
movl %edx, %r12d
cmovel %esi, %r12d
movq 0x10(%r15), %rcx
imulq $0x70, %rax, %rax
movsd 0x18(%rcx,%rax), %xmm3
movsd %xmm3, -0xc8(%rbp)
movsd 0x20(%rcx,%rax), %xmm4
movsd %xmm4, -0xc0(%rbp)
movslq %r12d, %rax
imulq $0x70, %rax, %rdx
movsd 0x18(%rcx,%rdx), %xmm0
movsd %xmm0, -0x138(%rbp)
movsd 0x20(%rcx,%rdx), %xmm1
movsd %xmm1, -0x130(%rbp)
movl %eax, -0xe0(%rbp)
movsd %xmm0, -0x40(%rbp)
movapd %xmm0, %xmm5
subsd %xmm3, %xmm5
movsd 0x20(%r15), %xmm0
mulsd %xmm0, %xmm5
divsd %xmm2, %xmm5
movsd %xmm5, -0x58(%rbp)
movsd %xmm1, -0x48(%rbp)
subsd %xmm4, %xmm1
mulsd %xmm0, %xmm1
movsd %xmm2, -0x60(%rbp)
divsd %xmm2, %xmm1
movsd %xmm1, -0x50(%rbp)
movsd %xmm3, -0x70(%rbp)
movsd %xmm4, -0x68(%rbp)
movsd -0x70(%rbp), %xmm0
movsd %xmm3, -0x38(%rbp)
subsd %xmm3, %xmm0
movsd -0x68(%rbp), %xmm2
movapd %xmm2, %xmm1
movsd %xmm4, -0x30(%rbp)
subsd %xmm4, %xmm1
callq 0x59bc
movsd -0x60(%rbp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x772b
movl $0x10, %edi
callq 0x2140
movsd -0x38(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x8(%rax)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x7707
movupd (%rax), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, 0x8(%rbx)
jmp 0x7712
movq %rbx, %rdi
movq %rax, %rdx
callq 0x77d4
movsd -0x38(%rbp), %xmm3
addsd -0x58(%rbp), %xmm3
movsd -0x30(%rbp), %xmm4
addsd -0x50(%rbp), %xmm4
jmp 0x76a1
incl %r13d
movq (%r14), %rax
movq 0x8(%r14), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
movq %r13, %rcx
cmpq %r13, %rdx
ja 0x75ec
jmp 0x774a
movl $0x10, %edi
callq 0x2140
movsd -0x40(%rbp), %xmm0
movsd %xmm0, (%rax)
movsd -0x48(%rbp), %xmm0
movsd %xmm0, 0x8(%rax)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x7780
movupd (%rax), %xmm0
movupd %xmm0, (%rsi)
addq $0x10, 0x8(%rbx)
jmp 0x778b
movq %rbx, %rdi
movq %rax, %rdx
callq 0x77d4
movq %rbx, %rax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x77a4
jmp 0x77a4
movq %rax, %r14
leaq -0x150(%rbp), %rdi
callq 0x6b7e
leaq -0xe0(%rbp), %rdi
callq 0x6b7e
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x77cc
callq 0x2120
movq %r14, %rdi
callq 0x2210