// File: /workspace/github_cpp_makefile_star2_O1/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 0x105ec
andb -0x54(%rbp), %cl
jne 0x105ec
movl %r14d, -0x58(%rbp)
movl $0x1, %ecx
movq %r12, %rdi
leaq -0xd8(%rbp), %rsi
xorl %edx, %edx
callq 0x3270
movq %r12, %rdi
leaq 0x279b(%rip), %rsi      # 0x12ae3
callq 0x30b0
movl %eax, %r14d
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0x10365
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3250
testl %r14d, %r14d
je 0x105e0
movl $0x1, %ecx
leaq -0xd8(%rbp), %r14
movq %r14, %rdi
leaq 0x2176(%rip), %r15      # 0x124fa
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, 0x8102(%rip)      # 0x184d3
jne 0x10489
movl $0xa, %edx
movq 0x7bed(%rip), %rdi      # 0x17fd0
leaq 0x2722(%rip), %rsi      # 0x12b0c
callq 0x32a0
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq 0x7bd2(%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 0x7b97(%rip), %rdi      # 0x17fd0
leaq 0x26d7(%rip), %rsi      # 0x12b17
callq 0x32a0
movq -0xb8(%rbp), %rsi
movq -0xb0(%rbp), %rdx
movq 0x7b76(%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 0x107a6
movq %rax, %r12
addq $-0x80000000, %rax      # imm = 0x80000000
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jb 0x10782
movl (%r15), %eax
cmpl $0x22, %eax
je 0x10782
testl %eax, %eax
leaq -0x30(%rbp), %rsi
jne 0x104ec
movl %r13d, (%r15)
movq -0xb8(%rbp), %r13
movl (%r15), %ebx
movl $0x0, (%r15)
movq %r13, %rdi
movl $0xa, %edx
callq 0x32f0
cmpq %r13, -0x30(%rbp)
je 0x1078e
movq %rax, %r14
addq $-0x80000000, %rax      # imm = 0x80000000
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jb 0x1079a
movl (%r15), %eax
cmpl $0x22, %eax
je 0x1079a
testl %eax, %eax
jne 0x10543
movl %ebx, (%r15)
movl $0x1, -0x30(%rbp)
movq -0x68(%rbp), %rsi
cmpq -0x60(%rbp), %rsi
je 0x10573
movl $0x1, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x68(%rbp)
leaq -0x40(%rbp), %rbx
leaq -0x320(%rbp), %r15
leaq -0x30(%rbp), %r13
jmp 0x1058e
leaq -0x70(%rbp), %rdi
leaq -0x30(%rbp), %r13
movq %r13, %rdx
leaq -0x40(%rbp), %rbx
callq 0x10b5e
leaq -0x320(%rbp), %r15
movl %r12d, -0x30(%rbp)
movl %r14d, -0x2c(%rbp)
leaq -0x90(%rbp), %rdi
movq %r13, %rsi
callq 0x109e8
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
leaq -0x50(%rbp), %r12
je 0x105cb
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0x105e0
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3250
movl -0x58(%rbp), %r14d
decl %r14d
jmp 0x102d9
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 0x1062f
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 0x10662
sarq $0x3, %rcx
xorl %edx, %edx
movl (%rax,%rdx,8), %esi
movl %esi, (%r15,%rdx,8)
movl 0x4(%rax,%rdx,8), %esi
movl %esi, 0x4(%r15,%rdx,8)
incq %rdx
movl %edx, %esi
cmpq %rsi, %rcx
ja 0x10648
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 0x1069d
sarq $0x2, %rax
xorl %edx, %edx
movl $0x1, (%rcx,%rdx,4)
incq %rdx
movl %edx, %esi
cmpq %rsi, %rax
ja 0x1068c
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 0x8758
addq $0x10, %rsp
movq %r14, %rsp
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x106ef
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0xf8(%rbp), %rdi
leaq -0xe8(%rbp), %rax
cmpq %rax, %rdi
je 0x10711
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x10733
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x10748
movq -0x60(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x10760
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 0x2399(%rip), %rdi      # 0x12b22
callq 0x3310
leaq 0x238d(%rip), %rdi      # 0x12b22
callq 0x3150
leaq 0x2381(%rip), %rdi      # 0x12b22
callq 0x3310
leaq 0x2375(%rip), %rdi      # 0x12b22
callq 0x3150
jmp 0x107e1
jmp 0x107e6
jmp 0x107e6
jmp 0x107e1
movq %rax, %r14
jmp 0x1080b
jmp 0x107e1
movq %rax, %r14
cmpl $0x0, (%r15)
jne 0x107db
movl %ebx, (%r15)
jmp 0x107db
movq %rax, %r14
cmpl $0x0, (%r15)
jne 0x107db
movl %r13d, (%r15)
leaq -0x40(%rbp), %rbx
jmp 0x107e9
movq %rax, %r14
jmp 0x10820
movq %rax, %r14
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x1080b
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0x10820
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x10842
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0xf8(%rbp), %rdi
leaq -0xe8(%rbp), %rax
cmpq %rax, %rdi
je 0x10864
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x10886
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x70(%rbp), %rdi
testq %rdi, %rdi
je 0x1089b
movq -0x60(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
movq -0x90(%rbp), %rdi
testq %rdi, %rdi
je 0x108b3
movq -0x80(%rbp), %rsi
subq %rdi, %rsi
callq 0x3250
leaq -0x320(%rbp), %rdi
callq 0x3090
movq %r14, %rdi
callq 0x3400
nop