// File: /workspace/github_cpp_makefile_star2_O3/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 0x57b5(%rip), %rdi      # 0xc895
callq 0x21b0
movl $0x0, -0x2c(%rbp)
movq (%r14), %rdi
leaq 0x56b3(%rip), %rsi      # 0xc7a9
callq 0x2160
movq %rax, %r14
testq %rax, %rax
je 0x7297
movl $0x0, (%rbx)
leaq -0x160(%rbp), %rdi
movl $0x12c, %esi            # imm = 0x12C
movq %r14, %rdx
callq 0x21e0
testq %rax, %rax
je 0x72a3
leaq 0x567a(%rip), %r15      # 0xc7ab
leaq -0x160(%rbp), %r12
leaq -0x2c(%rbp), %r13
movq %r12, %rdi
movq %r15, %rsi
callq 0x21d0
xorl %edi, %edi
movq %r15, %rsi
callq 0x21d0
movq %rax, %rdi
callq 0x21c0
movl %eax, -0x34(%rbp)
xorl %edi, %edi
movq %r15, %rsi
callq 0x21d0
movq %rax, %rdi
callq 0x21c0
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %eax
movq 0x8(%rbx), %rcx
movslq (%rbx), %rdx
shlq $0x5, %rdx
leaq (%rcx,%rdx), %rsi
movl %eax, (%rcx,%rdx)
movl -0x34(%rbp), %eax
movl %eax, 0x4(%rcx,%rdx)
movl -0x30(%rbp), %eax
movl %eax, 0x8(%rcx,%rdx)
movq %rbx, %rdi
callq 0x6099
incl (%rbx)
movq 0x10(%rbx), %rax
movslq -0x34(%rbp), %rcx
imulq $0x70, %rcx, %rcx
leaq (%rax,%rcx), %rdi
addq $0x40, %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x71cb
movl -0x30(%rbp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x71d8
leaq -0x30(%rbp), %rdx
callq 0x6da2
movq 0x10(%rbx), %rax
movslq -0x34(%rbp), %rcx
imulq $0x70, %rcx, %rcx
leaq (%rax,%rcx), %rdi
addq $0x58, %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x7201
movl -0x2c(%rbp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x720d
movq %r13, %rdx
callq 0x6da2
movq 0x10(%rbx), %rax
movslq -0x30(%rbp), %rcx
imulq $0x70, %rcx, %rcx
leaq (%rax,%rcx), %rdi
addq $0x40, %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x7236
movl -0x34(%rbp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x7243
leaq -0x34(%rbp), %rdx
callq 0x6da2
movq 0x10(%rbx), %rax
movslq -0x30(%rbp), %rcx
imulq $0x70, %rcx, %rcx
leaq (%rax,%rcx), %rdi
addq $0x58, %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x726c
movl -0x2c(%rbp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x7277
movq %r13, %rdx
callq 0x6da2
movl -0x2c(%rbp), %eax
incl %eax
movl %eax, -0x2c(%rbp)
movq %r12, %rdi
movl $0x12c, %esi            # imm = 0x12C
movq %r14, %rdx
callq 0x21e0
testq %rax, %rax
jne 0x713c
jmp 0x72a3
leaq 0x561d(%rip), %rdi      # 0xc8bb
callq 0x21b0
movq %r14, %rdi
callq 0x2130
movl -0x2c(%rbp), %esi
leaq 0x554a(%rip), %rdi      # 0xc7ff
xorl %eax, %eax
callq 0x2040
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq