// File: /workspace/github_cpp_makefile_star2_O3/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, -0x54(%rbp)
movq %rdi, -0x98(%rbp)
leaq -0x320(%rbp), %r15
movq %r15, %rdi
movl $0x8, %edx
callq 0x3360
xorl %eax, %eax
leaq -0x90(%rbp), %rcx
movq %rax, 0x10(%rcx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rcx)
leaq -0x70(%rbp), %rcx
movq %rax, 0x10(%rcx)
movaps %xmm0, (%rcx)
leaq -0x108(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0xe8(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0xc8(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq -0x40(%rbp), %rbx
movl $0x3e8, %r14d           # imm = 0x3E8
leaq -0x50(%rbp), %r12
movq -0x320(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %edx
movq %r15, %rdi
leaq -0xd8(%rbp), %rsi
callq 0x3430
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
testl %r14d, %r14d
setle %cl
testb $0x5, 0x20(%rax,%rdx)
jne 0x10347
andb -0x54(%rbp), %cl
jne 0x10347
movl %r14d, -0x58(%rbp)
movl $0x1, %ecx
movq %r12, %rdi
leaq -0xd8(%rbp), %rsi
xorl %edx, %edx
callq 0x3270
movq %r12, %rdi
leaq 0x2a80(%rip), %rsi      # 0x12b23
callq 0x30b0
movl %eax, %r14d
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0x100c0
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3250
testl %r14d, %r14d
je 0x1033b
movl $0x1, %ecx
leaq -0xd8(%rbp), %r14
movq %r14, %rdi
leaq 0x245b(%rip), %r15      # 0x1253a
movq %r15, %rsi
xorl %edx, %edx
callq 0x33f0
movq %r12, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x3270
movl $0x1, %ecx
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x33f0
leaq 0x1(%rax), %rdx
leaq -0xb8(%rbp), %rdi
movq %r14, %rsi
movq $-0x1, %rcx
callq 0x3270
cmpb $0x1, 0x83a7(%rip)      # 0x184d3
jne 0x101e4
movl $0xa, %edx
movq 0x7e92(%rip), %rdi      # 0x17fd0
leaq 0x2a07(%rip), %rsi      # 0x12b4c
callq 0x32a0
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq 0x7e77(%rip), %rdi      # 0x17fd0
callq 0x32a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31a0
movl $0xa, %edx
movq 0x7e3c(%rip), %rdi      # 0x17fd0
leaq 0x29bc(%rip), %rsi      # 0x12b57
callq 0x32a0
movq -0xb8(%rbp), %rsi
movq -0xb0(%rbp), %rdx
movq 0x7e1b(%rip), %rdi      # 0x17fd0
callq 0x32a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3230
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31a0
movq -0x50(%rbp), %r14
callq 0x3050
movq %rax, %r15
movl (%rax), %r13d
movl $0x0, (%rax)
movq %r14, %rdi
leaq -0x30(%rbp), %rsi
movl $0xa, %edx
callq 0x32f0
cmpq %r14, -0x30(%rbp)
je 0x104f9
movq %rax, %r12
addq $-0x80000000, %rax      # imm = 0x80000000
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jb 0x104d5
movl (%r15), %ebx
cmpl $0x22, %ebx
je 0x104d5
testl %ebx, %ebx
leaq -0x30(%rbp), %rsi
jne 0x1024a
movl %r13d, (%r15)
movl %r13d, %ebx
movq -0xb8(%rbp), %r13
movl $0x0, (%r15)
movq %r13, %rdi
movl $0xa, %edx
callq 0x32f0
cmpq %r13, -0x30(%rbp)
je 0x104e1
movq %rax, %r14
addq $-0x80000000, %rax      # imm = 0x80000000
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jb 0x104ed
movl (%r15), %eax
cmpl $0x22, %eax
je 0x104ed
testl %eax, %eax
jne 0x1029e
movl %ebx, (%r15)
movl $0x1, -0x30(%rbp)
movq -0x68(%rbp), %rsi
cmpq -0x60(%rbp), %rsi
je 0x102ce
movl $0x1, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x68(%rbp)
leaq -0x40(%rbp), %rbx
leaq -0x320(%rbp), %r15
leaq -0x30(%rbp), %r13
jmp 0x102e9
leaq -0x70(%rbp), %rdi
leaq -0x30(%rbp), %r13
movq %r13, %rdx
leaq -0x40(%rbp), %rbx
callq 0x108b8
leaq -0x320(%rbp), %r15
movl %r12d, -0x30(%rbp)
movl %r14d, -0x2c(%rbp)
leaq -0x90(%rbp), %rdi
movq %r13, %rsi
callq 0x1073a
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
leaq -0x50(%rbp), %r12
je 0x10326
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0x1033b
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3250
movl -0x58(%rbp), %r14d
decl %r14d
jmp 0x10034
movq %rsp, %r14
movq -0x90(%rbp), %rax
movq -0x88(%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 0x1038a
leaq -0x8(%rbx), %rdx
andq $-0x8, %rdx
addq $0x8, %rdx
movq %r15, %rdi
xorl %esi, %esi
callq 0x3140
movq -0x90(%rbp), %rax
movq -0x88(%rbp), %rcx
subq %rax, %rcx
je 0x103b5
sarq $0x3, %rcx
xorl %edx, %edx
movq (%rax,%rdx,8), %rsi
movq %rsi, (%r15,%rdx,8)
incq %rdx
movl %edx, %esi
cmpq %rsi, %rcx
ja 0x103a3
movq -0x68(%rbp), %rdx
movq -0x70(%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 0x103f0
sarq $0x2, %rax
xorl %edx, %edx
movl $0x1, (%rcx,%rdx,4)
incq %rdx
movl %edx, %esi
cmpq %rsi, %rax
ja 0x103df
shlq $0x1d, %rbx
sarq $0x1d, %rbx
addq %r15, %rbx
subq $0x8, %rsp
movq -0x98(%rbp), %rdi
movq %r15, %rsi
movq %rbx, %rdx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %r12
callq 0x8600
addq $0x10, %rsp
movq %r14, %rsp
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x10442
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0xf8(%rbp), %rdi
leaq -0xe8(%rbp), %rax
cmpq %rax, %rdi
je 0x10464
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x10486
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x1049b
movq -0x60(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x104b3
movq -0x80(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
leaq -0x320(%rbp), %rdi
callq 0x3090
movq -0x98(%rbp), %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2686(%rip), %rdi      # 0x12b62
callq 0x3310
leaq 0x267a(%rip), %rdi      # 0x12b62
callq 0x3150
leaq 0x266e(%rip), %rdi      # 0x12b62
callq 0x3310
leaq 0x2662(%rip), %rdi      # 0x12b62
callq 0x3150
jmp 0x10534
jmp 0x10539
jmp 0x10539
jmp 0x10534
movq %rax, %r14
jmp 0x1055e
jmp 0x10534
movq %rax, %r14
cmpl $0x0, (%r15)
jne 0x1052e
movl %ebx, (%r15)
jmp 0x1052e
movq %rax, %r14
cmpl $0x0, (%r15)
jne 0x1052e
movl %r13d, (%r15)
leaq -0x40(%rbp), %rbx
jmp 0x1053c
movq %rax, %r14
jmp 0x10573
movq %rax, %r14
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x1055e
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0x10573
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x10595
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0xf8(%rbp), %rdi
leaq -0xe8(%rbp), %rax
cmpq %rax, %rdi
je 0x105b7
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x105d9
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x105ee
movq -0x60(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x10606
movq -0x80(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
leaq -0x320(%rbp), %rdi
callq 0x3090
movq %r14, %rdi
callq 0x3400