// File: /workspace/github_cpp_makefile_star2_O2/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 $0x388, %rsp            # imm = 0x388
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x3a8(%rbp), %rdi
callq 0x2250
leaq -0x110(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
leaq -0x50(%rbp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %cl, (%rax)
movb %cl, (%rdx)
leaq -0x90(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq -0xf8(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq -0xc8(%rbp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq %r14, -0x38(%rbp)
movq %r14, %rdi
movl $0x186a0, %esi          # imm = 0x186A0
callq 0x2bcc
movq (%rbx), %rsi
leaq -0x3a8(%rbp), %rdi
pushq $0x8
popq %rdx
callq 0x2160
leaq -0x330(%rbp), %rdi
callq 0x2090
testb %al, %al
je 0x3133
leaq -0x60(%rbp), %rbx
leaq -0xa0(%rbp), %r15
leaq -0x1a0(%rbp), %r14
leaq -0x100(%rbp), %r13
movq -0x3a8(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0x388(%rbp,%rax)
jne 0x30d0
leaq -0x3a8(%rbp), %rdi
movq %rbx, %rsi
callq 0x2290
movq %rax, %rdi
movq %r15, %rsi
callq 0x2290
movq %rax, %rdi
leaq -0x3c(%rbp), %rsi
callq 0x2150
leaq -0x80(%rbp), %r12
movq %r12, %rdi
leaq 0x81e8(%rip), %rsi      # 0xb0a8
leaq -0x29(%rbp), %rdx
callq 0x20e0
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x7570
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2280
movq %r14, %rdi
callq 0x2110
movq %r12, %rdi
callq 0x2110
movq %r12, %rdi
leaq 0x81ac(%rip), %rsi      # 0xb0a8
leaq -0x29(%rbp), %rdx
callq 0x20e0
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x7570
movq %r15, %rdi
movq %r14, %rsi
callq 0x2280
movq %r14, %rdi
callq 0x2110
movq %r12, %rdi
callq 0x2110
cmpq $0x0, -0x58(%rbp)
je 0x2e73
cmpq $0x0, -0x98(%rbp)
je 0x2e73
movq %r13, %rdi
movq %rbx, %rsi
callq 0x57c6
leaq -0xf8(%rbp), %rcx
cmpq %rcx, %rax
je 0x2f72
leaq -0xd0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x4e76
movl (%rax), %ebx
jmp 0x2fd6
movq -0x38(%rbp), %rcx
movl 0x60(%rcx), %ebx
leal 0x1(%rbx), %eax
movl %eax, 0x60(%rcx)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
callq 0x5866
movq %r14, %rdi
leaq -0x60(%rbp), %rsi
callq 0x22b0
movl %ebx, -0x180(%rbp)
leaq -0xd0(%rbp), %rdi
movq %r14, %rsi
callq 0x5a80
movq %r14, %rdi
callq 0x2110
movq %r14, %rdi
leaq -0x60(%rbp), %rsi
movl %ebx, %edx
callq 0x6938
movq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x4e3a
movq %r14, %rdi
callq 0x2918
movq %r13, %r12
movq %r13, %rdi
movq %r15, %r13
movq %r15, %rsi
callq 0x57c6
leaq -0xf8(%rbp), %rcx
cmpq %rcx, %rax
je 0x3007
leaq -0xd0(%rbp), %rdi
movq %r13, %rsi
callq 0x4e76
movl (%rax), %r15d
jmp 0x306c
movq -0x38(%rbp), %rcx
movl 0x60(%rcx), %r15d
leal 0x1(%r15), %eax
movl %eax, 0x60(%rcx)
movq %r12, %rdi
movq %r13, %rsi
callq 0x5866
movq %r14, %rdi
movq %r13, %rsi
callq 0x22b0
movl %r15d, -0x180(%rbp)
leaq -0xd0(%rbp), %rdi
movq %r14, %rsi
callq 0x5a80
movq %r14, %rdi
callq 0x2110
movq %r14, %rdi
movq %r13, %rsi
movl %r15d, %edx
callq 0x6938
movq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x4e3a
movq %r14, %rdi
callq 0x2918
movq %r14, %rdi
movq %r13, %rsi
movl %r15d, %edx
callq 0x6938
cvtsi2sdl -0x3c(%rbp), %xmm0
leaq -0x80(%rbp), %rdi
movl %ebx, %esi
movl %r15d, %edx
callq 0x6b20
movslq %ebx, %rbx
imulq $0x30, %rbx, %rdi
movq -0x38(%rbp), %rax
addq 0x18(%rax), %rdi
movq %r14, %rsi
callq 0x5f28
imulq $0x18, %rbx, %rdi
movq -0x38(%rbp), %rax
addq 0x30(%rax), %rdi
leaq -0x80(%rbp), %rsi
callq 0x4ec6
movq %r14, %rdi
callq 0x2918
leaq -0x60(%rbp), %rbx
movq %r13, %r15
movq %r12, %r13
jmp 0x2e73
leaq -0x3a8(%rbp), %rdi
callq 0x2070
leaq -0xd0(%rbp), %rdi
callq 0x5426
leaq -0x100(%rbp), %rdi
callq 0x549e
leaq -0xa0(%rbp), %rdi
callq 0x2110
leaq -0x60(%rbp), %rdi
callq 0x2110
leaq -0x120(%rbp), %rdi
callq 0x2110
leaq -0x3a8(%rbp), %rdi
callq 0x20a0
addq $0x388, %rsp            # imm = 0x388
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7f36(%rip), %rdi      # 0xb070
leaq 0x7f3c(%rip), %rsi      # 0xb07d
leaq 0x7f3f(%rip), %rcx      # 0xb087
pushq $0x30
popq %rdx
callq 0x2170
jmp 0x3197
jmp 0x315c
jmp 0x3186
jmp 0x3197
jmp 0x3186
jmp 0x3197
movq %rax, %rbx
leaq -0x1a0(%rbp), %rdi
jmp 0x3179
jmp 0x3197
jmp 0x3197
jmp 0x3197
jmp 0x3172
jmp 0x3197
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x2110
jmp 0x319a
jmp 0x3197
jmp 0x3197
jmp 0x3197
movq %rax, %rbx
leaq -0x1a0(%rbp), %rdi
callq 0x2918
jmp 0x319a
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x5426
leaq -0x100(%rbp), %rdi
callq 0x549e
leaq -0xa0(%rbp), %rdi
callq 0x2110
leaq -0x60(%rbp), %rdi
callq 0x2110
leaq -0x120(%rbp), %rdi
callq 0x2110
leaq -0x3a8(%rbp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x2370
nop