// File: /workspace/github_cpp_makefile_star2_O2/Proudc[P]CTSS/src/ContinuousQuery/Construct.cpp
// Function: readEdges(Graph*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void readEdges(Graph* myGraph, const std::string edgeFilePath)
{
	printf("Reading edge information from file...\n");
	int   count = 0;
	char  line[300];
	FILE* fp;
	char* p;
	fp = fopen(edgeFilePath.c_str(), "r");
	if (!fp)
	{
		printf("Error when reading edge file...\n");
	}
	else
	{
		myGraph->edgePos = 0;
		while (fgets(line, 300, fp) != NULL)
		{
			p = strtok(line, " |\t");
			p = strtok(NULL, " |\t");
			int startVertexID = atoi(p);
			p = strtok(NULL, " |\t");
			int stopVertexID = atoi(p);

			myGraph->edgesVector[myGraph->edgePos].edgeID        = count;
			myGraph->edgesVector[myGraph->edgePos].firstVertexID = startVertexID;
			myGraph->edgesVector[myGraph->edgePos].secVertexID   = stopVertexID;
			setEdgeLength(myGraph, &(myGraph->edgesVector[myGraph->edgePos]));

			myGraph->edgePos += 1;
			myGraph->vertexsVector[startVertexID].adjVertexID.push_back(stopVertexID);
			myGraph->vertexsVector[startVertexID].adjEdgeID.push_back(count);
			myGraph->vertexsVector[stopVertexID].adjVertexID.push_back(startVertexID);
			myGraph->vertexsVector[stopVertexID].adjEdgeID.push_back(count);
			count++;
		}
	}
	fclose(fp);
	printf("Finish reading edge information from file---A total of %d edge are read!!!\n", count);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x4aa5(%rip), %rdi      # 0xa865
callq 0x21a0
andl $0x0, -0x34(%rbp)
movq (%r14), %rdi
leaq 0x49a6(%rip), %rsi      # 0xa779
callq 0x2130
movq %rax, %r14
testq %rax, %rax
je 0x5eee
andl $0x0, (%rbx)
leaq -0x160(%rbp), %r15
leaq 0x4986(%rip), %r12      # 0xa77b
leaq -0x34(%rbp), %r13
movq %r15, %rdi
movl $0x12c, %esi            # imm = 0x12C
movq %r14, %rdx
callq 0x21d0
testq %rax, %rax
je 0x5efa
movq %r15, %rdi
movq %r12, %rsi
callq 0x21c0
xorl %edi, %edi
movq %r12, %rsi
callq 0x21c0
movq %rax, %rdi
callq 0x21b0
movl %eax, -0x30(%rbp)
xorl %edi, %edi
movq %r12, %rsi
callq 0x21c0
movq %rax, %rdi
callq 0x21b0
movl %eax, -0x2c(%rbp)
movl -0x34(%rbp), %eax
movq 0x8(%rbx), %rcx
movslq (%rbx), %rdx
shlq $0x5, %rdx
leaq (%rcx,%rdx), %rsi
movl %eax, (%rcx,%rdx)
movl -0x30(%rbp), %eax
movl %eax, 0x4(%rcx,%rdx)
movl -0x2c(%rbp), %eax
movl %eax, 0x8(%rcx,%rdx)
movq %rbx, %rdi
callq 0x4f12
incl (%rbx)
movq 0x10(%rbx), %rax
movslq -0x30(%rbp), %rcx
imulq $0x70, %rcx, %rcx
leaq (%rax,%rcx), %rdi
addq $0x40, %rdi
leaq -0x2c(%rbp), %rsi
callq 0x57a4
movq 0x10(%rbx), %rax
movslq -0x30(%rbp), %rcx
imulq $0x70, %rcx, %rcx
leaq (%rax,%rcx), %rdi
addq $0x58, %rdi
movq %r13, %rsi
callq 0x57a4
movq 0x10(%rbx), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x70, %rcx, %rcx
leaq (%rax,%rcx), %rdi
addq $0x40, %rdi
leaq -0x30(%rbp), %rsi
callq 0x57a4
movq 0x10(%rbx), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x70, %rcx, %rcx
leaq (%rax,%rcx), %rdi
addq $0x58, %rdi
movq %r13, %rsi
callq 0x57a4
incl -0x34(%rbp)
jmp 0x5df9
leaq 0x4996(%rip), %rdi      # 0xa88b
callq 0x21a0
movq %r14, %rdi
callq 0x2100
movl -0x34(%rbp), %esi
leaq 0x48c3(%rip), %rdi      # 0xa7cf
xorl %eax, %eax
callq 0x2040
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq