// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2f8, %rsp            # imm = 0x2F8
movl %edx, -0x30(%rbp)
movq %rdi, -0x78(%rbp)
leaq -0x320(%rbp), %rdi
pushq $0x8
popq %rdx
callq 0x3390
xorps %xmm0, %xmm0
leaq -0x50(%rbp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
leaq -0x70(%rbp), %rcx
andq $0x0, 0x10(%rcx)
leaq -0xe8(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movaps %xmm0, (%rcx)
xorl %ecx, %ecx
leaq -0xc8(%rbp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
leaq -0xa8(%rbp), %rsi
movq %rsi, -0x10(%rsi)
andq $0x0, -0x8(%rsi)
movb %cl, (%rax)
movb %cl, (%rdx)
movb %cl, (%rsi)
movl $0x3e8, -0x2c(%rbp)     # imm = 0x3E8
leaq -0xb8(%rbp), %r15
leaq -0x98(%rbp), %r14
leaq -0x118(%rbp), %r12
leaq -0x320(%rbp), %rdi
movq %r15, %rsi
callq 0x3080
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
cmpl $0x0, -0x2c(%rbp)
setle %cl
testb $0x5, 0x20(%rax,%rdx)
jne 0xd340
andb -0x30(%rbp), %cl
jne 0xd340
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
pushq $0x1
popq %rcx
callq 0x32b0
movq %r14, %rdi
leaq 0x2d1b(%rip), %rsi      # 0xff33
callq 0xd51a
movl %eax, %ebx
movq %r14, %rdi
callq 0x3110
testb %bl, %bl
je 0xd338
movq %r15, %rdi
leaq 0x270f(%rip), %rbx      # 0xf948
movq %rbx, %rsi
xorl %edx, %edx
callq 0x3470
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x32b0
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x3470
leaq 0x1(%rax), %rdx
movq %r12, %rdi
movq %r15, %rsi
pushq $-0x1
popq %rcx
callq 0x32b0
pushq $0xa
popq %r14
cmpb $0x1, 0xa26e(%rip)      # 0x174eb
leaq -0x98(%rbp), %rbx
jne 0xd2d2
movq 0x9d3b(%rip), %rdi      # 0x16fc8
leaq 0x2cc8(%rip), %rsi      # 0xff5c
callq 0x3270
movq %rax, %rdi
movq %rbx, %rsi
callq 0x3250
movq %rax, %rdi
callq 0x3140
movq 0x9d15(%rip), %rdi      # 0x16fc8
leaq 0x2cad(%rip), %rsi      # 0xff67
callq 0x3270
movq %rax, %rdi
movq %r12, %rsi
callq 0x3250
movq %rax, %rdi
callq 0x3140
movq %rbx, %rdi
xorl %esi, %esi
movl %r14d, %edx
callq 0xd4df
movl %r14d, %edx
movl %eax, %ebx
movq %r12, %r14
movq %r12, %rdi
xorl %esi, %esi
callq 0xd4df
movl %eax, %r12d
movl $0x1, -0x38(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0x38(%rbp), %r13
movq %r13, %rsi
callq 0xd8aa
movl %ebx, -0x38(%rbp)
movl %r12d, -0x34(%rbp)
leaq -0x50(%rbp), %rdi
movq %r13, %rsi
callq 0xd72c
movq %r14, %r12
movq %r14, %rdi
callq 0x3110
leaq -0x98(%rbp), %r14
movq %r14, %rdi
callq 0x3110
decl -0x2c(%rbp)
jmp 0xd1cd
movq %rsp, %r12
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rbx
movq %rsp, %r15
movq %rbx, %rcx
subq %rax, %rcx
addq $0xf, %rcx
andq $-0x10, %rcx
subq %rcx, %r15
movq %r15, %rsp
subq %rax, %rbx
je 0xd37d
leaq -0x8(%rbx), %rdx
andq $-0x8, %rdx
addq $0x8, %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x3170
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
xorl %edx, %edx
movl %edx, %edx
cmpq %rdx, %rcx
jbe 0xd3a1
movq (%rax,%rdx,8), %rsi
movq %rsi, (%r15,%rdx,8)
incl %edx
jmp 0xd38e
movq -0x68(%rbp), %rdx
subq -0x70(%rbp), %rdx
movq %rdx, %rax
sarq $0x2, %rax
movq %rsp, %rcx
addq $0xf, %rdx
andq $-0x10, %rdx
subq %rdx, %rcx
movq %rcx, %rsp
xorl %edx, %edx
movl %edx, %edx
cmpq %rdx, %rax
jbe 0xd3d5
movl $0x1, (%rcx,%rdx,4)
incl %edx
jmp 0xd3c3
shlq $0x1d, %rbx
sarq $0x1d, %rbx
addq %r15, %rbx
subq $0x8, %rsp
movq -0x78(%rbp), %r13
movq %r13, %rdi
movq %r15, %rsi
movq %rbx, %rdx
xorl %r8d, %r8d
xorl %r9d, %r9d
leaq -0x98(%rbp), %rax
pushq %rax
callq 0x6b18
popq %rax
popq %rcx
movq %r12, %rsp
leaq -0xb8(%rbp), %rdi
callq 0x3110
leaq -0xd8(%rbp), %rdi
callq 0x3110
leaq -0xf8(%rbp), %rdi
callq 0x3110
leaq -0x70(%rbp), %rdi
callq 0x74ca
leaq -0x50(%rbp), %rdi
callq 0xd6ec
leaq -0x320(%rbp), %rdi
callq 0x30a0
movq %r13, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xd475
movq %rax, %rbx
jmp 0xd489
jmp 0xd47a
jmp 0xd47a
jmp 0xd475
jmp 0xd47a
jmp 0xd47a
jmp 0xd475
movq %rax, %rbx
jmp 0xd489
movq %rax, %rbx
jmp 0xd495
movq %rax, %rbx
leaq -0x118(%rbp), %rdi
callq 0x3110
leaq -0x98(%rbp), %rdi
callq 0x3110
leaq -0xb8(%rbp), %rdi
callq 0x3110
leaq -0xd8(%rbp), %rdi
callq 0x3110
leaq -0xf8(%rbp), %rdi
callq 0x3110
leaq -0x70(%rbp), %rdi
callq 0x74ca
leaq -0x50(%rbp), %rdi
callq 0xd6ec
leaq -0x320(%rbp), %rdi
callq 0x30a0
movq %rbx, %rdi
callq 0x3420