// File: 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
subq $0x160, %rsp            # imm = 0x160
movq %rsi, -0x160(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0xea1a(%rip), %rdi      # 0x1986b
movb $0x0, %al
callq 0x2040
movq -0x160(%rbp), %rdi
movl $0x0, -0x14(%rbp)
callq 0x2080
movq %rax, %rdi
leaq 0xe97d(%rip), %rsi      # 0x197f2
callq 0x2190
movq %rax, -0x148(%rbp)
cmpq $0x0, -0x148(%rbp)
jne 0xae9e
leaq 0xea00(%rip), %rdi      # 0x19892
movb $0x0, %al
callq 0x2040
jmp 0xb05b
movq -0x8(%rbp), %rax
movl $0x0, (%rax)
leaq -0x140(%rbp), %rdi
movq -0x148(%rbp), %rdx
movl $0x12c, %esi            # imm = 0x12C
callq 0x2210
cmpq $0x0, %rax
je 0xb059
leaq -0x140(%rbp), %rdi
leaq 0xe93f(%rip), %rsi      # 0x19817
callq 0x2200
movq %rax, -0x150(%rbp)
xorl %eax, %eax
movl %eax, %edi
leaq 0xe928(%rip), %rsi      # 0x19817
callq 0x2200
movq %rax, -0x150(%rbp)
movq -0x150(%rbp), %rdi
callq 0x21f0
movl %eax, -0x154(%rbp)
xorl %eax, %eax
movl %eax, %edi
leaq 0xe8ff(%rip), %rsi      # 0x19817
callq 0x2200
movq %rax, -0x150(%rbp)
movq -0x150(%rbp), %rdi
callq 0x21f0
movl %eax, -0x158(%rbp)
movl -0x14(%rbp), %ecx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rdx
movslq (%rdx), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movl -0x154(%rbp), %ecx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rdx
movslq (%rdx), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
movl -0x158(%rbp), %ecx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rdx
movslq (%rdx), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x8(%rbp), %rax
movslq (%rax), %rax
shlq $0x5, %rax
addq %rax, %rsi
callq 0x7de0
movq -0x8(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x154(%rbp), %rax
imulq $0x70, %rax, %rax
addq %rax, %rdi
addq $0x40, %rdi
leaq -0x158(%rbp), %rsi
callq 0x8fb0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x154(%rbp), %rax
imulq $0x70, %rax, %rax
addq %rax, %rdi
addq $0x58, %rdi
leaq -0x14(%rbp), %rsi
callq 0x8fb0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x158(%rbp), %rax
imulq $0x70, %rax, %rax
addq %rax, %rdi
addq $0x40, %rdi
leaq -0x154(%rbp), %rsi
callq 0x8fb0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x158(%rbp), %rax
imulq $0x70, %rax, %rax
addq %rax, %rdi
addq $0x58, %rdi
leaq -0x14(%rbp), %rsi
callq 0x8fb0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xaea8
jmp 0xb05b
movq -0x148(%rbp), %rdi
callq 0x2160
movl -0x14(%rbp), %esi
leaq 0xe842(%rip), %rdi      # 0x198b3
movb $0x0, %al
callq 0x2040
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
nopw %cs:(%rax,%rax)