// File: 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
subq $0x680, %rsp            # imm = 0x680
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x5e0(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x22b0
leaq -0x238(%rbp), %rdi
callq 0x2320
leaq -0x258(%rbp), %rdi
callq 0x2320
leaq -0x278(%rbp), %rdi
callq 0x2320
leaq -0x2b8(%rbp), %rdi
callq 0x7710
leaq -0x2e8(%rbp), %rdi
callq 0x7730
movq -0x5e0(%rbp), %rdi
movl $0x186a0, %esi          # imm = 0x186A0
callq 0x3c30
jmp 0x3f09
movq -0x10(%rbp), %rdi
callq 0x2100
movq %rax, %rsi
leaq -0x218(%rbp), %rdi
movl $0x8, %edx
callq 0x2180
jmp 0x3f28
leaq -0x218(%rbp), %rdi
callq 0x2390
movb %al, -0x5e1(%rbp)
jmp 0x3f3c
movb -0x5e1(%rbp), %al
testb $0x1, %al
jne 0x3f48
jmp 0x3f4a
jmp 0x3f80
leaq 0x1611f(%rip), %rdi     # 0x1a070
leaq 0x16125(%rip), %rsi     # 0x1a07d
movl $0x30, %edx
leaq 0x16123(%rip), %rcx     # 0x1a087
callq 0x2190
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2f0(%rbp)
movl %eax, -0x2f4(%rbp)
jmp 0x4682
jmp 0x3f82
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x218(%rbp,%rax), %rdi
callq 0x2400
movb %al, -0x5e2(%rbp)
jmp 0x3fa2
movb -0x5e2(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3fb3
jmp 0x4623
leaq -0x218(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x22f0
movq %rax, -0x5f0(%rbp)
jmp 0x3fcf
movq -0x5f0(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x22f0
movq %rax, -0x5f8(%rbp)
jmp 0x3feb
movq -0x5f8(%rbp), %rdi
leaq -0x284(%rbp), %rsi
callq 0x2160
jmp 0x4000
leaq -0x339(%rbp), %rdi
movq %rdi, -0x600(%rbp)
callq 0x23f0
movq -0x600(%rbp), %rdx
leaq 0x16087(%rip), %rsi     # 0x1a0a8
leaq -0x338(%rbp), %rdi
callq 0x2310
jmp 0x402f
leaq -0x318(%rbp), %rdi
leaq -0x258(%rbp), %rsi
leaq -0x338(%rbp), %rdx
callq 0x10ae0
jmp 0x404b
leaq -0x258(%rbp), %rdi
leaq -0x318(%rbp), %rsi
movq %rsi, -0x610(%rbp)
callq 0x22e0
movq -0x610(%rbp), %rdi
callq 0x2170
leaq -0x338(%rbp), %rdi
callq 0x2170
leaq -0x339(%rbp), %rdi
callq 0x2290
leaq -0x381(%rbp), %rdi
movq %rdi, -0x608(%rbp)
callq 0x23f0
movq -0x608(%rbp), %rdx
leaq 0x15ffe(%rip), %rsi     # 0x1a0a8
leaq -0x380(%rbp), %rdi
callq 0x2310
jmp 0x40b8
leaq -0x360(%rbp), %rdi
leaq -0x278(%rbp), %rsi
leaq -0x380(%rbp), %rdx
callq 0x10ae0
jmp 0x40d4
leaq -0x278(%rbp), %rdi
leaq -0x360(%rbp), %rsi
callq 0x22e0
leaq -0x360(%rbp), %rdi
callq 0x2170
leaq -0x380(%rbp), %rdi
callq 0x2170
leaq -0x381(%rbp), %rdi
callq 0x2290
leaq -0x258(%rbp), %rdi
callq 0x21a0
cmpq $0x0, %rax
je 0x4133
leaq -0x278(%rbp), %rdi
callq 0x21a0
cmpq $0x0, %rax
jne 0x41be
jmp 0x3f82
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2f0(%rbp)
movl %eax, -0x2f4(%rbp)
jmp 0x416a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2f0(%rbp)
movl %eax, -0x2f4(%rbp)
leaq -0x338(%rbp), %rdi
callq 0x2170
leaq -0x339(%rbp), %rdi
callq 0x2290
jmp 0x4682
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2f0(%rbp)
movl %eax, -0x2f4(%rbp)
jmp 0x41ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2f0(%rbp)
movl %eax, -0x2f4(%rbp)
leaq -0x380(%rbp), %rdi
callq 0x2170
leaq -0x381(%rbp), %rdi
callq 0x2290
jmp 0x4682
leaq -0x2b8(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x7750
movq %rax, -0x618(%rbp)
jmp 0x41da
movq -0x618(%rbp), %rax
movq %rax, -0x390(%rbp)
leaq -0x2b8(%rbp), %rdi
callq 0x77c0
movq %rax, -0x398(%rbp)
leaq -0x390(%rbp), %rdi
leaq -0x398(%rbp), %rsi
callq 0x7790
testb $0x1, %al
jne 0x4217
jmp 0x4353
movq -0x5e0(%rbp), %rax
movl 0x60(%rax), %ecx
movl %ecx, -0x27c(%rbp)
movl 0x60(%rax), %ecx
incl %ecx
movl %ecx, 0x60(%rax)
leaq -0x2b8(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x77f0
movb %dl, -0x621(%rbp)
movq %rax, -0x620(%rbp)
jmp 0x4251
movb -0x621(%rbp), %al
movq -0x620(%rbp), %rcx
movq %rcx, -0x3a8(%rbp)
movb %al, -0x3a0(%rbp)
leaq -0x3d0(%rbp), %rdi
leaq -0x258(%rbp), %rsi
leaq -0x27c(%rbp), %rdx
callq 0x7880
jmp 0x4287
leaq -0x2e8(%rbp), %rdi
leaq -0x3d0(%rbp), %rsi
callq 0x7840
movb %dl, -0x631(%rbp)
movq %rax, -0x630(%rbp)
jmp 0x42a9
movb -0x631(%rbp), %al
movq -0x630(%rbp), %rcx
movq %rcx, -0x3e0(%rbp)
movb %al, -0x3d8(%rbp)
leaq -0x3d0(%rbp), %rdi
callq 0x78c0
movl -0x27c(%rbp), %edx
leaq -0x460(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0xea90
jmp 0x42ea
movq -0x5e0(%rbp), %rdi
leaq -0x460(%rbp), %rsi
callq 0x78e0
jmp 0x42ff
leaq -0x460(%rbp), %rdi
callq 0x2bd0
jmp 0x437e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2f0(%rbp)
movl %eax, -0x2f4(%rbp)
leaq -0x3d0(%rbp), %rdi
callq 0x78c0
jmp 0x4682
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2f0(%rbp)
movl %eax, -0x2f4(%rbp)
leaq -0x460(%rbp), %rdi
callq 0x2bd0
jmp 0x4682
leaq -0x2e8(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x7950
movq %rax, -0x640(%rbp)
jmp 0x436f
movq -0x640(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x27c(%rbp)
leaq -0x2b8(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x7750
movq %rax, -0x648(%rbp)
jmp 0x439a
movq -0x648(%rbp), %rax
movq %rax, -0x468(%rbp)
leaq -0x2b8(%rbp), %rdi
callq 0x77c0
movq %rax, -0x470(%rbp)
leaq -0x468(%rbp), %rdi
leaq -0x470(%rbp), %rsi
callq 0x7790
testb $0x1, %al
jne 0x43d7
jmp 0x4513
movq -0x5e0(%rbp), %rax
movl 0x60(%rax), %ecx
movl %ecx, -0x280(%rbp)
movl 0x60(%rax), %ecx
incl %ecx
movl %ecx, 0x60(%rax)
leaq -0x2b8(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x77f0
movb %dl, -0x651(%rbp)
movq %rax, -0x650(%rbp)
jmp 0x4411
movb -0x651(%rbp), %al
movq -0x650(%rbp), %rcx
movq %rcx, -0x480(%rbp)
movb %al, -0x478(%rbp)
leaq -0x4a8(%rbp), %rdi
leaq -0x278(%rbp), %rsi
leaq -0x280(%rbp), %rdx
callq 0x7880
jmp 0x4447
leaq -0x2e8(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x7840
movb %dl, -0x661(%rbp)
movq %rax, -0x660(%rbp)
jmp 0x4469
movb -0x661(%rbp), %al
movq -0x660(%rbp), %rcx
movq %rcx, -0x4b8(%rbp)
movb %al, -0x4b0(%rbp)
leaq -0x4a8(%rbp), %rdi
callq 0x78c0
movl -0x280(%rbp), %edx
leaq -0x538(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0xea90
jmp 0x44aa
movq -0x5e0(%rbp), %rdi
leaq -0x538(%rbp), %rsi
callq 0x78e0
jmp 0x44bf
leaq -0x538(%rbp), %rdi
callq 0x2bd0
jmp 0x453e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2f0(%rbp)
movl %eax, -0x2f4(%rbp)
leaq -0x4a8(%rbp), %rdi
callq 0x78c0
jmp 0x4682
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2f0(%rbp)
movl %eax, -0x2f4(%rbp)
leaq -0x538(%rbp), %rdi
callq 0x2bd0
jmp 0x4682
leaq -0x2e8(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x7950
movq %rax, -0x670(%rbp)
jmp 0x452f
movq -0x670(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x280(%rbp)
movl -0x280(%rbp), %edx
leaq -0x5b8(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0xea90
jmp 0x4559
movl -0x27c(%rbp), %esi
movl -0x280(%rbp), %edx
cvtsi2sdl -0x284(%rbp), %xmm0
leaq -0x5c8(%rbp), %rdi
callq 0xee90
jmp 0x457b
movq -0x5e0(%rbp), %rdi
addq $0x18, %rdi
movslq -0x27c(%rbp), %rsi
callq 0x79f0
movq %rax, %rdi
leaq -0x5b8(%rbp), %rsi
callq 0x7a10
movb %dl, -0x679(%rbp)
movq %rax, -0x678(%rbp)
jmp 0x45b0
movq -0x5e0(%rbp), %rdi
movb -0x679(%rbp), %al
movq -0x678(%rbp), %rcx
movq %rcx, -0x5d8(%rbp)
movb %al, -0x5d0(%rbp)
addq $0x30, %rdi
movslq -0x27c(%rbp), %rsi
callq 0x7a60
movq %rax, %rdi
leaq -0x5c8(%rbp), %rsi
callq 0x7a80
jmp 0x45f2
leaq -0x5b8(%rbp), %rdi
callq 0x2bd0
jmp 0x3f82
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2f0(%rbp)
movl %eax, -0x2f4(%rbp)
leaq -0x5b8(%rbp), %rdi
callq 0x2bd0
jmp 0x4682
leaq -0x218(%rbp), %rdi
callq 0x2080
jmp 0x4631
leaq -0x2e8(%rbp), %rdi
callq 0x7ac0
leaq -0x2b8(%rbp), %rdi
callq 0x7ae0
leaq -0x278(%rbp), %rdi
callq 0x2170
leaq -0x258(%rbp), %rdi
callq 0x2170
leaq -0x238(%rbp), %rdi
callq 0x2170
leaq -0x218(%rbp), %rdi
callq 0x20b0
addq $0x680, %rsp            # imm = 0x680
popq %rbp
retq
leaq -0x2e8(%rbp), %rdi
callq 0x7ac0
leaq -0x2b8(%rbp), %rdi
callq 0x7ae0
leaq -0x278(%rbp), %rdi
callq 0x2170
leaq -0x258(%rbp), %rdi
callq 0x2170
leaq -0x238(%rbp), %rdi
callq 0x2170
leaq -0x218(%rbp), %rdi
callq 0x20b0
movq -0x2f0(%rbp), %rdi
callq 0x23e0
nopw %cs:(%rax,%rax)