// File: flastest[P]HeterogeneousParallelDijkstra/BBO_graph_creator.cc
// Function: cit_graph_from_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool)
graph_t cit_graph_from_file(std::string name, bool truncate_early)
{
	int counter = 1000;

	std::ifstream infile(name);

	int biggest_player_id = 0;

	std::vector<Edge> edge_vec;

	std::vector<int> weight_vec;

	std::string node_a, node_b;

	std::string input;

	while (std::getline(infile,input))// >> ", 0," >>team_a>>", 0,">>team_b>>", 0")
	{
		//check to make sure still within counter
		if (truncate_early && counter <= 0)
		{
			break;
		}
		counter--;

		if (input.substr(0,1) != "#")
		{
			std::string node_a = input.substr(0,input.find(" "));
			std::string node_b = input.substr(input.find(" ") +1);
			
			if(DEBUG_LOGS)
			{
				std::cout<<"node a is "<<node_a<<std::endl;
				std::cout<<"node b is "<<node_b<<std::endl;
			}

			//for each teammmate in team_a, we need to add an edge from that teammate to every member in team_b

			int start = std::stoi(node_a);
			int end = std::stoi(node_b);

			weight_vec.push_back(1);
			edge_vec.push_back(Edge(start,end));


		}

	}


	//evidence that IDK how to use arrays
	Edge edge_array[edge_vec.size()]; 

	for (uint32_t i = 0; i < edge_vec.size(); i++)
	{
		edge_array[i] = edge_vec[i];
	}

	int weights[weight_vec.size()]; 

	for (uint32_t i = 0; i < weight_vec.size(); i++)
	{
		weights[i] = 1;
	}	


	int num_arcs = sizeof(edge_array) / sizeof(Edge);

	int num_nodes = biggest_player_id;

	graph_t g(edge_array, edge_array + num_arcs, weights, num_nodes);

	return g;


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x410, %rsp            # imm = 0x410
movq %rdi, -0x380(%rbp)
movb %dl, %al
movq %rdi, %rcx
movq %rcx, -0x378(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
movl $0x3e8, -0x18(%rbp)     # imm = 0x3E8
leaq -0x220(%rbp), %rdi
movl $0x8, %edx
callq 0x44a0
movl $0x0, -0x224(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x27600
leaq -0x258(%rbp), %rdi
callq 0x27530
leaq -0x278(%rbp), %rdi
callq 0x4410
leaq -0x298(%rbp), %rdi
callq 0x4410
leaq -0x2b8(%rbp), %rdi
callq 0x4410
leaq -0x220(%rbp), %rdi
leaq -0x2b8(%rbp), %rsi
callq 0x40a0
movq %rax, -0x388(%rbp)
jmp 0x26f45
movq -0x388(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x43f0
movb %al, -0x389(%rbp)
jmp 0x26f63
movb -0x389(%rbp), %al
testb $0x1, %al
jne 0x26f72
jmp 0x27252
testb $0x1, -0x11(%rbp)
je 0x26f9a
cmpl $0x0, -0x18(%rbp)
jg 0x26f9a
jmp 0x27252
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2c0(%rbp)
movl %eax, -0x2c4(%rbp)
jmp 0x274d9
movl -0x18(%rbp), %eax
decl %eax
movl %eax, -0x18(%rbp)
xorl %eax, %eax
movl %eax, %edx
leaq -0x2e8(%rbp), %rdi
leaq -0x2b8(%rbp), %rsi
movl $0x1, %ecx
callq 0x4350
jmp 0x26fc0
leaq 0x3eac(%rip), %rsi      # 0x2ae73
leaq -0x2e8(%rbp), %rdi
callq 0x27620
movb %al, -0x38a(%rbp)
jmp 0x26fdb
leaq -0x2e8(%rbp), %rdi
callq 0x41e0
movb -0x38a(%rbp), %al
testb $0x1, %al
jne 0x26ff6
jmp 0x2724d
leaq 0x388a(%rip), %rsi      # 0x2a887
xorl %eax, %eax
movl %eax, %edx
movq %rdx, -0x398(%rbp)
leaq -0x2b8(%rbp), %rdi
movq %rdi, -0x3a0(%rbp)
callq 0x45a0
movq -0x3a0(%rbp), %rsi
movq -0x398(%rbp), %rdx
movq %rax, %rcx
leaq -0x308(%rbp), %rdi
callq 0x4350
jmp 0x2703a
leaq 0x3846(%rip), %rsi      # 0x2a887
xorl %eax, %eax
movl %eax, %edx
leaq -0x2b8(%rbp), %rdi
movq %rdi, -0x3a8(%rbp)
callq 0x45a0
movq -0x3a8(%rbp), %rsi
movq %rax, %rdx
incq %rdx
leaq -0x328(%rbp), %rdi
movq $-0x1, %rcx
callq 0x4350
jmp 0x2707a
testb $0x1, 0x1751a(%rip)     # 0x3e59b
je 0x27180
movq 0x16f3a(%rip), %rdi     # 0x3dfc8
leaq 0x3e07(%rip), %rsi      # 0x2ae9c
callq 0x4310
movq %rax, -0x3b0(%rbp)
jmp 0x270a3
movq -0x3b0(%rbp), %rdi
leaq -0x308(%rbp), %rsi
callq 0x42f0
movq %rax, -0x3b8(%rbp)
jmp 0x270bf
movq -0x3b8(%rbp), %rdi
movq 0x16ecb(%rip), %rsi     # 0x3df98
callq 0x4370
jmp 0x270d4
movq 0x16eed(%rip), %rdi     # 0x3dfc8
leaq 0x3dc5(%rip), %rsi      # 0x2aea7
callq 0x4310
movq %rax, -0x3c0(%rbp)
jmp 0x270f0
movq -0x3c0(%rbp), %rdi
leaq -0x328(%rbp), %rsi
callq 0x42f0
movq %rax, -0x3c8(%rbp)
jmp 0x2710c
movq -0x3c8(%rbp), %rdi
movq 0x16e7e(%rip), %rsi     # 0x3df98
callq 0x4370
jmp 0x27121
jmp 0x27180
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2c0(%rbp)
movl %eax, -0x2c4(%rbp)
leaq -0x2e8(%rbp), %rdi
callq 0x41e0
jmp 0x274d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2c0(%rbp)
movl %eax, -0x2c4(%rbp)
jmp 0x2723c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2c0(%rbp)
movl %eax, -0x2c4(%rbp)
leaq -0x328(%rbp), %rdi
callq 0x41e0
jmp 0x2723c
xorl %eax, %eax
movl %eax, %esi
leaq -0x308(%rbp), %rdi
movl $0xa, %edx
callq 0x27550
movl %eax, -0x3cc(%rbp)
jmp 0x2719d
movl -0x3cc(%rbp), %eax
movl %eax, -0x32c(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x328(%rbp), %rdi
movl $0xa, %edx
callq 0x27550
movl %eax, -0x3d0(%rbp)
jmp 0x271c6
movl -0x3d0(%rbp), %eax
movl %eax, -0x330(%rbp)
movl $0x1, -0x334(%rbp)
leaq -0x258(%rbp), %rdi
leaq -0x334(%rbp), %rsi
callq 0x27720
jmp 0x271f1
leaq -0x33c(%rbp), %rdi
leaq -0x32c(%rbp), %rsi
leaq -0x330(%rbp), %rdx
callq 0x276f0
jmp 0x2720d
leaq -0x240(%rbp), %rdi
leaq -0x33c(%rbp), %rsi
callq 0x276c0
jmp 0x27222
leaq -0x328(%rbp), %rdi
callq 0x41e0
leaq -0x308(%rbp), %rdi
callq 0x41e0
jmp 0x2724d
leaq -0x308(%rbp), %rdi
callq 0x41e0
jmp 0x274d9
jmp 0x26f29
leaq -0x240(%rbp), %rdi
callq 0x27770
movq %rax, %rcx
movq %rcx, %rax
movq %rax, -0x3e0(%rbp)
movq %rsp, %rdx
movq %rdx, -0x348(%rbp)
leaq 0xf(,%rcx,8), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x3d8(%rbp)
movq %rcx, %rsp
movq %rax, -0x350(%rbp)
cmpq $0x0, %rax
je 0x272f7
movq -0x3d8(%rbp), %rax
movq -0x3e0(%rbp), %rdx
shlq $0x3, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0x3f0(%rbp)
movq %rax, -0x3e8(%rbp)
movq -0x3e8(%rbp), %rdi
movq %rdi, -0x3f8(%rbp)
callq 0x27790
jmp 0x272d9
movq -0x3f0(%rbp), %rcx
movq -0x3f8(%rbp), %rax
addq $0x8, %rax
cmpq %rcx, %rax
movq %rax, -0x3e8(%rbp)
jne 0x272c4
movl $0x0, -0x354(%rbp)
movl -0x354(%rbp), %eax
movq %rax, -0x400(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x27770
movq %rax, %rcx
movq -0x400(%rbp), %rax
cmpq %rcx, %rax
jae 0x2736b
movl -0x354(%rbp), %eax
movl %eax, %esi
leaq -0x240(%rbp), %rdi
callq 0x277b0
movq %rax, %rsi
movq -0x3d8(%rbp), %rax
movl -0x354(%rbp), %ecx
leaq (%rax,%rcx,8), %rdi
callq 0x277d0
jmp 0x27358
jmp 0x2735a
movl -0x354(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x354(%rbp)
jmp 0x27301
leaq -0x258(%rbp), %rdi
callq 0x19aa0
movq %rax, %rcx
movq %rcx, %rax
leaq 0xf(,%rcx,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x408(%rbp)
movq %rcx, %rsp
movq %rax, -0x360(%rbp)
movl $0x0, -0x364(%rbp)
movl -0x364(%rbp), %eax
movq %rax, -0x410(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x19aa0
movq %rax, %rcx
movq -0x410(%rbp), %rax
cmpq %rcx, %rax
jae 0x273f7
movq -0x408(%rbp), %rax
movl -0x364(%rbp), %ecx
movl $0x1, (%rax,%rcx,4)
movl -0x364(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x364(%rbp)
jmp 0x273aa
movq -0x408(%rbp), %rcx
movq -0x3d8(%rbp), %rsi
movq -0x380(%rbp), %rdi
movq -0x3e0(%rbp), %rax
movl %eax, -0x368(%rbp)
movl -0x224(%rbp), %eax
movl %eax, -0x36c(%rbp)
movb $0x0, -0x36d(%rbp)
movslq -0x368(%rbp), %rax
leaq (%rsi,%rax,8), %rdx
movslq -0x36c(%rbp), %r8
subq $0x10, %rsp
movq %rsp, %rax
leaq -0x36e(%rbp), %r9
movq %r9, (%rax)
xorl %eax, %eax
movl %eax, %r9d
callq 0xb180
addq $0x10, %rsp
jmp 0x2745f
movb $0x1, -0x36d(%rbp)
testb $0x1, -0x36d(%rbp)
jne 0x2747b
movq -0x380(%rbp), %rdi
callq 0xb380
movq -0x348(%rbp), %rax
movq %rax, %rsp
leaq -0x2b8(%rbp), %rdi
callq 0x41e0
leaq -0x298(%rbp), %rdi
callq 0x41e0
leaq -0x278(%rbp), %rdi
callq 0x41e0
leaq -0x258(%rbp), %rdi
callq 0xb120
leaq -0x240(%rbp), %rdi
callq 0x27800
leaq -0x220(%rbp), %rdi
callq 0x40d0
movq -0x378(%rbp), %rax
movq %rbp, %rsp
popq %rbp
retq
leaq -0x2b8(%rbp), %rdi
callq 0x41e0
leaq -0x298(%rbp), %rdi
callq 0x41e0
leaq -0x278(%rbp), %rdi
callq 0x41e0
leaq -0x258(%rbp), %rdi
callq 0xb120
leaq -0x240(%rbp), %rdi
callq 0x27800
leaq -0x220(%rbp), %rdi
callq 0x40d0
movq -0x2c0(%rbp), %rdi
callq 0x4520
nopl (%rax)