// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %rdi, %r14
movq (%rsi), %rsi
leaq -0x2c0(%rbp), %rdi
movl $0x10, %edx
callq 0x2250
leaq -0x250(%rbp), %rdi
callq 0x20a0
testb %al, %al
je 0x59d1
movq (%r14), %rdi
cmpq %rdi, 0x8(%r14)
je 0x597d
xorl %r15d, %r15d
leaq -0xc0(%rbp), %r12
leaq -0x90(%rbp), %rbx
xorl %r13d, %r13d
shlq $0x7, %r15
addq %r15, %rdi
callq 0x7c44
cltq
leaq (%rax,%rax,2), %rsi
shlq $0x4, %rsi
addq 0x18(%r14), %rsi
movq %r12, %rdi
callq 0x6756
movq %r13, -0x78(%rbp)
addq (%r14), %r15
movq %r15, %rdi
callq 0x7c44
cltq
leaq (%rax,%rax,2), %rsi
shlq $0x3, %rsi
addq 0x30(%r14), %rsi
movq %rbx, %rdi
callq 0x6602
movq -0x90(%rbp), %r13
cmpq %rbx, %r13
je 0x5934
leaq 0x10(%r13), %r15
movq %r15, %rdi
callq 0x7cb4
movslq %eax, %rdi
shlq $0x7, %rdi
addq (%r14), %rdi
callq 0x7c4e
leaq -0x60(%rbp), %rcx
movq %rcx, -0x70(%rbp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %rdi
callq 0x2c2e
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
leaq -0x2c0(%rbp), %rdi
callq 0x2270
movb $0x9, -0x50(%rbp)
movl $0x1, %edx
movq %rax, %rdi
leaq -0x50(%rbp), %rsi
callq 0x2270
movq %rax, %r12
movq %r15, %rdi
callq 0x7cbc
movslq %eax, %rdi
shlq $0x7, %rdi
addq (%r14), %rdi
callq 0x7c4e
leaq -0x40(%rbp), %rcx
movq %rcx, -0x50(%rbp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x50(%rbp), %rdi
callq 0x2c2e
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %r12, %rdi
callq 0x2270
movb $0x9, -0x29(%rbp)
movl $0x1, %edx
movq %rax, %rdi
leaq -0x29(%rbp), %rsi
callq 0x2270
movq %rax, %r12
movq %r15, %rdi
callq 0x7cc6
movq %r12, %rdi
callq 0x2310
movb $0xa, -0x29(%rbp)
movl $0x1, %edx
movq %rax, %rdi
leaq -0x29(%rbp), %rsi
callq 0x2270
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x590e
callq 0x21f0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x5920
callq 0x21f0
movq (%r13), %r13
cmpq %rbx, %r13
jne 0x581b
movq -0x90(%rbp), %r13
cmpq %rbx, %r13
je 0x594d
movq (%r13), %r15
movq %r13, %rdi
callq 0x21f0
movq %r15, %r13
cmpq %rbx, %r15
jne 0x5939
leaq -0xc0(%rbp), %r12
movq %r12, %rdi
callq 0x2dba
movq -0x78(%rbp), %r13
incl %r13d
movq (%r14), %rdi
movq 0x8(%r14), %rax
subq %rdi, %rax
sarq $0x7, %rax
movq %r13, %r15
cmpq %r13, %rax
jne 0x57c4
leaq -0x2c0(%rbp), %rdi
callq 0x22b0
movq 0xf638(%rip), %rax      # 0x14fc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x2b8(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x2c0(%rbp,%rcx)
callq 0x21d0
leaq -0x1c8(%rbp), %rdi
callq 0x20e0
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x96d8(%rip), %rdi      # 0xf0b0
leaq 0x96de(%rip), %rsi      # 0xf0bd
leaq 0x98b2(%rip), %rcx      # 0xf298
movl $0x1b8, %edx            # imm = 0x1B8
callq 0x2150
jmp 0x59f2
movq %rax, %r14
jmp 0x5a57
movq %rax, %r14
jmp 0x5a4b
jmp 0x59fe
movq %rax, %r14
jmp 0x5a1d
movq %rax, %r14
jmp 0x5a2f
movq %rax, %r14
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x5a1d
callq 0x21f0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x5a2f
callq 0x21f0
movq -0x90(%rbp), %rdi
cmpq %rbx, %rdi
je 0x5a4b
movq (%rdi), %r15
callq 0x21f0
movq %r15, %rdi
cmpq %rbx, %r15
jne 0x5a3b
leaq -0xc0(%rbp), %rdi
callq 0x2dba
leaq -0x2c0(%rbp), %rdi
callq 0x22e0
movq %r14, %rdi
callq 0x2380
nop