// File: /workspace/github_cpp_makefile_star2_O1/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 0x2f62
movq (%rbx), %rsi
leaq -0x3a0(%rbp), %rdi
movl $0x8, %edx
callq 0x2140
leaq -0x328(%rbp), %rdi
callq 0x20a0
testb %al, %al
je 0x3688
movq -0x3a0(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0x380(%rbp,%rax)
jne 0x3604
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 0xbe34(%rip), %rsi      # 0xf0e8
leaq 0xbe31(%rip), %rdx      # 0xf0ec
callq 0x2e54
movq %r14, %rdi
movq %r13, %r12
movq %r13, %rsi
movq %rbx, %rdx
callq 0x9050
movq %r12, %rdi
movq %r14, %rsi
callq 0x2290
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x32ed
callq 0x21f0
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x32ff
callq 0x21f0
leaq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movq %rbx, %rdi
leaq 0xbdd7(%rip), %rsi      # 0xf0e8
leaq 0xbdd4(%rip), %rdx      # 0xf0ec
callq 0x2e54
movq %r14, %rdi
leaq -0x78(%rbp), %r12
movq %r12, %rsi
movq %rbx, %rdx
callq 0x9050
movq %r12, %rdi
movq %r14, %rsi
callq 0x2290
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x334b
callq 0x21f0
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x335d
callq 0x21f0
cmpq $0x0, -0x90(%rbp)
je 0x35e8
cmpq $0x0, -0x70(%rbp)
je 0x35e8
leaq -0x148(%rbp), %rdi
movq %r13, %rsi
callq 0x6944
leaq -0x140(%rbp), %rcx
cmpq %rcx, %rax
je 0x33a7
leaq -0x198(%rbp), %rdi
movq %r13, %rsi
callq 0x5f0c
movl (%rax), %ebx
jmp 0x344b
movq -0x30(%rbp), %rcx
movl 0x60(%rcx), %ebx
leal 0x1(%rbx), %eax
movl %eax, 0x60(%rcx)
leaq -0x148(%rbp), %rdi
movq %r13, %rsi
callq 0x69e2
movq %r15, -0x118(%rbp)
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x2bfe
movl %ebx, -0xf8(%rbp)
leaq -0x198(%rbp), %rdi
movq %r14, %rsi
callq 0x6bac
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x3409
callq 0x21f0
movq %r14, %rdi
movq %r13, %rsi
movl %ebx, %edx
callq 0x7a24
movq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0x5ed4
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x343a
callq 0x21f0
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x344b
callq 0x21f0
leaq -0x148(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x6944
leaq -0x140(%rbp), %rcx
cmpq %rcx, %rax
je 0x347f
leaq -0x198(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x5f0c
movl (%rax), %r15d
jmp 0x3538
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 0x69e2
leaq -0x108(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x2bfe
movl %r15d, -0xf8(%rbp)
leaq -0x198(%rbp), %rdi
movq %r14, %rsi
callq 0x6bac
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x34ed
callq 0x21f0
movq %r14, %rdi
leaq -0x78(%rbp), %rsi
movl %r15d, %edx
callq 0x7a24
movq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0x5ed4
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x3520
callq 0x21f0
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x3538
callq 0x21f0
leaq -0x118(%rbp), %rdi
leaq -0x78(%rbp), %rsi
movl %r15d, %edx
callq 0x7a24
cvtsi2sdl -0x54(%rbp), %xmm0
leaq -0x50(%rbp), %rdi
movl %ebx, %esi
movl %r15d, %edx
callq 0x7c24
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 0x7128
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 0x35c9
callq 0x21f0
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %r15
cmpq %r15, %rdi
je 0x35e1
callq 0x21f0
leaq -0x118(%rbp), %r14
movq -0x3a0(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0x380(%rbp,%rax)
movq %r13, %rsi
je 0x3277
leaq -0x3a0(%rbp), %rdi
callq 0x2080
leaq -0x198(%rbp), %rdi
callq 0x65b2
leaq -0x148(%rbp), %rdi
callq 0x6646
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x363a
callq 0x21f0
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x3652
callq 0x21f0
movq -0x168(%rbp), %rdi
leaq -0x158(%rbp), %rax
cmpq %rax, %rdi
je 0x366a
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 0xba21(%rip), %rdi      # 0xf0b0
leaq 0xba27(%rip), %rsi      # 0xf0bd
leaq 0xba2a(%rip), %rcx      # 0xf0c7
movl $0x30, %edx
callq 0x2150
jmp 0x370d
jmp 0x36fc
jmp 0x370d
movq %rax, %rbx
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
jmp 0x36ee
jmp 0x370d
jmp 0x36fc
jmp 0x370d
movq %rax, %rbx
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
jne 0x36f3
jmp 0x3710
jmp 0x370d
jmp 0x370d
jmp 0x370d
jmp 0x370d
jmp 0x36e3
jmp 0x370d
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x3710
callq 0x21f0
jmp 0x3710
jmp 0x370d
movq %rax, %rbx
leaq -0x118(%rbp), %rdi
callq 0x2b90
jmp 0x3710
movq %rax, %rbx
leaq -0x198(%rbp), %rdi
callq 0x65b2
leaq -0x148(%rbp), %rdi
callq 0x6646
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x373a
callq 0x21f0
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x3752
callq 0x21f0
movq -0x168(%rbp), %rdi
leaq -0x158(%rbp), %rax
cmpq %rax, %rdi
je 0x376a
callq 0x21f0
leaq -0x3a0(%rbp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x2380