// File: 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
subq $0x740, %rsp            # imm = 0x740
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x680(%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 -0x680(%rbp), %rdi
movl $0x186a0, %esi          # imm = 0x186A0
callq 0x3c30
jmp 0x4759
movq -0x10(%rbp), %rdi
callq 0x2100
movq %rax, %rsi
leaq -0x218(%rbp), %rdi
movl $0x8, %edx
callq 0x2180
jmp 0x4778
leaq -0x218(%rbp), %rdi
callq 0x2390
movb %al, -0x681(%rbp)
jmp 0x478c
movb -0x681(%rbp), %al
testb $0x1, %al
jne 0x4798
jmp 0x479a
jmp 0x47d0
leaq 0x158cf(%rip), %rdi     # 0x1a070
leaq 0x158d5(%rip), %rsi     # 0x1a07d
movl $0x69, %edx
leaq 0x158f9(%rip), %rcx     # 0x1a0ad
callq 0x2190
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2f0(%rbp)
movl %eax, -0x2f4(%rbp)
jmp 0x4fde
jmp 0x47d2
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x218(%rbp,%rax), %rdi
callq 0x2400
movb %al, -0x682(%rbp)
jmp 0x47f2
movb -0x682(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x4803
jmp 0x4f7f
leaq -0x218(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x22f0
movq %rax, -0x690(%rbp)
jmp 0x481f
movq -0x690(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x22f0
movq %rax, -0x698(%rbp)
jmp 0x483b
movq -0x698(%rbp), %rdi
leaq -0x284(%rbp), %rsi
callq 0x2160
jmp 0x4850
leaq -0x339(%rbp), %rdi
movq %rdi, -0x6a0(%rbp)
callq 0x23f0
movq -0x6a0(%rbp), %rdx
leaq 0x15837(%rip), %rsi     # 0x1a0a8
leaq -0x338(%rbp), %rdi
callq 0x2310
jmp 0x487f
leaq -0x318(%rbp), %rdi
leaq -0x258(%rbp), %rsi
leaq -0x338(%rbp), %rdx
callq 0x10ae0
jmp 0x489b
leaq -0x258(%rbp), %rdi
leaq -0x318(%rbp), %rsi
movq %rsi, -0x6b0(%rbp)
callq 0x22e0
movq -0x6b0(%rbp), %rdi
callq 0x2170
leaq -0x338(%rbp), %rdi
callq 0x2170
leaq -0x339(%rbp), %rdi
callq 0x2290
leaq -0x381(%rbp), %rdi
movq %rdi, -0x6a8(%rbp)
callq 0x23f0
movq -0x6a8(%rbp), %rdx
leaq 0x157ae(%rip), %rsi     # 0x1a0a8
leaq -0x380(%rbp), %rdi
callq 0x2310
jmp 0x4908
leaq -0x360(%rbp), %rdi
leaq -0x278(%rbp), %rsi
leaq -0x380(%rbp), %rdx
callq 0x10ae0
jmp 0x4924
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 0x4983
leaq -0x278(%rbp), %rdi
callq 0x21a0
cmpq $0x0, %rax
jne 0x4a0e
jmp 0x47d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2f0(%rbp)
movl %eax, -0x2f4(%rbp)
jmp 0x49ba
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 0x4fde
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2f0(%rbp)
movl %eax, -0x2f4(%rbp)
jmp 0x49fd
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 0x4fde
leaq -0x2b8(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x7750
movq %rax, -0x6b8(%rbp)
jmp 0x4a2a
movq -0x6b8(%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 0x4a67
jmp 0x4ba3
movq -0x680(%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, -0x6c1(%rbp)
movq %rax, -0x6c0(%rbp)
jmp 0x4aa1
movb -0x6c1(%rbp), %al
movq -0x6c0(%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 0x4ad7
leaq -0x2e8(%rbp), %rdi
leaq -0x3d0(%rbp), %rsi
callq 0x7840
movb %dl, -0x6d1(%rbp)
movq %rax, -0x6d0(%rbp)
jmp 0x4af9
movb -0x6d1(%rbp), %al
movq -0x6d0(%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 0x4b3a
movq -0x680(%rbp), %rdi
leaq -0x460(%rbp), %rsi
callq 0x78e0
jmp 0x4b4f
leaq -0x460(%rbp), %rdi
callq 0x2bd0
jmp 0x4bce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2f0(%rbp)
movl %eax, -0x2f4(%rbp)
leaq -0x3d0(%rbp), %rdi
callq 0x78c0
jmp 0x4fde
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2f0(%rbp)
movl %eax, -0x2f4(%rbp)
leaq -0x460(%rbp), %rdi
callq 0x2bd0
jmp 0x4fde
leaq -0x2e8(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x7950
movq %rax, -0x6e0(%rbp)
jmp 0x4bbf
movq -0x6e0(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x27c(%rbp)
leaq -0x2b8(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x7750
movq %rax, -0x6e8(%rbp)
jmp 0x4bea
movq -0x6e8(%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 0x4c27
jmp 0x4d63
movq -0x680(%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, -0x6f1(%rbp)
movq %rax, -0x6f0(%rbp)
jmp 0x4c61
movb -0x6f1(%rbp), %al
movq -0x6f0(%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 0x4c97
leaq -0x2e8(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x7840
movb %dl, -0x701(%rbp)
movq %rax, -0x700(%rbp)
jmp 0x4cb9
movb -0x701(%rbp), %al
movq -0x700(%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 0x4cfa
movq -0x680(%rbp), %rdi
leaq -0x538(%rbp), %rsi
callq 0x78e0
jmp 0x4d0f
leaq -0x538(%rbp), %rdi
callq 0x2bd0
jmp 0x4d8e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2f0(%rbp)
movl %eax, -0x2f4(%rbp)
leaq -0x4a8(%rbp), %rdi
callq 0x78c0
jmp 0x4fde
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2f0(%rbp)
movl %eax, -0x2f4(%rbp)
leaq -0x538(%rbp), %rdi
callq 0x2bd0
jmp 0x4fde
leaq -0x2e8(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x7950
movq %rax, -0x710(%rbp)
jmp 0x4d7f
movq -0x710(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x280(%rbp)
movq -0x680(%rbp), %rdi
movslq -0x27c(%rbp), %rsi
callq 0x5040
movq %rax, -0x718(%rbp)
jmp 0x4daa
movq -0x718(%rbp), %rsi
leaq -0x5b8(%rbp), %rdi
callq 0x2b50
jmp 0x4dbf
movq -0x680(%rbp), %rdi
movslq -0x280(%rbp), %rsi
callq 0x5040
movq %rax, -0x720(%rbp)
jmp 0x4ddb
movq -0x720(%rbp), %rsi
leaq -0x638(%rbp), %rdi
callq 0x2b50
jmp 0x4df0
movl -0x27c(%rbp), %esi
movl -0x280(%rbp), %edx
cvtsi2sdl -0x284(%rbp), %xmm0
leaq -0x648(%rbp), %rdi
callq 0xee90
jmp 0x4e12
movl -0x280(%rbp), %esi
movl -0x27c(%rbp), %edx
cvtsi2sdl -0x284(%rbp), %xmm0
leaq -0x658(%rbp), %rdi
callq 0xee90
jmp 0x4e34
movq -0x680(%rbp), %rdi
addq $0x18, %rdi
movslq -0x27c(%rbp), %rsi
callq 0x79f0
movq %rax, %rdi
leaq -0x638(%rbp), %rsi
callq 0x7a10
movb %dl, -0x729(%rbp)
movq %rax, -0x728(%rbp)
jmp 0x4e69
movq -0x680(%rbp), %rdi
movb -0x729(%rbp), %al
movq -0x728(%rbp), %rcx
movq %rcx, -0x668(%rbp)
movb %al, -0x660(%rbp)
addq $0x18, %rdi
movslq -0x280(%rbp), %rsi
callq 0x79f0
movq %rax, %rdi
leaq -0x5b8(%rbp), %rsi
callq 0x7a10
movb %dl, -0x739(%rbp)
movq %rax, -0x738(%rbp)
jmp 0x4eb8
movq -0x680(%rbp), %rdi
movb -0x739(%rbp), %al
movq -0x738(%rbp), %rcx
movq %rcx, -0x678(%rbp)
movb %al, -0x670(%rbp)
addq $0x30, %rdi
movslq -0x27c(%rbp), %rsi
callq 0x7a60
movq %rax, %rdi
leaq -0x648(%rbp), %rsi
callq 0x7a80
jmp 0x4efa
movq -0x680(%rbp), %rdi
addq $0x30, %rdi
movslq -0x280(%rbp), %rsi
callq 0x7a60
movq %rax, %rdi
leaq -0x658(%rbp), %rsi
callq 0x7a80
jmp 0x4f22
leaq -0x638(%rbp), %rdi
callq 0x2bd0
leaq -0x5b8(%rbp), %rdi
callq 0x2bd0
jmp 0x47d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2f0(%rbp)
movl %eax, -0x2f4(%rbp)
jmp 0x4f71
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2f0(%rbp)
movl %eax, -0x2f4(%rbp)
leaq -0x638(%rbp), %rdi
callq 0x2bd0
leaq -0x5b8(%rbp), %rdi
callq 0x2bd0
jmp 0x4fde
leaq -0x218(%rbp), %rdi
callq 0x2080
jmp 0x4f8d
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 $0x740, %rsp            # imm = 0x740
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)