// File: /workspace/github_cpp_makefile_star2_O2/flastest[P]HeterogeneousParallelDijkstra/parallel_workloads.cc
// Function: test_DOTA(bool, int)
bool test_DOTA(bool TEST_DEBUG, int num_threads){
	//aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah
	if (TEST_DEBUG) std::cout<<"loading graph from BBO"<<std::endl;
	graph_t g = graph_from_file("DotaLeague/DotaLeague_Edge_Basic",true);
	
	//number of nodes in g
	int num_nodes = num_vertices(g);


	//get a source node...
	vertex_descriptor s = vertex(1, g);

	predecessor_map_t pred;

	auto startTime = chrono::high_resolution_clock::now();
	distance_map_t parallel_results = parallel_dijkstra(g, s, pred, num_threads);
	auto endTime = chrono::high_resolution_clock::now();

	float t = chrono::duration_cast<std::chrono::microseconds>( endTime - startTime ).count();

	std::vector<vertex_descriptor> p_BGL(num_nodes);

	std::vector<int> BGL_results = testBGL ( g,  s, p_BGL);
	
	
	for (int i = 0 ; i < num_nodes; i++)
	{
		if(TEST_DEBUG)
		{	
			std::cout<<"test number "<<i<<std::endl;
			std::cout<<"comparing " <<parallel_results[i] <<" and "<<BGL_results[i]<<std::endl;
		}
		if(parallel_results[i] != BGL_results[i])
		{
			if(parallel_results[i] != INFINITY && BGL_results[i] !=  2147483647) return false;
		}
		
		//not sure if I need to check predecessors because they might be different
	}

	std::cout<<"test dota graph took " << t << "microseconds"<<std::endl;
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movl %esi, %ebp
movl %edi, %ebx
testl %edi, %edi
je 0x7782
movq 0xf85a(%rip), %rdi      # 0x16fc8
leaq 0x6af7(%rip), %rsi      # 0xe26c
callq 0x4290
movq %rax, %rdi
callq 0x4150
leaq 0x6afa(%rip), %rsi      # 0xe283
leaq 0x58(%rsp), %rdi
leaq 0x78(%rsp), %rdx
callq 0x8ab4
leaq 0xa8(%rsp), %rdi
leaq 0x58(%rsp), %rsi
pushq $0x1
popq %rdx
callq 0xd0eb
leaq 0x58(%rsp), %rdi
callq 0x4120
leaq 0xa8(%rsp), %r15
movq 0x20(%r15), %r13
subq 0x18(%r15), %r13
leaq 0x38(%rsp), %r12
movq $0x1, (%r12)
leaq 0x80(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
callq 0x4050
movq %rax, %r14
leaq 0xe0(%rsp), %rdi
leaq 0x78(%rsp), %rcx
movq %r15, %rsi
movq %r12, %rdx
movl %ebp, %r8d
callq 0xba1d
shrq $0x5, %r13
callq 0x4050
subq %r14, %rax
movl $0x3e8, %ecx            # imm = 0x3E8
cqto
idivq %rcx
movq %rax, %r14
movslq %r13d, %rsi
leaq 0x40(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x899c
leaq 0x110(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x89ee
movq 0x38(%rsp), %rdx
leaq 0x18(%rsp), %rdi
leaq 0x110(%rsp), %rsi
leaq 0x40(%rsp), %rcx
callq 0x4a63
cvtsi2ss %r14, %xmm0
movss %xmm0, 0x14(%rsp)
leaq 0x110(%rsp), %rdi
callq 0x8a32
xorl %r14d, %r14d
testl %r13d, %r13d
movl $0x0, %r15d
movq %r13, 0x30(%rsp)
cmovgl %r13d, %r15d
leaq 0xe0(%rsp), %rbp
leaq 0x8(%rsp), %r12
cmpq %r14, %r15
je 0x7995
testb %bl, %bl
je 0x793b
movq 0xf706(%rip), %rdi      # 0x16fc8
leaq 0x69db(%rip), %rsi      # 0xe2a4
callq 0x4290
movq %rax, %rdi
movl %r14d, %esi
callq 0x4460
movq %rax, %rdi
callq 0x4150
movq 0xf6e0(%rip), %rdi      # 0x16fc8
leaq 0x69c2(%rip), %rsi      # 0xe2b1
callq 0x4290
movq %rax, %r13
movq %r14, 0x8(%rsp)
movq %rbp, %rdi
movq %r12, %rsi
callq 0x88ac
movss (%rax), %xmm0
movq %r13, %rdi
callq 0x4200
movq %rax, %rdi
leaq 0x681d(%rip), %rsi      # 0xe13a
callq 0x4290
movq 0x18(%rsp), %rcx
movl (%rcx,%r14,4), %esi
movq %rax, %rdi
callq 0x4460
movq %rax, %rdi
callq 0x4150
movq %r14, 0x8(%rsp)
movq %rbp, %rdi
movq %r12, %rsi
callq 0x88ac
movq 0x18(%rsp), %rcx
cvtsi2ssl (%rcx,%r14,4), %xmm0
movss (%rax), %xmm1
ucomiss %xmm0, %xmm1
jne 0x7961
jnp 0x798d
movq %r14, 0x8(%rsp)
movq %rbp, %rdi
movq %r12, %rsi
callq 0x88ac
movss (%rax), %xmm0
ucomiss 0x67a4(%rip), %xmm0     # 0xe120
jae 0x798d
movq 0x18(%rsp), %rax
cmpl $0x7fffffff, (%rax,%r14,4) # imm = 0x7FFFFFFF
jne 0x79cd
incq %r14
jmp 0x78aa
movq 0xf62c(%rip), %rdi      # 0x16fc8
leaq 0x6919(%rip), %rsi      # 0xe2bc
callq 0x4290
movq %rax, %rdi
movss 0x14(%rsp), %xmm0
callq 0x4200
leaq 0x6915(%rip), %rsi      # 0xe2d2
movq %rax, %rdi
callq 0x4290
movq %rax, %rdi
callq 0x4150
movslq 0x30(%rsp), %rax
cmpq %rax, %r14
setge %bl
leaq 0x18(%rsp), %rdi
callq 0x930c
leaq 0x40(%rsp), %rdi
callq 0x9c58
leaq 0xe0(%rsp), %rdi
callq 0x8ef0
leaq 0x78(%rsp), %rdi
callq 0x8fb4
leaq 0xa8(%rsp), %rdi
callq 0x8a32
movl %ebx, %eax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
callq 0x8a32
jmp 0x7a6e
movq %rax, %rbx
jmp 0x7a6e
movq %rax, %rbx
jmp 0x7a78
movq %rax, %rbx
jmp 0x7a85
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x4120
jmp 0x7a9c
movq %rax, %rbx
jmp 0x7a9c
jmp 0x7a61
jmp 0x7a61
jmp 0x7a61
jmp 0x7a61
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x930c
leaq 0x40(%rsp), %rdi
callq 0x9c58
leaq 0xe0(%rsp), %rdi
callq 0x8ef0
leaq 0x78(%rsp), %rdi
callq 0x8fb4
leaq 0xa8(%rsp), %rdi
callq 0x8a32
movq %rbx, %rdi
callq 0x4470