// File: /workspace/github_cpp_makefile_star2_O1/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 0x56a1(%rip), %rdi      # 0xc895
callq 0x21c0
movl $0x0, -0x2c(%rbp)
movq (%r14), %rdi
leaq 0x559f(%rip), %rsi      # 0xc7a9
callq 0x2170
movq %rax, %r14
testq %rax, %rax
je 0x73a6
movl $0x0, (%rbx)
leaq -0x160(%rbp), %rdi
movl $0x12c, %esi            # imm = 0x12C
movq %r14, %rdx
callq 0x21f0
testq %rax, %rax
je 0x73b2
leaq 0x5566(%rip), %r15      # 0xc7ab
leaq -0x160(%rbp), %r12
leaq -0x2c(%rbp), %r13
movq %r12, %rdi
movq %r15, %rsi
callq 0x21e0
xorl %edi, %edi
movq %r15, %rsi
callq 0x21e0
movq %rax, %rdi
callq 0x21d0
movl %eax, -0x34(%rbp)
xorl %edi, %edi
movq %r15, %rsi
callq 0x21e0
movq %rax, %rdi
callq 0x21d0
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 0x6177
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 0x72df
movl -0x30(%rbp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x72e8
leaq -0x30(%rbp), %rdx
callq 0x6eb6
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 0x7315
movl -0x2c(%rbp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x731d
movq %r13, %rdx
callq 0x6eb6
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 0x734a
movl -0x34(%rbp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x7353
leaq -0x34(%rbp), %rdx
callq 0x6eb6
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 0x7380
movl -0x2c(%rbp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x7388
movq %r13, %rdx
callq 0x6eb6
incl -0x2c(%rbp)
movq %r12, %rdi
movl $0x12c, %esi            # imm = 0x12C
movq %r14, %rdx
callq 0x21f0
testq %rax, %rax
jne 0x7250
jmp 0x73b2
leaq 0x550e(%rip), %rdi      # 0xc8bb
callq 0x21c0
movq %r14, %rdi
callq 0x2140
movl -0x2c(%rbp), %esi
leaq 0x543b(%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