// File: jkeys-ecg-nmsu[P]graph-with-search-algorithms/Graph.cpp
// Function: Graph::saveUndirected(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) const
void Graph::saveUndirected(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]);
		for(set<Node>::iterator v = adjNodes.begin(); v != adjNodes.end(); v++) {
			fs << m_nodes[u].name() << '\t' << m_nodes[v->id()].name() << '\n';
			fs << m_nodes[v->id()].name() << '\t' << m_nodes[u].name() << '\n'; //may print duplicates;		
		}
 	}
	
	
	fs.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x300, %rsp            # imm = 0x300
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x280(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2100
movq %rax, %rsi
leaq -0x210(%rbp), %rdi
movq %rdi, -0x278(%rbp)
movl $0x10, %edx
callq 0x22a0
movq -0x278(%rbp), %rdi
callq 0x21b0
movb %al, -0x269(%rbp)
jmp 0x70e6
movb -0x269(%rbp), %al
testb $0x1, %al
jne 0x70f2
jmp 0x70f4
jmp 0x712a
leaq 0x12f75(%rip), %rdi     # 0x1a070
leaq 0x12f7b(%rip), %rsi     # 0x1a07d
movl $0x1c9, %edx            # imm = 0x1C9
leaq 0x13171(%rip), %rcx     # 0x1a27f
callq 0x2190
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
jmp 0x7416
movl $0x0, -0x220(%rbp)
movq -0x280(%rbp), %rdi
movl -0x220(%rbp), %eax
movq %rax, -0x288(%rbp)
callq 0x7ca0
movq %rax, %rcx
movq -0x288(%rbp), %rax
cmpq %rcx, %rax
je 0x73f3
movq -0x280(%rbp), %rdi
movl -0x220(%rbp), %eax
movl %eax, %esi
callq 0x7c80
movq -0x280(%rbp), %rdi
movq %rax, %rsi
callq 0x6320
movq %rax, -0x290(%rbp)
jmp 0x718c
movq -0x290(%rbp), %rsi
leaq -0x250(%rbp), %rdi
callq 0x8750
jmp 0x71a1
leaq -0x250(%rbp), %rdi
callq 0x8780
movq %rax, -0x258(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x87e0
movq %rax, -0x260(%rbp)
leaq -0x258(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0x87b0
testb $0x1, %al
jne 0x71e3
jmp 0x73d3
movq -0x280(%rbp), %rdi
movl -0x220(%rbp), %eax
movl %eax, %esi
callq 0x7c80
movq %rax, %rdi
callq 0xeda0
movq %rax, -0x298(%rbp)
jmp 0x7208
movq -0x298(%rbp), %rsi
leaq -0x210(%rbp), %rdi
callq 0x2220
movq %rax, -0x2a0(%rbp)
jmp 0x7224
movq -0x2a0(%rbp), %rdi
movl $0x9, %esi
callq 0x22d0
movq %rax, -0x2a8(%rbp)
jmp 0x723e
movq -0x280(%rbp), %rax
movq %rax, -0x2b8(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x8a10
movq %rax, %rdi
callq 0xed80
movl %eax, -0x2ac(%rbp)
jmp 0x7268
movq -0x2b8(%rbp), %rdi
movl -0x2ac(%rbp), %eax
movslq %eax, %rsi
callq 0x7c80
movq %rax, %rdi
callq 0xeda0
movq %rax, -0x2c0(%rbp)
jmp 0x728e
movq -0x2c0(%rbp), %rsi
movq -0x2a8(%rbp), %rdi
callq 0x2220
movq %rax, -0x2c8(%rbp)
jmp 0x72aa
movq -0x2c8(%rbp), %rdi
movl $0xa, %esi
callq 0x22d0
jmp 0x72bd
movq -0x280(%rbp), %rax
movq %rax, -0x2d8(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x8a10
movq %rax, %rdi
callq 0xed80
movl %eax, -0x2cc(%rbp)
jmp 0x72e7
movq -0x2d8(%rbp), %rdi
movl -0x2cc(%rbp), %eax
movslq %eax, %rsi
callq 0x7c80
movq %rax, %rdi
callq 0xeda0
movq %rax, -0x2e0(%rbp)
jmp 0x730d
movq -0x2e0(%rbp), %rsi
leaq -0x210(%rbp), %rdi
callq 0x2220
movq %rax, -0x2e8(%rbp)
jmp 0x7329
movq -0x2e8(%rbp), %rdi
movl $0x9, %esi
callq 0x22d0
movq %rax, -0x2f0(%rbp)
jmp 0x7343
movq -0x280(%rbp), %rdi
movl -0x220(%rbp), %eax
movl %eax, %esi
callq 0x7c80
movq %rax, %rdi
callq 0xeda0
movq %rax, -0x2f8(%rbp)
jmp 0x7368
movq -0x2f8(%rbp), %rsi
movq -0x2f0(%rbp), %rdi
callq 0x2220
movq %rax, -0x300(%rbp)
jmp 0x7384
movq -0x300(%rbp), %rdi
movl $0xa, %esi
callq 0x22d0
jmp 0x7397
jmp 0x7399
leaq -0x258(%rbp), %rdi
xorl %esi, %esi
callq 0x8830
movq %rax, -0x268(%rbp)
jmp 0x71b4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x218(%rbp)
movl %eax, -0x21c(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x3530
jmp 0x7416
leaq -0x250(%rbp), %rdi
callq 0x3530
movl -0x220(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x220(%rbp)
jmp 0x7134
leaq -0x210(%rbp), %rdi
callq 0x2330
jmp 0x7401
leaq -0x210(%rbp), %rdi
callq 0x2360
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
leaq -0x210(%rbp), %rdi
callq 0x2360
movq -0x218(%rbp), %rdi
callq 0x23e0
nop