// File: jkeys-ecg-nmsu[P]graph-with-search-algorithms/Graph.cpp
// Function: Graph::save(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) const
void Graph::save(const string & file) const {
	ofstream fs( file.c_str() );
	assert( fs.is_open() );
	
	
	for(unsigned int u = 0; u != m_nodes.size(); u++) {
		set<Node> adjNodes = getAdjNodes(m_nodes[u]);
		list<Edge> uEdges = getEdges(m_nodes[u]);
		//only print to file if this node has children (directed)
		for(list<Edge>::iterator e = uEdges.begin(); e != uEdges.end(); e++) {
			fs << name(e->u_id()) << '\t' << name(e->v_id()) << '\t' << e->weight() << '\n';
		}
 	}
		
	fs.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x330, %rsp            # imm = 0x330
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2d8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2100
movq %rax, %rsi
leaq -0x210(%rbp), %rdi
movq %rdi, -0x2d0(%rbp)
movl $0x10, %edx
callq 0x22a0
movq -0x2d0(%rbp), %rdi
callq 0x21b0
movb %al, -0x2c1(%rbp)
jmp 0x6d06
movb -0x2c1(%rbp), %al
testb $0x1, %al
jne 0x6d12
jmp 0x6d14
jmp 0x6d4a
leaq 0x13355(%rip), %rdi     # 0x1a070
leaq 0x1335b(%rip), %rsi     # 0x1a07d
movl $0x1b8, %edx            # imm = 0x1B8
leaq 0x1352a(%rip), %rcx     # 0x1a258
callq 0x2190
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x7072
movl $0x0, -0x220(%rbp)
movq -0x2d8(%rbp), %rdi
movl -0x220(%rbp), %eax
movq %rax, -0x2e0(%rbp)
callq 0x7ca0
movq %rax, %rcx
movq -0x2e0(%rbp), %rax
cmpq %rcx, %rax
je 0x704f
movq -0x2d8(%rbp), %rdi
movl -0x220(%rbp), %eax
movl %eax, %esi
callq 0x7c80
movq -0x2d8(%rbp), %rdi
movq %rax, %rsi
callq 0x6320
movq %rax, -0x2e8(%rbp)
jmp 0x6dac
movq -0x2e8(%rbp), %rsi
leaq -0x250(%rbp), %rdi
callq 0x8750
jmp 0x6dc1
movq -0x2d8(%rbp), %rdi
movl -0x220(%rbp), %eax
movl %eax, %esi
callq 0x7c80
movq -0x2d8(%rbp), %rdi
movq %rax, %rsi
callq 0x63a0
movq %rax, -0x2f0(%rbp)
jmp 0x6ded
movq -0x2f0(%rbp), %rsi
leaq -0x268(%rbp), %rdi
callq 0x8870
jmp 0x6e02
leaq -0x268(%rbp), %rdi
callq 0x8930
movq %rax, -0x270(%rbp)
leaq -0x268(%rbp), %rdi
callq 0x8990
movq %rax, -0x278(%rbp)
leaq -0x270(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x8960
testb $0x1, %al
jne 0x6e44
jmp 0x7009
leaq -0x270(%rbp), %rdi
callq 0x89c0
movq %rax, %rdi
callq 0xeec0
movl %eax, -0x2f4(%rbp)
jmp 0x6e60
movl -0x2f4(%rbp), %edx
movq -0x2d8(%rbp), %rsi
leaq -0x298(%rbp), %rdi
callq 0x5f50
jmp 0x6e7b
leaq -0x210(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x2220
movq %rax, -0x300(%rbp)
jmp 0x6e97
movq -0x300(%rbp), %rdi
movl $0x9, %esi
callq 0x22d0
movq %rax, -0x308(%rbp)
jmp 0x6eb1
leaq -0x270(%rbp), %rdi
callq 0x89c0
movq %rax, %rdi
callq 0xeed0
movl %eax, -0x30c(%rbp)
jmp 0x6ecd
movl -0x30c(%rbp), %edx
movq -0x2d8(%rbp), %rsi
leaq -0x2b8(%rbp), %rdi
callq 0x5f50
jmp 0x6ee8
movq -0x308(%rbp), %rdi
leaq -0x2b8(%rbp), %rsi
callq 0x2220
movq %rax, -0x318(%rbp)
jmp 0x6f04
movq -0x318(%rbp), %rdi
movl $0x9, %esi
callq 0x22d0
movq %rax, -0x320(%rbp)
jmp 0x6f1e
leaq -0x270(%rbp), %rdi
callq 0x89c0
movq %rax, %rdi
callq 0xeef0
movsd %xmm0, -0x328(%rbp)
jmp 0x6f3c
movsd -0x328(%rbp), %xmm0
movq -0x320(%rbp), %rdi
callq 0x2430
movq %rax, -0x330(%rbp)
jmp 0x6f59
movq -0x330(%rbp), %rdi
movl $0xa, %esi
callq 0x22d0
jmp 0x6f6c
leaq -0x2b8(%rbp), %rdi
callq 0x2170
leaq -0x298(%rbp), %rdi
callq 0x2170
leaq -0x270(%rbp), %rdi
xorl %esi, %esi
callq 0x89e0
movq %rax, -0x2c0(%rbp)
jmp 0x6e15
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x7041
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x7035
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x6ffb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
leaq -0x2b8(%rbp), %rdi
callq 0x2170
leaq -0x298(%rbp), %rdi
callq 0x2170
jmp 0x7035
leaq -0x268(%rbp), %rdi
callq 0x30b0
leaq -0x250(%rbp), %rdi
callq 0x3530
movl -0x220(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x220(%rbp)
jmp 0x6d54
leaq -0x268(%rbp), %rdi
callq 0x30b0
leaq -0x250(%rbp), %rdi
callq 0x3530
jmp 0x7072
leaq -0x210(%rbp), %rdi
callq 0x2330
jmp 0x705d
leaq -0x210(%rbp), %rdi
callq 0x2360
addq $0x330, %rsp            # imm = 0x330
popq %rbp
retq
leaq -0x210(%rbp), %rdi
callq 0x2360
movq -0x218(%rbp), %rdi
callq 0x23e0
nopw (%rax,%rax)