// File: /workspace/github_cpp_makefile_star2_O3/flastest[P]HeterogeneousParallelDijkstra/BBO_graph_creator.cc
// Function: graph_from_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool)
graph_t 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 input;

	while (std::getline(infile,input))// >> ", 0," >>team_a>>", 0,">>team_b>>", 0")
	{
		if(truncate_early && counter <= 0)
		{
			break;
		}	

		counter--;

		if (input.substr(0,1) != "#" && input.substr(0,1) != "R")
		{
			if (DEBUG_LOGS) std::cout<<"checking line "<<input<<std::endl;
			// let's say we have 0, 0, 0/1, 0, 2/3, 0
			std::string team_a = remove_a_comma (remove_a_comma (input));
			//now we have 0/1, 0, 2/3, 0

			//let's obtain team_b
			std::string team_b = remove_a_comma (remove_a_comma (team_a));
			//now team_b is 2/3, 0
			team_b = team_b.substr(0,team_b.find(","));

			//now fix team_a which is 0/1, 0, 2/3, 0
			team_a = team_a.substr(0,team_a.find(","));

			if (DEBUG_LOGS) std::cout<<"team a is "<<team_a<<std::endl;
			if (DEBUG_LOGS) std::cout<<"team b is "<<team_b<<std::endl;


			//for each teammmate in team_a, we need to add an edge from that teammate to every member in team_b

			auto team_a_vec = get_teammates(team_a);
			auto team_b_vec = get_teammates(team_b);

			for(int teammate : team_a_vec)
			{
				for(int opponent : team_b_vec)
				{
					edge_vec.push_back(Edge(teammate,opponent));
					weight_vec.push_back(1);

				}
				if (teammate > biggest_player_id) 
				{
					biggest_player_id = teammate;
				}
			}

			for(int opponent : team_b_vec)
			{
				//infclude the following for bidirectional graph
				/*
				for(int teammate : team_a_vec)
				{
					edge_vec.push_back(Edge(opponent,teammate));
					weight_vec.push_back(1);

				}
				*/
				
				//to keep track of how many nodes we have
				if (opponent > biggest_player_id) 
				{
					biggest_player_id = opponent;
				}
			}
		}
	}

	//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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3c8, %rsp            # imm = 0x3C8
movl %edx, -0x7c(%rbp)
movq %rdi, -0x1a0(%rbp)
leaq -0x3f0(%rbp), %rbx
movq %rbx, %rdi
movl $0x8, %edx
callq 0x3360
xorl %r14d, %r14d
leaq -0xe0(%rbp), %rax
movq %r14, 0x10(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
leaq -0xa0(%rbp), %rax
movq %r14, 0x10(%rax)
movaps %xmm0, (%rax)
leaq -0xb0(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r14, -0x8(%rax)
movb $0x0, (%rax)
movl $0x3e8, -0x30(%rbp)     # imm = 0x3E8
leaq -0x50(%rbp), %r15
leaq -0x78(%rbp), %r12
leaq 0x3529(%rip), %r13      # 0x12b25
movq -0x3f0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %edx
movq %rbx, %rdi
leaq -0xc0(%rbp), %rsi
callq 0x3430
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
cmpl $0x0, -0x30(%rbp)
setle %cl
testb $0x5, 0x20(%rax,%rdx)
jne 0xfc4d
andb -0x7c(%rbp), %cl
jne 0xfc4d
movl $0x1, %ecx
movq %r15, %rdi
leaq -0xc0(%rbp), %rsi
xorl %edx, %edx
callq 0x3270
movq %r15, %rdi
leaq 0x34bb(%rip), %rsi      # 0x12b23
callq 0x30b0
testl %eax, %eax
je 0xf6b2
movl $0x1, %ecx
movq %r12, %rdi
leaq -0xc0(%rbp), %rsi
xorl %edx, %edx
callq 0x3270
movq %r12, %rdi
movq %r13, %rsi
callq 0x30b0
testl %eax, %eax
setne %bl
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0xf6b4
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x3250
jmp 0xf6b4
xorl %ebx, %ebx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xf6cd
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3250
decl -0x30(%rbp)
testb %bl, %bl
leaq -0x3f0(%rbp), %rbx
je 0xf5fc
cmpb $0x1, 0x8ded(%rip)      # 0x184d3
jne 0xf744
movl $0xe, %edx
movq 0x88dc(%rip), %rdi      # 0x17fd0
leaq 0x342c(%rip), %rsi      # 0x12b27
callq 0x32a0
movq -0xc0(%rbp), %rsi
movq -0xb8(%rbp), %rdx
movq 0x88bb(%rip), %rdi      # 0x17fd0
callq 0x32a0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31a0
leaq -0x128(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0xc0(%rbp), %rsi
movq -0xb8(%rbp), %rdx
addq %rsi, %rdx
leaq -0x138(%rbp), %rbx
movq %rbx, %rdi
callq 0x8be2
movl $0x1, %ecx
movq %rbx, %rdi
leaq 0x33a0(%rip), %r12      # 0x12b21
movq %r12, %rsi
xorl %edx, %edx
callq 0x33f0
leaq 0x2(%rax), %rdx
leaq -0x1e8(%rbp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movq $-0x1, %rcx
callq 0x3270
movl $0x1, %ecx
movq %r13, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x33f0
leaq 0x2(%rax), %rdx
movq %r15, %rdi
movq %r13, %rsi
movq $-0x1, %rcx
callq 0x3270
movq -0x1e8(%rbp), %rdi
leaq -0x1d8(%rbp), %rax
cmpq %rax, %rdi
leaq -0x198(%rbp), %r12
je 0xf7f9
movq -0x1d8(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x138(%rbp), %rdi
leaq -0x128(%rbp), %rax
cmpq %rax, %rdi
je 0xf81b
movq -0x128(%rbp), %rsi
incq %rsi
callq 0x3250
leaq -0x188(%rbp), %rbx
movq %rbx, -0x198(%rbp)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x8be2
leaq 0x32de(%rip), %r13      # 0x12b21
movl $0x1, %ecx
movq %r12, %rdi
movq %r13, %rbx
movq %r13, %rsi
xorl %edx, %edx
callq 0x33f0
leaq 0x2(%rax), %rdx
leaq -0x1c8(%rbp), %r13
movq %r13, %rdi
movq %r12, %rsi
movq $-0x1, %rcx
callq 0x3270
movl $0x1, %ecx
movq %r13, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x33f0
leaq 0x2(%rax), %rdx
leaq -0x78(%rbp), %r12
movq %r12, %rdi
movq %r13, %rsi
movq $-0x1, %rcx
callq 0x3270
movq -0x1c8(%rbp), %rdi
leaq -0x1b8(%rbp), %rax
cmpq %rax, %rdi
leaq -0x100(%rbp), %r13
je 0xf8ca
movq -0x1b8(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x198(%rbp), %rdi
leaq -0x188(%rbp), %rax
cmpq %rax, %rdi
je 0xf8ec
movq -0x188(%rbp), %rsi
incq %rsi
callq 0x3250
movl $0x1, %ecx
movq %r12, %rdi
leaq 0x3226(%rip), %rsi      # 0x12b21
xorl %edx, %edx
callq 0x33f0
movq %r13, %rdi
movq %r12, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x3270
leaq -0xf0(%rbp), %rbx
movq %r12, %rdi
movq %r13, %rsi
callq 0x32c0
movq -0x100(%rbp), %rdi
cmpq %rbx, %rdi
je 0xf93f
movq -0xf0(%rbp), %rsi
incq %rsi
callq 0x3250
movl $0x1, %ecx
movq %r15, %rdi
leaq 0x31d3(%rip), %rsi      # 0x12b21
xorl %edx, %edx
callq 0x33f0
movq %r13, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x3270
movq %r15, %rdi
movq %r13, %rsi
callq 0x32c0
movq -0x100(%rbp), %rdi
cmpq %rbx, %rdi
je 0xf98b
movq -0xf0(%rbp), %rsi
incq %rsi
callq 0x3250
movb 0x8b42(%rip), %al       # 0x184d3
cmpb $0x1, %al
leaq -0x178(%rbp), %rbx
leaq -0x158(%rbp), %r15
jne 0xf9ff
movl $0xa, %edx
movq 0x8621(%rip), %rdi      # 0x17fd0
leaq 0x3180(%rip), %rsi      # 0x12b36
callq 0x32a0
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq 0x8606(%rip), %rdi      # 0x17fd0
callq 0x32a0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r12, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31a0
movb 0x8ad4(%rip), %al       # 0x184d3
testb $0x1, %al
je 0xfa59
movl $0xa, %edx
movq 0x85c1(%rip), %rdi      # 0x17fd0
leaq 0x312b(%rip), %rsi      # 0x12b41
callq 0x32a0
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
movq 0x85a6(%rip), %rdi      # 0x17fd0
callq 0x32a0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r12, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31a0
leaq -0x168(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x8be2
movq %r13, %rdi
movq %rbx, %rsi
callq 0xf07c
movq -0x178(%rbp), %rdi
leaq -0x168(%rbp), %rax
cmpq %rax, %rdi
je 0xfaa7
movq -0x168(%rbp), %rsi
incq %rsi
callq 0x3250
leaq -0x148(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x8be2
leaq -0x118(%rbp), %rdi
movq %r15, %rsi
callq 0xf07c
movq -0x158(%rbp), %rdi
leaq -0x148(%rbp), %rax
cmpq %rax, %rdi
je 0xfaf9
movq -0x148(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x100(%rbp), %rbx
movq -0xf8(%rbp), %rax
movq %rax, -0x1a8(%rbp)
cmpq %rax, %rbx
je 0xfba5
movq %r14, %r15
movl (%rbx), %r13d
movq -0x118(%rbp), %r14
movq -0x110(%rbp), %r12
cmpq %r12, %r14
je 0xfb8a
movl (%r14), %eax
movl %r13d, -0x58(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x1073a
movl $0x1, -0x58(%rbp)
movq -0x98(%rbp), %rsi
cmpq -0x90(%rbp), %rsi
je 0xfb74
movl $0x1, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x98(%rbp)
jmp 0xfb84
leaq -0xa0(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x108b8
addq $0x4, %r14
jmp 0xfb2b
movq %r15, %r14
cmpl %r14d, %r13d
cmovgl %r13d, %r14d
addq $0x4, %rbx
cmpq -0x1a8(%rbp), %rbx
jne 0xfb17
movq -0x118(%rbp), %rdi
movq -0x110(%rbp), %rax
movq %rdi, %rcx
cmpq %rax, %rdi
je 0xfbcd
movl (%rcx), %edx
cmpl %r14d, %edx
cmovgl %edx, %r14d
addq $0x4, %rcx
cmpq %rax, %rcx
jne 0xfbbb
testq %rdi, %rdi
leaq -0x50(%rbp), %r15
leaq -0x3f0(%rbp), %rbx
leaq -0x78(%rbp), %r12
je 0xfbf0
movq -0x108(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
movq -0x100(%rbp), %rdi
testq %rdi, %rdi
leaq 0x2f24(%rip), %r13      # 0x12b25
je 0xfc12
movq -0xf0(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0xfc2b
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xf5fc
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3250
jmp 0xf5fc
movq -0x1a0(%rbp), %r12
movq %r14, %r13
movq %rsp, -0x30(%rbp)
movq -0xe0(%rbp), %rax
movq -0xd8(%rbp), %rbx
movq %rsp, %r14
movq %rbx, %rcx
subq %rax, %rcx
addq $0xf, %rcx
andq $-0x10, %rcx
subq %rcx, %r14
movq %r14, %rsp
subq %rax, %rbx
je 0xfc9b
leaq -0x8(%rbx), %rdx
andq $-0x8, %rdx
addq $0x8, %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x3140
movq -0xe0(%rbp), %rax
movq -0xd8(%rbp), %rcx
subq %rax, %rcx
je 0xfcc6
sarq $0x3, %rcx
xorl %edx, %edx
movq (%rax,%rdx,8), %rsi
movq %rsi, (%r14,%rdx,8)
incq %rdx
movl %edx, %esi
cmpq %rsi, %rcx
ja 0xfcb4
movq -0x98(%rbp), %rdx
movq -0xa0(%rbp), %rsi
movq %rdx, %rax
subq %rsi, %rax
movq %rsp, %rcx
leaq 0xf(%rax), %rdi
andq $-0x10, %rdi
subq %rdi, %rcx
movq %rcx, %rsp
cmpq %rsi, %rdx
je 0xfd07
sarq $0x2, %rax
xorl %edx, %edx
movl $0x1, (%rcx,%rdx,4)
incq %rdx
movl %edx, %esi
cmpq %rsi, %rax
ja 0xfcf6
shlq $0x1d, %rbx
sarq $0x1d, %rbx
addq %r14, %rbx
movl %r13d, %r8d
subq $0x8, %rsp
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
xorl %r9d, %r9d
pushq %r15
callq 0x8600
addq $0x10, %rsp
movq -0x30(%rbp), %rsp
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0xfd56
movq -0xb0(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0xa0(%rbp), %rdi
testq %rdi, %rdi
je 0xfd71
movq -0x90(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
movq -0xe0(%rbp), %rdi
testq %rdi, %rdi
je 0xfd8c
movq -0xd0(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
leaq -0x3f0(%rbp), %rdi
callq 0x3090
movq %r12, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x158(%rbp), %rdi
leaq -0x148(%rbp), %rax
cmpq %rax, %rdi
je 0xfeea
movq -0x148(%rbp), %rsi
incq %rsi
jmp 0xfee5
movq %rax, %rbx
jmp 0xfeea
movq %rax, %rbx
movq -0x178(%rbp), %rdi
leaq -0x168(%rbp), %rax
cmpq %rax, %rdi
je 0xff05
movq -0x168(%rbp), %rsi
incq %rsi
jmp 0xff00
jmp 0xfeb9
jmp 0xfeb9
jmp 0xfeb9
movq %rax, %rbx
movq -0x1c8(%rbp), %rdi
leaq -0x1b8(%rbp), %rax
cmpq %rax, %rdi
je 0xfe3d
movq -0x1b8(%rbp), %rsi
incq %rsi
callq 0x3250
jmp 0xfe3d
movq %rax, %rbx
movq -0x198(%rbp), %rdi
leaq -0x188(%rbp), %rax
cmpq %rax, %rdi
je 0xff1e
movq -0x188(%rbp), %rsi
jmp 0xff16
jmp 0xfebe
leaq -0x128(%rbp), %r13
movq %rax, %rbx
movq -0x1e8(%rbp), %rdi
leaq -0x1d8(%rbp), %rax
cmpq %rax, %rdi
je 0xfe9a
movq -0x1d8(%rbp), %rsi
incq %rsi
callq 0x3250
jmp 0xfe9a
leaq -0x128(%rbp), %r13
movq %rax, %rbx
movq -0x138(%rbp), %rdi
cmpq %r13, %rdi
je 0xff37
movq -0x128(%rbp), %rsi
jmp 0xff2f
jmp 0xfec5
jmp 0xfec5
jmp 0xfec5
movq %rax, %rbx
jmp 0xff05
movq %rax, %rbx
jmp 0xff1e
jmp 0xfec5
movq %rax, %rbx
jmp 0xff37
jmp 0xfecc
movq %rax, %rbx
movq -0x118(%rbp), %rdi
testq %rdi, %rdi
je 0xfeea
movq -0x108(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
movq -0x100(%rbp), %rdi
testq %rdi, %rdi
je 0xff05
movq -0xf0(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0xff1e
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xff37
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0xc0(%rbp), %rdi
leaq -0xb0(%rbp), %rax
cmpq %rax, %rdi
je 0xff59
movq -0xb0(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0xa0(%rbp), %rdi
testq %rdi, %rdi
je 0xff74
movq -0x90(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
movq -0xe0(%rbp), %rdi
testq %rdi, %rdi
je 0xff8f
movq -0xd0(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
leaq -0x3f0(%rbp), %rdi
callq 0x3090
movq %rbx, %rdi
callq 0x3400