// File: /workspace/github_cpp_makefile_star2_O3/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 0x2faa
movq (%r14), %rsi
leaq -0x438(%rbp), %rdi
movl $0x8, %edx
callq 0x2140
leaq -0x3c0(%rbp), %rdi
callq 0x20a0
testb %al, %al
je 0x3e6d
movq -0x438(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0x418(%rbp,%rax)
jne 0x3def
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 0xb802(%rip), %rsi      # 0xf0e8
leaq 0xb7ff(%rip), %rdx      # 0xf0ec
callq 0x2e98
leaq -0x118(%rbp), %r12
movq %r12, %rdi
leaq -0x98(%rbp), %rbx
movq %rbx, %rsi
movq %r13, %rdx
callq 0x909c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2290
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x392a
callq 0x21f0
movq -0x1e0(%rbp), %rdi
cmpq %r14, %rdi
je 0x393b
callq 0x21f0
movq %r14, -0x1e0(%rbp)
movq %r13, %rdi
leaq 0xb79c(%rip), %rsi      # 0xf0e8
leaq 0xb799(%rip), %rdx      # 0xf0ec
callq 0x2e98
movq %r12, %rdi
leaq -0x78(%rbp), %rbx
movq %rbx, %rsi
movq %r13, %rdx
callq 0x909c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2290
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
movq %r12, %r13
je 0x3989
callq 0x21f0
movq -0x1e0(%rbp), %rdi
cmpq %r14, %rdi
je 0x399a
callq 0x21f0
cmpq $0x0, -0x90(%rbp)
je 0x3dd6
cmpq $0x0, -0x70(%rbp)
je 0x3dd6
leaq -0x160(%rbp), %rdi
leaq -0x98(%rbp), %r14
movq %r14, %rsi
callq 0x69ea
leaq -0x158(%rbp), %rcx
cmpq %rcx, %rax
je 0x39ef
leaq -0x210(%rbp), %rdi
movq %r14, %rsi
callq 0x5f58
movq %r15, %r14
movl (%rax), %r12d
jmp 0x3a9b
movq -0x30(%rbp), %rcx
movl 0x60(%rcx), %r12d
leal 0x1(%r12), %eax
movl %eax, 0x60(%rcx)
leaq -0x160(%rbp), %rdi
movq %r14, %rsi
callq 0x6a88
movq %r15, -0x118(%rbp)
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x2c2e
movl %r12d, -0xf8(%rbp)
leaq -0x210(%rbp), %rdi
movq %r13, %rsi
callq 0x6c48
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x3a55
callq 0x21f0
movq %r13, %rdi
movq %r14, %rsi
movl %r12d, %edx
callq 0x7aa4
movq -0x30(%rbp), %rdi
movq %r13, %rsi
callq 0x5f20
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x3a87
callq 0x21f0
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x3a98
callq 0x21f0
movq %r15, %r14
leaq -0x160(%rbp), %rdi
movq %rbx, %rsi
callq 0x69ea
leaq -0x158(%rbp), %rcx
cmpq %rcx, %rax
je 0x3acd
leaq -0x210(%rbp), %rdi
movq %rbx, %rsi
callq 0x5f58
movl (%rax), %r15d
jmp 0x3b6f
movq -0x30(%rbp), %rcx
movl 0x60(%rcx), %r15d
leal 0x1(%r15), %eax
movl %eax, 0x60(%rcx)
leaq -0x160(%rbp), %rdi
movq %rbx, %rsi
callq 0x6a88
movq %r14, -0x118(%rbp)
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x2c2e
movl %r15d, -0xf8(%rbp)
leaq -0x210(%rbp), %rdi
movq %r13, %rsi
callq 0x6c48
movq -0x118(%rbp), %rdi
cmpq %r14, %rdi
je 0x3b2c
callq 0x21f0
movq %r13, %rdi
movq %rbx, %rsi
movl %r15d, %edx
callq 0x7aa4
movq -0x30(%rbp), %rdi
movq %r13, %rsi
callq 0x5f20
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x3b5e
callq 0x21f0
movq -0x118(%rbp), %rdi
cmpq %r14, %rdi
je 0x3b6f
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 0x2c2e
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 0x2c2e
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 0x2c2e
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 0x2c2e
xorps %xmm0, %xmm0
cvtsi2sdl -0x34(%rbp), %xmm0
leaq -0x230(%rbp), %rdi
movq -0x130(%rbp), %rbx
movl %ebx, %esi
movl %r14d, %edx
callq 0x7ca4
xorps %xmm0, %xmm0
cvtsi2sdl -0x34(%rbp), %xmm0
leaq -0x220(%rbp), %rdi
movl %r14d, %esi
movl %ebx, %edx
callq 0x7ca4
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 0x71ba
movq -0x120(%rbp), %rax
leaq (%rax,%rax,2), %r15
movq %r15, %rdi
shlq $0x4, %rdi
addq 0x18(%r12), %rdi
leaq -0x118(%rbp), %rsi
callq 0x71ba
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 0x3d8e
callq 0x21f0
movq -0x1e0(%rbp), %rdi
leaq -0x1d0(%rbp), %r14
cmpq %r14, %rdi
leaq -0x108(%rbp), %r15
je 0x3dad
callq 0x21f0
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x3dc5
callq 0x21f0
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x3dd6
callq 0x21f0
movq -0x438(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0x418(%rbp,%rax)
je 0x38a3
leaq -0x438(%rbp), %rdi
callq 0x2080
leaq -0x210(%rbp), %rdi
callq 0x6658
leaq -0x160(%rbp), %rdi
callq 0x66ec
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x3e25
callq 0x21f0
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
leaq -0x48(%rbp), %rbx
je 0x3e41
callq 0x21f0
movq -0x58(%rbp), %rdi
cmpq %rbx, %rdi
je 0x3e4f
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 0xb23c(%rip), %rdi      # 0xf0b0
leaq 0xb242(%rip), %rsi      # 0xf0bd
leaq 0xb26b(%rip), %rcx      # 0xf0ed
movl $0x69, %edx
callq 0x2150
movq %rax, %rbx
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
jne 0x3f18
jmp 0x3f41
jmp 0x3f3e
jmp 0x3ec5
jmp 0x3f3e
movq %rax, %rbx
movq -0x118(%rbp), %rdi
jmp 0x3f13
jmp 0x3f3e
jmp 0x3ec5
jmp 0x3f3e
jmp 0x3f3e
jmp 0x3f3e
movq %rax, %rbx
jmp 0x3f30
jmp 0x3f21
movq %rax, %rbx
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
jne 0x3f18
jmp 0x3f41
movq %rax, %rbx
movq -0x1e0(%rbp), %rdi
leaq -0x1d0(%rbp), %rax
cmpq %rax, %rdi
je 0x3f30
callq 0x21f0
jmp 0x3f30
jmp 0x3f3e
jmp 0x3f3e
jmp 0x3f09
jmp 0x3f3e
movq %rax, %rbx
movq -0x1e0(%rbp), %rdi
cmpq %r14, %rdi
je 0x3f41
callq 0x21f0
jmp 0x3f41
jmp 0x3f3e
movq %rax, %rbx
leaq -0x1e0(%rbp), %rdi
callq 0x2bc0
leaq -0x118(%rbp), %rdi
callq 0x2bc0
jmp 0x3f41
movq %rax, %rbx
leaq -0x48(%rbp), %r14
leaq -0x210(%rbp), %rdi
callq 0x6658
leaq -0x160(%rbp), %rdi
callq 0x66ec
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x3f6f
callq 0x21f0
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x3f87
callq 0x21f0
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
je 0x3f95
callq 0x21f0
leaq -0x438(%rbp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x2380
nop