// File: /workspace/github_cpp_makefile_star2_O3/jkeys-ecg-nmsu[P]graph-with-search-algorithms/Graph.cpp
// Function: Graph::scan(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void Graph::scan(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 child(v, v_id);	
		Edge edge(u_id, v_id, weight);
		
		m_adjList[u_id].insert(child);		
		m_edgeList[u_id].push_front(edge);
	} //end while		
	
	fs.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x378, %rsp            # imm = 0x378
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x3a0(%rbp), %rdi
callq 0x2260
leaq -0x158(%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 -0x140(%rbp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq -0x190(%rbp), %rcx
movl %eax, (%rcx)
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
movq %r14, -0x30(%rbp)
movq %r14, %rdi
movl $0x186a0, %esi          # imm = 0x186A0
callq 0x2faa
movq (%rbx), %rsi
leaq -0x3a0(%rbp), %rdi
movl $0x8, %edx
callq 0x2140
leaq -0x328(%rbp), %rdi
callq 0x20a0
testb %al, %al
je 0x36c6
movq -0x3a0(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0x380(%rbp,%rax)
jne 0x3642
leaq -0x108(%rbp), %r15
leaq -0x98(%rbp), %rsi
leaq -0x118(%rbp), %r14
leaq -0x3a0(%rbp), %rdi
movq %rsi, %r13
callq 0x22a0
movq %rax, %rdi
leaq -0x78(%rbp), %rsi
callq 0x22a0
movq %rax, %rdi
leaq -0x54(%rbp), %rsi
callq 0x2130
leaq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq -0x50(%rbp), %rbx
movq %rbx, %rdi
leaq 0xbdf6(%rip), %rsi      # 0xf0e8
leaq 0xbdf3(%rip), %rdx      # 0xf0ec
callq 0x2e98
movq %r14, %rdi
movq %r13, %r12
movq %r13, %rsi
movq %rbx, %rdx
callq 0x909c
movq %r12, %rdi
movq %r14, %rsi
callq 0x2290
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x332b
callq 0x21f0
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x333d
callq 0x21f0
leaq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq %rbx, %rdi
leaq 0xbd99(%rip), %rsi      # 0xf0e8
leaq 0xbd96(%rip), %rdx      # 0xf0ec
callq 0x2e98
movq %r14, %rdi
leaq -0x78(%rbp), %r12
movq %r12, %rsi
movq %rbx, %rdx
callq 0x909c
movq %r12, %rdi
movq %r14, %rsi
callq 0x2290
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x3389
callq 0x21f0
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x339b
callq 0x21f0
cmpq $0x0, -0x90(%rbp)
je 0x3626
cmpq $0x0, -0x70(%rbp)
je 0x3626
leaq -0x148(%rbp), %rdi
movq %r13, %rsi
callq 0x69ea
leaq -0x140(%rbp), %rcx
cmpq %rcx, %rax
je 0x33e5
leaq -0x198(%rbp), %rdi
movq %r13, %rsi
callq 0x5f58
movl (%rax), %ebx
jmp 0x3489
movq -0x30(%rbp), %rcx
movl 0x60(%rcx), %ebx
leal 0x1(%rbx), %eax
movl %eax, 0x60(%rcx)
leaq -0x148(%rbp), %rdi
movq %r13, %rsi
callq 0x6a88
movq %r15, -0x118(%rbp)
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x2c2e
movl %ebx, -0xf8(%rbp)
leaq -0x198(%rbp), %rdi
movq %r14, %rsi
callq 0x6c48
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x3447
callq 0x21f0
movq %r14, %rdi
movq %r13, %rsi
movl %ebx, %edx
callq 0x7aa4
movq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0x5f20
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x3478
callq 0x21f0
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x3489
callq 0x21f0
leaq -0x148(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x69ea
leaq -0x140(%rbp), %rcx
cmpq %rcx, %rax
je 0x34bd
leaq -0x198(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x5f58
movl (%rax), %r15d
jmp 0x3576
movq -0x30(%rbp), %rcx
movl 0x60(%rcx), %r15d
leal 0x1(%r15), %eax
movl %eax, 0x60(%rcx)
leaq -0x148(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x6a88
leaq -0x108(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x2c2e
movl %r15d, -0xf8(%rbp)
leaq -0x198(%rbp), %rdi
movq %r14, %rsi
callq 0x6c48
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x352b
callq 0x21f0
movq %r14, %rdi
leaq -0x78(%rbp), %rsi
movl %r15d, %edx
callq 0x7aa4
movq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0x5f20
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x355e
callq 0x21f0
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x3576
callq 0x21f0
leaq -0x118(%rbp), %rdi
leaq -0x78(%rbp), %rsi
movl %r15d, %edx
callq 0x7aa4
cvtsi2sdl -0x54(%rbp), %xmm0
leaq -0x50(%rbp), %rdi
movl %ebx, %esi
movl %r15d, %edx
callq 0x7ca4
movslq %ebx, %rax
leaq (%rax,%rax,2), %r15
movq %r15, %rdi
shlq $0x4, %rdi
movq -0x30(%rbp), %rax
addq 0x18(%rax), %rdi
leaq -0x118(%rbp), %rsi
callq 0x71ba
movq -0x30(%rbp), %rax
movq 0x30(%rax), %r14
movq (%r14,%r15,8), %rbx
movl $0x20, %edi
callq 0x2210
leaq (%r14,%r15,8), %r14
movups -0x50(%rbp), %xmm0
movups %xmm0, 0x10(%rax)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
incq 0x10(%r14)
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x3607
callq 0x21f0
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %r15
cmpq %r15, %rdi
je 0x361f
callq 0x21f0
leaq -0x118(%rbp), %r14
movq -0x3a0(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0x380(%rbp,%rax)
movq %r13, %rsi
je 0x32b5
leaq -0x3a0(%rbp), %rdi
callq 0x2080
leaq -0x198(%rbp), %rdi
callq 0x6658
leaq -0x148(%rbp), %rdi
callq 0x66ec
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x3678
callq 0x21f0
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x3690
callq 0x21f0
movq -0x168(%rbp), %rdi
leaq -0x158(%rbp), %rax
cmpq %rax, %rdi
je 0x36a8
callq 0x21f0
leaq -0x3a0(%rbp), %rdi
callq 0x20b0
addq $0x378, %rsp            # imm = 0x378
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb9e3(%rip), %rdi      # 0xf0b0
leaq 0xb9e9(%rip), %rsi      # 0xf0bd
leaq 0xb9ec(%rip), %rcx      # 0xf0c7
movl $0x30, %edx
callq 0x2150
jmp 0x374b
jmp 0x373a
jmp 0x374b
movq %rax, %rbx
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
jmp 0x372c
jmp 0x374b
jmp 0x373a
jmp 0x374b
movq %rax, %rbx
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
jne 0x3731
jmp 0x374e
jmp 0x374b
jmp 0x374b
jmp 0x374b
jmp 0x374b
jmp 0x3721
jmp 0x374b
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x374e
callq 0x21f0
jmp 0x374e
jmp 0x374b
movq %rax, %rbx
leaq -0x118(%rbp), %rdi
callq 0x2bc0
jmp 0x374e
movq %rax, %rbx
leaq -0x198(%rbp), %rdi
callq 0x6658
leaq -0x148(%rbp), %rdi
callq 0x66ec
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x3778
callq 0x21f0
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x3790
callq 0x21f0
movq -0x168(%rbp), %rdi
leaq -0x158(%rbp), %rax
cmpq %rax, %rdi
je 0x37a8
callq 0x21f0
leaq -0x3a0(%rbp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x2380