// File: /workspace/github_cpp_makefile_star2_O1/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 $0x3e8, %rsp            # imm = 0x3E8
movl %edx, -0x5c(%rbp)
movq %rdi, -0x1a0(%rbp)
leaq -0x410(%rbp), %rbx
movq %rbx, %rdi
movl $0x8, %edx
callq 0x3360
xorl %r14d, %r14d
leaq -0xc0(%rbp), %rax
movq %r14, 0x10(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
leaq -0x80(%rbp), %rax
movq %r14, 0x10(%rax)
movaps %xmm0, (%rax)
leaq -0x90(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r14, -0x8(%rax)
movb $0x0, (%rax)
movl $0x3e8, -0x30(%rbp)     # imm = 0x3E8
leaq -0x50(%rbp), %r13
leaq -0x208(%rbp), %r15
movq -0x410(%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %edx
movq %rbx, %rdi
leaq -0xa0(%rbp), %rsi
callq 0x3430
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
cmpl $0x0, -0x30(%rbp)
setle %cl
testb $0x5, 0x20(%rax,%rdx)
jne 0xfef7
andb -0x5c(%rbp), %cl
jne 0xfef7
movl $0x1, %ecx
movq %r13, %rdi
leaq -0xa0(%rbp), %rsi
xorl %edx, %edx
callq 0x3270
movq %r13, %rdi
leaq 0x31e2(%rip), %rsi      # 0x12ae3
callq 0x30b0
movl %eax, %r12d
testl %eax, %eax
je 0xf939
movl $0x1, %ecx
movq %r15, %rdi
leaq -0xa0(%rbp), %rsi
xorl %edx, %edx
callq 0x3270
movq %r15, %rdi
leaq 0x31b8(%rip), %rsi      # 0x12ae5
callq 0x30b0
testl %eax, %eax
setne %bl
jmp 0xf93b
xorl %ebx, %ebx
testl %r12d, %r12d
je 0xf962
movq -0x208(%rbp), %rdi
leaq -0x1f8(%rbp), %rax
cmpq %rax, %rdi
je 0xf962
movq -0x1f8(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xf97b
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3250
decl -0x30(%rbp)
testb %bl, %bl
leaq -0x410(%rbp), %rbx
je 0xf895
cmpb $0x1, 0x8b3f(%rip)      # 0x184d3
jne 0xf9f2
movl $0xe, %edx
movq 0x862e(%rip), %rdi      # 0x17fd0
leaq 0x313e(%rip), %rsi      # 0x12ae7
callq 0x32a0
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
movq 0x860d(%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 -0x188(%rbp), %rax
movq %rax, -0x198(%rbp)
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
addq %rsi, %rdx
leaq -0x198(%rbp), %r12
movq %r12, %rdi
callq 0x8d34
movl $0x1, %ecx
movq %r12, %rdi
leaq 0x30b2(%rip), %r15      # 0x12ae1
movq %r15, %rsi
xorl %edx, %edx
callq 0x33f0
leaq 0x2(%rax), %rdx
leaq -0x1e8(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq $-0x1, %rcx
callq 0x3270
movl $0x1, %ecx
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x33f0
leaq 0x2(%rax), %rdx
movq %r13, %rdi
movq %rbx, %rsi
movq $-0x1, %rcx
callq 0x3270
movq -0x1e8(%rbp), %rdi
leaq -0x1d8(%rbp), %rax
cmpq %rax, %rdi
leaq -0x178(%rbp), %rbx
je 0xfaa7
movq -0x1d8(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x198(%rbp), %rdi
leaq -0x188(%rbp), %rax
cmpq %rax, %rdi
je 0xfac9
movq -0x188(%rbp), %rsi
incq %rsi
callq 0x3250
leaq -0x168(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x8d34
movl $0x1, %ecx
movq %rbx, %rdi
leaq 0x2fe8(%rip), %r15      # 0x12ae1
movq %r15, %rsi
xorl %edx, %edx
callq 0x33f0
leaq 0x2(%rax), %rdx
leaq -0x1c8(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq $-0x1, %rcx
callq 0x3270
movl $0x1, %ecx
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x33f0
leaq 0x2(%rax), %rdx
leaq -0x100(%rbp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq $-0x1, %rcx
callq 0x3270
movq -0x1c8(%rbp), %rdi
leaq -0x1b8(%rbp), %rax
cmpq %rax, %rdi
leaq -0xe0(%rbp), %r15
je 0xfb78
movq -0x1b8(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x178(%rbp), %rdi
leaq -0x168(%rbp), %rax
cmpq %rax, %rdi
je 0xfb9a
movq -0x168(%rbp), %rsi
incq %rsi
callq 0x3250
movl $0x1, %ecx
movq %rbx, %rdi
leaq 0x2f38(%rip), %rsi      # 0x12ae1
xorl %edx, %edx
callq 0x33f0
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x3270
movq %rbx, %rdi
movq %r15, %rsi
callq 0x32c0
movq -0xe0(%rbp), %rdi
leaq -0xd0(%rbp), %rbx
cmpq %rbx, %rdi
je 0xfbed
movq -0xd0(%rbp), %rsi
incq %rsi
callq 0x3250
movl $0x1, %ecx
movq %r13, %rdi
leaq 0x2ee5(%rip), %rsi      # 0x12ae1
xorl %edx, %edx
callq 0x33f0
movq %r15, %rdi
movq %r13, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x3270
movq %r13, %rdi
movq %r15, %rsi
callq 0x32c0
movq -0xe0(%rbp), %rdi
cmpq %rbx, %rdi
je 0xfc39
movq -0xd0(%rbp), %rsi
incq %rsi
callq 0x3250
cmpb $0x1, 0x8893(%rip)      # 0x184d3
leaq -0x158(%rbp), %rbx
leaq -0x138(%rbp), %r13
jne 0xfca6
movl $0xa, %edx
movq 0x8374(%rip), %rdi      # 0x17fd0
leaq 0x2e93(%rip), %rsi      # 0x12af6
callq 0x32a0
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq 0x8359(%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
cmpb $0x1, 0x8826(%rip)      # 0x184d3
jne 0xfd0b
movl $0xa, %edx
movq 0x8315(%rip), %rdi      # 0x17fd0
leaq 0x2e3f(%rip), %rsi      # 0x12b01
callq 0x32a0
movq -0x100(%rbp), %rsi
movq -0xf8(%rbp), %rdx
movq 0x82f4(%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 -0x148(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x8d34
movq %r15, %rdi
movq %rbx, %rsi
callq 0xf31c
movq -0x158(%rbp), %rdi
leaq -0x148(%rbp), %rax
cmpq %rax, %rdi
je 0xfd59
movq -0x148(%rbp), %rsi
incq %rsi
callq 0x3250
leaq -0x128(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x100(%rbp), %rsi
movq -0xf8(%rbp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x8d34
leaq -0x118(%rbp), %rdi
movq %r13, %rsi
callq 0xf31c
movq -0x138(%rbp), %rdi
leaq -0x128(%rbp), %rax
cmpq %rax, %rdi
je 0xfdb1
movq -0x128(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0xe0(%rbp), %r12
movq -0xd8(%rbp), %rax
movq %rax, -0x1a8(%rbp)
cmpq %rax, %r12
je 0xfe4a
movq %r14, %r15
movl (%r12), %r13d
movq -0x118(%rbp), %r14
movq -0x110(%rbp), %rbx
cmpq %rbx, %r14
je 0xfe33
movl (%r14), %eax
movl %r13d, -0x58(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xc0(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x109e8
movl $0x1, -0x58(%rbp)
movq -0x78(%rbp), %rsi
cmpq -0x70(%rbp), %rsi
je 0xfe20
movl $0x1, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x78(%rbp)
jmp 0xfe2d
leaq -0x80(%rbp), %rdi
leaq -0x58(%rbp), %rdx
callq 0x10b5e
addq $0x4, %r14
jmp 0xfde0
movq %r15, %r14
cmpl %r14d, %r13d
cmovgl %r13d, %r14d
addq $0x4, %r12
cmpq -0x1a8(%rbp), %r12
jne 0xfdcb
movq -0x118(%rbp), %rdi
movq -0x110(%rbp), %rax
movq %rdi, %rcx
cmpq %rax, %rdi
je 0xfe72
movl (%rcx), %edx
cmpl %r14d, %edx
cmovgl %edx, %r14d
addq $0x4, %rcx
cmpq %rax, %rcx
jne 0xfe60
testq %rdi, %rdi
leaq -0x50(%rbp), %r13
leaq -0x410(%rbp), %rbx
leaq -0x208(%rbp), %r15
je 0xfe98
movq -0x108(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
movq -0xe0(%rbp), %rdi
testq %rdi, %rdi
je 0xfeb3
movq -0xd0(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
movq -0x100(%rbp), %rdi
leaq -0xf0(%rbp), %rax
cmpq %rax, %rdi
je 0xfed5
movq -0xf0(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0xf895
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3250
jmp 0xf895
movq -0x1a0(%rbp), %r12
movq %r14, %rbx
movq %rsp, -0x30(%rbp)
movq -0xc0(%rbp), %rax
movq -0xb8(%rbp), %r15
movq %rsp, %r14
movq %r15, %rcx
subq %rax, %rcx
addq $0xf, %rcx
andq $-0x10, %rcx
subq %rcx, %r14
movq %r14, %rsp
subq %rax, %r15
je 0xff45
leaq -0x8(%r15), %rdx
andq $-0x8, %rdx
addq $0x8, %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x3140
movq -0xc0(%rbp), %rax
movq -0xb8(%rbp), %rcx
subq %rax, %rcx
je 0xff78
sarq $0x3, %rcx
xorl %edx, %edx
movl (%rax,%rdx,8), %esi
movl %esi, (%r14,%rdx,8)
movl 0x4(%rax,%rdx,8), %esi
movl %esi, 0x4(%r14,%rdx,8)
incq %rdx
movl %edx, %esi
cmpq %rsi, %rcx
ja 0xff5e
movq -0x78(%rbp), %rdx
movq -0x80(%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 0xffb3
sarq $0x2, %rax
xorl %edx, %edx
movl $0x1, (%rcx,%rdx,4)
incq %rdx
movl %edx, %esi
cmpq %rsi, %rax
ja 0xffa2
shlq $0x1d, %r15
sarq $0x1d, %r15
addq %r14, %r15
movl %ebx, %r8d
subq $0x8, %rsp
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %r9d, %r9d
pushq %r13
callq 0x8758
addq $0x10, %rsp
movq -0x30(%rbp), %rsp
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x10002
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x10017
movq -0x70(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
movq -0xc0(%rbp), %rdi
testq %rdi, %rdi
je 0x10032
movq -0xb0(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
leaq -0x410(%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 -0x138(%rbp), %rdi
leaq -0x128(%rbp), %rax
cmpq %rax, %rdi
je 0x1018c
movq -0x128(%rbp), %rsi
incq %rsi
jmp 0x10187
movq %rax, %rbx
jmp 0x1018c
movq %rax, %rbx
movq -0x158(%rbp), %rdi
leaq -0x148(%rbp), %rax
cmpq %rax, %rdi
je 0x101a7
movq -0x148(%rbp), %rsi
incq %rsi
jmp 0x101a2
jmp 0x1015b
jmp 0x1015b
jmp 0x1015b
movq %rax, %rbx
movq -0x1c8(%rbp), %rdi
leaq -0x1b8(%rbp), %rax
cmpq %rax, %rdi
je 0x100e3
movq -0x1b8(%rbp), %rsi
incq %rsi
callq 0x3250
jmp 0x100e3
movq %rax, %rbx
movq -0x178(%rbp), %rdi
leaq -0x168(%rbp), %rax
cmpq %rax, %rdi
je 0x101c9
movq -0x168(%rbp), %rsi
jmp 0x101c1
jmp 0x10160
movq %rax, %rbx
movq -0x1e8(%rbp), %rdi
leaq -0x1d8(%rbp), %rax
cmpq %rax, %rdi
je 0x10132
movq -0x1d8(%rbp), %rsi
incq %rsi
callq 0x3250
jmp 0x10132
movq %rax, %rbx
movq -0x198(%rbp), %rdi
leaq -0x188(%rbp), %rax
cmpq %rax, %rdi
je 0x101e2
movq -0x188(%rbp), %rsi
jmp 0x101da
jmp 0x10167
jmp 0x10167
jmp 0x10167
movq %rax, %rbx
jmp 0x101a7
movq %rax, %rbx
jmp 0x101c9
jmp 0x10167
movq %rax, %rbx
jmp 0x101e2
jmp 0x1016e
movq %rax, %rbx
movq -0x118(%rbp), %rdi
testq %rdi, %rdi
je 0x1018c
movq -0x108(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
movq -0xe0(%rbp), %rdi
testq %rdi, %rdi
je 0x101a7
movq -0xd0(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
movq -0x100(%rbp), %rdi
leaq -0xf0(%rbp), %rax
cmpq %rax, %rdi
je 0x101c9
movq -0xf0(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x101e2
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rax
cmpq %rax, %rdi
je 0x10204
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x10219
movq -0x70(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
movq -0xc0(%rbp), %rdi
testq %rdi, %rdi
je 0x10234
movq -0xb0(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
leaq -0x410(%rbp), %rdi
callq 0x3090
movq %rbx, %rdi
callq 0x3400