// File: /workspace/github_cpp_makefile_star2_O2/jkeys-ecg-nmsu[P]graph-with-search-algorithms/Graph.cpp
// Function: Graph::scan_tmg(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void Graph::scan_tmg(const string & file) {	
	string tmg_start, tmg_version, tmg_simple;
	string num_nodes_s, num_edges_s;
	string waypoint, latitude_s, longitude_s;	
	int u_id, v_id, weight;
	double latitude, longitude;
    ifstream fs;
	
	int num_nodes, num_edges;
	
	fs.open(file.c_str()); assert(fs.is_open());
	
	/**** read in header data ****/
	
	fs >> tmg_start >> tmg_version >> tmg_simple >> num_nodes >> num_edges;
	
	assert(tmg_start == "TMG"); assert(tmg_version == "1.0"); assert(tmg_simple == "simple");	
		
	initEmpty(num_edges + 10); //twice num_edges because undirected
	
	/**** read in all nodes ****/
	
	cout << num_nodes << endl << num_edges << endl;	
	
	for (size_t i = 0; i != num_nodes; i++) {
		fs >> waypoint >> latitude >> longitude;
		// cout << waypoint << latitude_s << longitude_s << endl;
				 
		u_id = current_id;
		current_id++;			
			
		Node n(waypoint, u_id); 
		
		n.setLatitude(latitude);
		n.setLongitude(longitude);
		
		m_nodes.push_back(n);	
	} //end for
	
	
	/**** have read in all nodes, now read in all edges ****/
	
	string adjRoads;
	
	
	for (size_t i = 0; i != num_edges; i++) {
		fs >> u_id >> v_id >> adjRoads;
		
		Node u = m_nodes[u_id]; 
		Node v = m_nodes[v_id];
		
		double u_v_distance = calculateDistance(u, v);
				
		Edge u_v(u_id, v_id, u_v_distance);
		Edge v_u(v_id, u_id, u_v_distance); //undirected
		
		addEdge(u, v); addEdge(v, u);
		
		addEdgeObj(u, u_v); addEdgeObj(v, v_u);
		
		setEdgeRoads(m_nodes[u_id], adjRoads);
		setEdgeRoads(m_nodes[v_id], adjRoads);
	} //end for
	
	fs.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4b8, %rsp            # imm = 0x4B8
movq %rsi, %r14
movq %rdi, %rbx
leaq -0xc8(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
xorl %eax, %eax
movb %al, (%rcx)
leaq -0xa8(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
leaq -0x88(%rbp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rcx)
movb %al, (%rdx)
leaq -0x1c8(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
leaq -0x1a8(%rbp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rcx)
movb %al, (%rdx)
leaq -0x108(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
leaq -0x188(%rbp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %al, (%rcx)
movb %al, (%rdx)
leaq -0x168(%rbp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x460(%rbp), %rdi
callq 0x2250
movq (%r14), %rsi
leaq -0x460(%rbp), %rdi
pushq $0x8
popq %rdx
callq 0x2160
leaq -0x3e8(%rbp), %rdi
callq 0x2090
testb %al, %al
je 0x3b4e
leaq -0x460(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x2290
leaq -0xb8(%rbp), %rsi
movq %rax, %rdi
callq 0x2290
leaq -0x98(%rbp), %rsi
movq %rax, %rdi
callq 0x2290
leaq -0x38(%rbp), %rsi
movq %rax, %rdi
callq 0x2150
leaq -0x34(%rbp), %rsi
movq %rax, %rdi
callq 0x2150
leaq 0x78f2(%rip), %rsi      # 0xb0fe
leaq -0xd8(%rbp), %rdi
callq 0x4ed6
testb %al, %al
je 0x3b6d
leaq 0x78ee(%rip), %rsi      # 0xb115
leaq -0xb8(%rbp), %rdi
callq 0x4ed6
testb %al, %al
je 0x3b76
leaq 0x78ec(%rip), %rsi      # 0xb12e
leaq -0x98(%rbp), %rdi
callq 0x4ed6
testb %al, %al
je 0x3b7f
movl -0x34(%rbp), %esi
addl $0xa, %esi
movq %rbx, %rdi
callq 0x2bcc
movl -0x38(%rbp), %esi
movq 0xe762(%rip), %rdi      # 0x11fd0
callq 0x2360
movq %rax, %rdi
callq 0x2120
movl -0x34(%rbp), %esi
movq %rax, %rdi
callq 0x2360
movq %rax, %rdi
callq 0x2120
xorl %r12d, %r12d
leaq -0x118(%rbp), %r15
leaq -0x50(%rbp), %r13
leaq -0x258(%rbp), %r14
movslq -0x38(%rbp), %rax
cmpq %rax, %r12
je 0x391b
leaq -0x460(%rbp), %rdi
movq %r15, %rsi
callq 0x2290
movq %rax, %rdi
leaq -0x58(%rbp), %rsi
callq 0x2180
movq %rax, %rdi
movq %r13, %rsi
callq 0x2180
movl 0x60(%rbx), %edx
movl %edx, -0x2c(%rbp)
leal 0x1(%rdx), %eax
movl %eax, 0x60(%rbx)
movq %r14, %rdi
movq %r15, %rsi
callq 0x6938
movsd -0x58(%rbp), %xmm0
movq %r14, %rdi
callq 0x6aa0
movsd -0x50(%rbp), %xmm0
movq %r14, %rdi
callq 0x6a94
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4e3a
movq %r14, %rdi
callq 0x2918
incq %r12
jmp 0x38a3
movq %rbx, -0x40(%rbp)
leaq -0x68(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorl %r14d, %r14d
leaq -0x4e0(%rbp), %rbx
movslq -0x34(%rbp), %rax
cmpq %rax, %r14
je 0x3abb
leaq -0x460(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x2150
movq %rax, %rdi
leaq -0x30(%rbp), %rsi
callq 0x2150
movq %rax, %rdi
leaq -0x78(%rbp), %rsi
callq 0x2290
movslq -0x2c(%rbp), %rsi
shlq $0x7, %rsi
movq -0x40(%rbp), %r15
addq (%r15), %rsi
leaq -0x258(%rbp), %rdi
callq 0x28ba
movslq -0x30(%rbp), %rsi
shlq $0x7, %rsi
addq (%r15), %rsi
movq %rbx, %rdi
callq 0x28ba
leaq -0x258(%rbp), %rdi
movq %rbx, %rsi
callq 0x3c84
movl -0x2c(%rbp), %esi
movl -0x30(%rbp), %edx
leaq -0xf8(%rbp), %rdi
movsd %xmm0, -0x48(%rbp)
callq 0x6b20
movl -0x30(%rbp), %esi
movl -0x2c(%rbp), %edx
leaq -0xe8(%rbp), %rdi
movsd -0x48(%rbp), %xmm0
callq 0x6b20
movq -0x40(%rbp), %r15
movq %r15, %rdi
leaq -0x258(%rbp), %rsi
movq %rbx, %rdx
callq 0x3e22
movq %r15, %rdi
movq %rbx, %rsi
leaq -0x258(%rbp), %rdx
callq 0x3e22
movq %r15, %rdi
leaq -0x258(%rbp), %rsi
leaq -0xf8(%rbp), %rdx
callq 0x3e4e
movq %r15, %rdi
movq %rbx, %rsi
leaq -0xe8(%rbp), %rdx
callq 0x3e4e
movslq -0x2c(%rbp), %r13
movq (%r15), %r12
leaq -0x158(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x22b0
shlq $0x7, %r13
addq %r13, %r12
movq %r15, %rdi
movq %r12, %rsi
leaq -0x158(%rbp), %r12
movq %r12, %rdx
callq 0x3e7a
movq %r12, %rdi
callq 0x2110
movslq -0x30(%rbp), %r13
movq (%r15), %r12
leaq -0x138(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x22b0
shlq $0x7, %r13
addq %r13, %r12
movq %r15, %rdi
movq %r12, %rsi
leaq -0x138(%rbp), %r15
movq %r15, %rdx
callq 0x3e7a
movq %r15, %rdi
callq 0x2110
movq %rbx, %rdi
callq 0x2918
leaq -0x258(%rbp), %rdi
callq 0x2918
incq %r14
jmp 0x3939
leaq -0x460(%rbp), %rdi
callq 0x2070
leaq -0x78(%rbp), %rdi
callq 0x2110
leaq -0x460(%rbp), %rdi
callq 0x20a0
leaq -0x178(%rbp), %rdi
callq 0x2110
leaq -0x198(%rbp), %rdi
callq 0x2110
leaq -0x118(%rbp), %rdi
callq 0x2110
leaq -0x1b8(%rbp), %rdi
callq 0x2110
leaq -0x1d8(%rbp), %rdi
callq 0x2110
leaq -0x98(%rbp), %rdi
callq 0x2110
leaq -0xb8(%rbp), %rdi
callq 0x2110
leaq -0xd8(%rbp), %rdi
callq 0x2110
addq $0x4b8, %rsp            # imm = 0x4B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x751b(%rip), %rdi      # 0xb070
leaq 0x7521(%rip), %rsi      # 0xb07d
leaq 0x7576(%rip), %rcx      # 0xb0d9
movl $0xa7, %edx
callq 0x2170
leaq 0x758e(%rip), %rdi      # 0xb102
jmp 0x3b86
leaq 0x759c(%rip), %rdi      # 0xb119
jmp 0x3b86
leaq 0x75af(%rip), %rdi      # 0xb135
leaq 0x74f0(%rip), %rsi      # 0xb07d
leaq 0x7545(%rip), %rcx      # 0xb0d9
movl $0xad, %edx
callq 0x2170
jmp 0x3bd1
movq %rax, %rbx
jmp 0x3c1c
jmp 0x3be7
movq %rax, %rbx
jmp 0x3bfb
jmp 0x3bec
jmp 0x3bec
movq %rax, %rbx
leaq -0x138(%rbp), %rdi
jmp 0x3bc6
movq %rax, %rbx
leaq -0x158(%rbp), %rdi
callq 0x2110
jmp 0x3bef
jmp 0x3bd1
jmp 0x3be7
movq %rax, %rbx
jmp 0x3c07
movq %rax, %rbx
leaq -0x258(%rbp), %rdi
callq 0x2918
jmp 0x3c10
movq %rax, %rbx
jmp 0x3c10
movq %rax, %rbx
leaq -0x4e0(%rbp), %rdi
callq 0x2918
leaq -0x258(%rbp), %rdi
callq 0x2918
leaq -0x78(%rbp), %rdi
callq 0x2110
leaq -0x460(%rbp), %rdi
callq 0x20a0
leaq -0x178(%rbp), %rdi
callq 0x2110
leaq -0x198(%rbp), %rdi
callq 0x2110
leaq -0x118(%rbp), %rdi
callq 0x2110
leaq -0x1b8(%rbp), %rdi
callq 0x2110
leaq -0x1d8(%rbp), %rdi
callq 0x2110
leaq -0x98(%rbp), %rdi
callq 0x2110
leaq -0xb8(%rbp), %rdi
callq 0x2110
leaq -0xd8(%rbp), %rdi
callq 0x2110
movq %rbx, %rdi
callq 0x2370