// File: DanielWochnik[P]CombOptWS2018/graph.cpp
// Function: DHBW::Graph::read_from_file_plain(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void Graph::read_from_file_plain(std::string const & filename)
{
	assert(_vertices.empty() and _edges.empty());
	std::ifstream infile(filename.c_str());
	assert(infile.good());
	std::string line;
	
	//Read first line, i.e. the number of vertices
	size_t num_vertices;
	{
		std::getline(infile, line);
		std::istringstream iss(line);
		iss >> num_vertices;
		assert(not iss.fail());
	}
	
	// Add vertices
	_vertices.reserve(num_vertices);
	for(size_t i = 0; i < num_vertices; ++i)
	{
		add_vertex();
	}	

	// Read and add edges
	while(std::getline(infile,line))
	{
		size_t a,b;
		std::istringstream iss(line);
		iss >> a >> b; 
		assert(not iss.fail());
		add_edge(VertexId(a),VertexId(b));
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x5b0, %rsp            # imm = 0x5B0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x578(%rbp)
callq 0x3530
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x569(%rbp)
jne 0x2c54
jmp 0x2c6a
movq -0x578(%rbp), %rdi
addq $0x18, %rdi
callq 0x3570
movb %al, -0x569(%rbp)
movb -0x569(%rbp), %al
testb $0x1, %al
jne 0x2c76
jmp 0x2c78
jmp 0x2c97
leaq 0x457a(%rip), %rdi      # 0x71f9
leaq 0x46a6(%rip), %rsi      # 0x732c
movl $0x98, %edx
leaq 0x458c(%rip), %rcx      # 0x721e
callq 0x2120
movq -0x10(%rbp), %rdi
callq 0x20c0
movq %rax, %rsi
leaq -0x218(%rbp), %rdi
movl $0x8, %edx
callq 0x2310
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x218(%rbp,%rax), %rdi
callq 0x22d0
movb %al, -0x579(%rbp)
jmp 0x2cd4
movb -0x579(%rbp), %al
testb $0x1, %al
jne 0x2ce0
jmp 0x2ce2
jmp 0x2d18
leaq 0x4571(%rip), %rdi      # 0x725a
leaq 0x463c(%rip), %rsi      # 0x732c
movl $0x9a, %edx
leaq 0x4522(%rip), %rcx      # 0x721e
callq 0x2120
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x2fb7
leaq -0x248(%rbp), %rdi
movq %rdi, -0x588(%rbp)
callq 0x2250
movq -0x588(%rbp), %rsi
leaq -0x218(%rbp), %rdi
callq 0x2050
jmp 0x2d40
leaq -0x3d0(%rbp), %rdi
leaq -0x248(%rbp), %rsi
movl $0x8, %edx
callq 0x22c0
jmp 0x2d5a
leaq -0x3d0(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x2260
jmp 0x2d6f
movq -0x3d0(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x3d0(%rbp,%rax), %rdi
callq 0x2030
movb %al, -0x589(%rbp)
jmp 0x2d8f
movb -0x589(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x2d9d
jmp 0x2d9f
jmp 0x2df8
leaq 0x44c2(%rip), %rdi      # 0x7268
leaq 0x457f(%rip), %rsi      # 0x732c
movl $0xa3, %edx
leaq 0x4465(%rip), %rcx      # 0x721e
callq 0x2120
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
jmp 0x2fab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x3d0(%rbp), %rdi
callq 0x20e0
jmp 0x2fab
leaq -0x3d0(%rbp), %rdi
callq 0x20e0
movq -0x578(%rbp), %rdi
movq -0x250(%rbp), %rsi
callq 0x35b0
jmp 0x2e19
movq $0x0, -0x3d8(%rbp)
movq -0x3d8(%rbp), %rax
cmpq -0x250(%rbp), %rax
jae 0x2e58
movq -0x578(%rbp), %rdi
callq 0x2a30
jmp 0x2e42
jmp 0x2e44
movq -0x3d8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x3d8(%rbp)
jmp 0x2e24
jmp 0x2e5a
leaq -0x218(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x2050
movq %rax, -0x598(%rbp)
jmp 0x2e76
movq -0x598(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2240
movb %al, -0x599(%rbp)
jmp 0x2e94
movb -0x599(%rbp), %al
testb $0x1, %al
jne 0x2ea3
jmp 0x2f8a
leaq -0x568(%rbp), %rdi
leaq -0x248(%rbp), %rsi
movl $0x8, %edx
callq 0x22c0
jmp 0x2ebd
leaq -0x568(%rbp), %rdi
leaq -0x3e0(%rbp), %rsi
callq 0x2260
movq %rax, -0x5a8(%rbp)
jmp 0x2ed9
movq -0x5a8(%rbp), %rdi
leaq -0x3e8(%rbp), %rsi
callq 0x2260
jmp 0x2eee
movq -0x568(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x568(%rbp,%rax), %rdi
callq 0x2030
movb %al, -0x5a9(%rbp)
jmp 0x2f0e
movb -0x5a9(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x2f1c
jmp 0x2f1e
jmp 0x2f5d
leaq 0x4343(%rip), %rdi      # 0x7268
leaq 0x4400(%rip), %rsi      # 0x732c
movl $0xb3, %edx
leaq 0x42e6(%rip), %rcx      # 0x721e
callq 0x2120
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x568(%rbp), %rdi
callq 0x20e0
jmp 0x2fab
movq -0x578(%rbp), %rdi
movq -0x3e0(%rbp), %rsi
movq -0x3e8(%rbp), %rdx
callq 0x2a70
jmp 0x2f79
leaq -0x568(%rbp), %rdi
callq 0x20e0
jmp 0x2e5a
leaq -0x248(%rbp), %rdi
callq 0x2110
leaq -0x218(%rbp), %rdi
callq 0x2070
addq $0x5b0, %rsp            # imm = 0x5B0
popq %rbp
retq
leaq -0x248(%rbp), %rdi
callq 0x2110
leaq -0x218(%rbp), %rdi
callq 0x2070
movq -0x220(%rbp), %rdi
callq 0x22e0
nop