// File: /workspace/github_cpp_makefile_star2_O1/jkeys-ecg-nmsu[P]graph-with-search-algorithms/Graph.cpp
// Function: Graph::scan_undirected(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void Graph::scan_undirected(const string & file) {
    ifstream fs;
    string line, u, v;
	int u_id, v_id, weight;	
    std::set<string> node_names;
	std::map<string, int> node_id_map;
		
	initEmpty(MAX_NODES); //reserve memory space, initialize vector set 
	
	fs.open(file.c_str());	
	assert(fs.is_open());
	
	while (!fs.eof()) {	  
		fs >> u >> v >> weight;
		
		 u = trim(u); /***/ v = trim(v); 		 
		 if(u.size() == 0 || v.size() == 0) continue; //skip blank lines (EOF)

		set<string>::iterator u_string_itr = node_names.find(u);
		 
		//check if node exists
		if(u_string_itr == node_names.end()) { //does not exist
			u_id = current_id;
			current_id++;			
			
			node_names.insert(u);
			node_id_map.insert( pair<string, int>(u, u_id)  );
			Node nodeU(u, u_id); //the source node; put it in the node_set
			m_nodes.push_back(nodeU);
		} else { //does exist, find that nodes id by looking up node name in map (node name string is key, node id is value)
			u_id = node_id_map.at(u);
		}		
		
		set<string>::iterator v_string_itr = node_names.find(v);
			
		if(v_string_itr == node_names.end()) {
			v_id = current_id;
			current_id++;			
			
			node_names.insert(v);
			node_id_map.insert( pair<string, int>(v, v_id)  );
			Node nodeV(v, v_id);
			m_nodes.push_back(nodeV);
		} 	else {
			v_id = node_id_map.at(v);
		}		
		
		Node node_u = getNode(u_id);
		Node node_v = getNode(v_id);
		Edge u_v_edge(u_id, v_id, weight);
		Edge v_u_edge(v_id, u_id, weight);
		
		m_adjList[u_id].insert(node_v);		
		m_adjList[v_id].insert(node_u);
		m_edgeList[u_id].push_front(u_v_edge);
		m_edgeList[v_id].push_front(v_u_edge);
	} //end while		
	
	fs.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x438(%rbp), %rdi
callq 0x2260
leaq -0x48(%rbp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x88(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x68(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x158(%rbp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq -0x208(%rbp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movq %rbx, -0x30(%rbp)
movq %rbx, %rdi
movl $0x186a0, %esi          # imm = 0x186A0
callq 0x2f62
movq (%r14), %rsi
leaq -0x438(%rbp), %rdi
movl $0x8, %edx
callq 0x2140
leaq -0x3c0(%rbp), %rdi
callq 0x20a0
testb %al, %al
je 0x3e2f
movq -0x438(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0x418(%rbp,%rax)
jne 0x3db1
leaq -0x1d0(%rbp), %r14
leaq -0x108(%rbp), %r15
leaq -0x438(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x22a0
movq %rax, %rdi
leaq -0x78(%rbp), %rsi
callq 0x22a0
movq %rax, %rdi
leaq -0x34(%rbp), %rsi
callq 0x2130
movq %r14, -0x1e0(%rbp)
leaq -0x1e0(%rbp), %r13
movq %r13, %rdi
leaq 0xb840(%rip), %rsi      # 0xf0e8
leaq 0xb83d(%rip), %rdx      # 0xf0ec
callq 0x2e54
leaq -0x118(%rbp), %r12
movq %r12, %rdi
leaq -0x98(%rbp), %rbx
movq %rbx, %rsi
movq %r13, %rdx
callq 0x9050
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2290
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x38ec
callq 0x21f0
movq -0x1e0(%rbp), %rdi
cmpq %r14, %rdi
je 0x38fd
callq 0x21f0
movq %r14, -0x1e0(%rbp)
movq %r13, %rdi
leaq 0xb7da(%rip), %rsi      # 0xf0e8
leaq 0xb7d7(%rip), %rdx      # 0xf0ec
callq 0x2e54
movq %r12, %rdi
leaq -0x78(%rbp), %rbx
movq %rbx, %rsi
movq %r13, %rdx
callq 0x9050
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2290
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
movq %r12, %r13
je 0x394b
callq 0x21f0
movq -0x1e0(%rbp), %rdi
cmpq %r14, %rdi
je 0x395c
callq 0x21f0
cmpq $0x0, -0x90(%rbp)
je 0x3d98
cmpq $0x0, -0x70(%rbp)
je 0x3d98
leaq -0x160(%rbp), %rdi
leaq -0x98(%rbp), %r14
movq %r14, %rsi
callq 0x6944
leaq -0x158(%rbp), %rcx
cmpq %rcx, %rax
je 0x39b1
leaq -0x210(%rbp), %rdi
movq %r14, %rsi
callq 0x5f0c
movq %r15, %r14
movl (%rax), %r12d
jmp 0x3a5d
movq -0x30(%rbp), %rcx
movl 0x60(%rcx), %r12d
leal 0x1(%r12), %eax
movl %eax, 0x60(%rcx)
leaq -0x160(%rbp), %rdi
movq %r14, %rsi
callq 0x69e2
movq %r15, -0x118(%rbp)
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x2bfe
movl %r12d, -0xf8(%rbp)
leaq -0x210(%rbp), %rdi
movq %r13, %rsi
callq 0x6bac
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x3a17
callq 0x21f0
movq %r13, %rdi
movq %r14, %rsi
movl %r12d, %edx
callq 0x7a24
movq -0x30(%rbp), %rdi
movq %r13, %rsi
callq 0x5ed4
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x3a49
callq 0x21f0
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x3a5a
callq 0x21f0
movq %r15, %r14
leaq -0x160(%rbp), %rdi
movq %rbx, %rsi
callq 0x6944
leaq -0x158(%rbp), %rcx
cmpq %rcx, %rax
je 0x3a8f
leaq -0x210(%rbp), %rdi
movq %rbx, %rsi
callq 0x5f0c
movl (%rax), %r15d
jmp 0x3b31
movq -0x30(%rbp), %rcx
movl 0x60(%rcx), %r15d
leal 0x1(%r15), %eax
movl %eax, 0x60(%rcx)
leaq -0x160(%rbp), %rdi
movq %rbx, %rsi
callq 0x69e2
movq %r14, -0x118(%rbp)
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x2bfe
movl %r15d, -0xf8(%rbp)
leaq -0x210(%rbp), %rdi
movq %r13, %rsi
callq 0x6bac
movq -0x118(%rbp), %rdi
cmpq %r14, %rdi
je 0x3aee
callq 0x21f0
movq %r13, %rdi
movq %rbx, %rsi
movl %r15d, %edx
callq 0x7a24
movq -0x30(%rbp), %rdi
movq %r13, %rsi
callq 0x5ed4
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x3b20
callq 0x21f0
movq -0x118(%rbp), %rdi
cmpq %r14, %rdi
je 0x3b31
callq 0x21f0
movq %r12, -0x130(%rbp)
movslq %r12d, %rbx
movq -0x30(%rbp), %r12
movq %r12, %r13
movq (%r12), %r12
movq %rbx, -0x128(%rbp)
shlq $0x7, %rbx
movq %r14, -0x118(%rbp)
movq (%r12,%rbx), %rsi
movq 0x8(%r12,%rbx), %rdx
addq %rsi, %rdx
leaq -0x118(%rbp), %rdi
callq 0x2bfe
addq %rbx, %r12
movupd 0x20(%r12), %xmm0
movups 0x30(%r12), %xmm1
movups 0x40(%r12), %xmm2
movups 0x50(%r12), %xmm3
movups %xmm3, 0x40(%r14)
movups %xmm2, 0x30(%r14)
movups %xmm1, 0x20(%r14)
movupd %xmm0, 0x10(%r14)
leaq -0xa8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq 0x60(%r12), %rsi
movq 0x68(%r12), %rdx
addq %rsi, %rdx
leaq -0xb8(%rbp), %rdi
callq 0x2bfe
movq %r15, %r14
movslq %r15d, %r12
movq (%r13), %rbx
movq %r12, -0x120(%rbp)
shlq $0x7, %r12
leaq -0x1d0(%rbp), %r15
movq %r15, -0x1e0(%rbp)
movq (%rbx,%r12), %rsi
movq 0x8(%rbx,%r12), %rdx
addq %rsi, %rdx
leaq -0x1e0(%rbp), %rdi
callq 0x2bfe
addq %r12, %rbx
movupd 0x20(%rbx), %xmm0
movups 0x30(%rbx), %xmm1
movups 0x40(%rbx), %xmm2
movups 0x50(%rbx), %xmm3
movups %xmm3, 0x40(%r15)
movups %xmm2, 0x30(%r15)
movups %xmm1, 0x20(%r15)
movupd %xmm0, 0x10(%r15)
leaq -0x170(%rbp), %rax
movq %rax, -0x180(%rbp)
movq 0x60(%rbx), %rsi
movq 0x68(%rbx), %rdx
addq %rsi, %rdx
leaq -0x180(%rbp), %rdi
callq 0x2bfe
xorps %xmm0, %xmm0
cvtsi2sdl -0x34(%rbp), %xmm0
leaq -0x230(%rbp), %rdi
movq -0x130(%rbp), %rbx
movl %ebx, %esi
movl %r14d, %edx
callq 0x7c24
xorps %xmm0, %xmm0
cvtsi2sdl -0x34(%rbp), %xmm0
leaq -0x220(%rbp), %rdi
movl %r14d, %esi
movl %ebx, %edx
callq 0x7c24
movq -0x30(%rbp), %r12
movq -0x128(%rbp), %rax
leaq (%rax,%rax,2), %r13
movq %r13, %rdi
shlq $0x4, %rdi
addq 0x18(%r12), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x7128
movq -0x120(%rbp), %rax
leaq (%rax,%rax,2), %r15
movq %r15, %rdi
shlq $0x4, %rdi
addq 0x18(%r12), %rdi
leaq -0x118(%rbp), %rsi
callq 0x7128
movq 0x30(%r12), %rbx
movq (%rbx,%r13,8), %r14
movl $0x20, %edi
callq 0x2210
leaq (%rbx,%r13,8), %rbx
movupd -0x230(%rbp), %xmm0
movupd %xmm0, 0x10(%rax)
movq %rax, %rdi
movq %r14, %rsi
callq 0x2050
incq 0x10(%rbx)
movq 0x30(%r12), %rbx
movq (%rbx,%r15,8), %r14
movl $0x20, %edi
callq 0x2210
leaq (%rbx,%r15,8), %rbx
movups -0x220(%rbp), %xmm0
movups %xmm0, 0x10(%rax)
movq %rax, %rdi
movq %r14, %rsi
callq 0x2050
incq 0x10(%rbx)
movq -0x180(%rbp), %rdi
leaq -0x170(%rbp), %rax
cmpq %rax, %rdi
je 0x3d50
callq 0x21f0
movq -0x1e0(%rbp), %rdi
leaq -0x1d0(%rbp), %r14
cmpq %r14, %rdi
leaq -0x108(%rbp), %r15
je 0x3d6f
callq 0x21f0
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x3d87
callq 0x21f0
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x3d98
callq 0x21f0
movq -0x438(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0x418(%rbp,%rax)
je 0x3865
leaq -0x438(%rbp), %rdi
callq 0x2080
leaq -0x210(%rbp), %rdi
callq 0x65b2
leaq -0x160(%rbp), %rdi
callq 0x6646
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x3de7
callq 0x21f0
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
leaq -0x48(%rbp), %rbx
je 0x3e03
callq 0x21f0
movq -0x58(%rbp), %rdi
cmpq %rbx, %rdi
je 0x3e11
callq 0x21f0
leaq -0x438(%rbp), %rdi
callq 0x20b0
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb27a(%rip), %rdi      # 0xf0b0
leaq 0xb280(%rip), %rsi      # 0xf0bd
leaq 0xb2a9(%rip), %rcx      # 0xf0ed
movl $0x69, %edx
callq 0x2150
movq %rax, %rbx
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
jne 0x3eda
jmp 0x3f03
jmp 0x3f00
jmp 0x3e87
jmp 0x3f00
movq %rax, %rbx
movq -0x118(%rbp), %rdi
jmp 0x3ed5
jmp 0x3f00
jmp 0x3e87
jmp 0x3f00
jmp 0x3f00
jmp 0x3f00
movq %rax, %rbx
jmp 0x3ef2
jmp 0x3ee3
movq %rax, %rbx
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
jne 0x3eda
jmp 0x3f03
movq %rax, %rbx
movq -0x1e0(%rbp), %rdi
leaq -0x1d0(%rbp), %rax
cmpq %rax, %rdi
je 0x3ef2
callq 0x21f0
jmp 0x3ef2
jmp 0x3f00
jmp 0x3f00
jmp 0x3ecb
jmp 0x3f00
movq %rax, %rbx
movq -0x1e0(%rbp), %rdi
cmpq %r14, %rdi
je 0x3f03
callq 0x21f0
jmp 0x3f03
jmp 0x3f00
movq %rax, %rbx
leaq -0x1e0(%rbp), %rdi
callq 0x2b90
leaq -0x118(%rbp), %rdi
callq 0x2b90
jmp 0x3f03
movq %rax, %rbx
leaq -0x48(%rbp), %r14
leaq -0x210(%rbp), %rdi
callq 0x65b2
leaq -0x160(%rbp), %rdi
callq 0x6646
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x3f31
callq 0x21f0
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x3f49
callq 0x21f0
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
je 0x3f57
callq 0x21f0
leaq -0x438(%rbp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x2380
nop