// File: /workspace/github_cpp_makefile_star2_O2/flastest[P]HeterogeneousParallelDijkstra/parallel_workloads.cc
// Function: test_a_graph(bool, int)
int test_a_graph(bool TEST_DEBUG, int num_threads)
{
	if (TEST_DEBUG) std::cout<<"loading graph from a graph"<<std::endl;
	graph_t g = cit_graph_from_file("a_graph.txt",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 -1;
		}
		
		//not sure if I need to check predecessors because they might be different
	}
	std::cout<< "results are" << print_dijkstra_results(g, parallel_results) <<std::endl;
	std::cout<<"test a graph took " << t << "microseconds"<<std::endl;
	return t;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movl %esi, %ebp
movl %edi, %ebx
testl %edi, %edi
je 0x7db9
movq 0xf223(%rip), %rdi      # 0x16fc8
leaq 0x655a(%rip), %rsi      # 0xe306
callq 0x4290
movq %rax, %rdi
callq 0x4150
leaq 0x6561(%rip), %rsi      # 0xe321
leaq 0x60(%rsp), %rdi
leaq 0xe8(%rsp), %rdx
callq 0x8ab4
leaq 0x80(%rsp), %rdi
leaq 0x60(%rsp), %rsi
pushq $0x1
popq %rdx
callq 0xd6d0
leaq 0x60(%rsp), %rdi
callq 0x4120
leaq 0x80(%rsp), %r13
movq 0x20(%r13), %r15
subq 0x18(%r13), %r15
leaq 0x40(%rsp), %r12
movq $0x1, (%r12)
leaq 0xf0(%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 0xb8(%rsp), %rdi
leaq 0xe8(%rsp), %rcx
movq %r13, %rsi
movq %r12, %rdx
movl %ebp, %r8d
callq 0xba1d
shrq $0x5, %r15
callq 0x4050
subq %r14, %rax
movl $0x3e8, %ecx            # imm = 0x3E8
cqto
idivq %rcx
movq %rax, %r14
movslq %r15d, %rsi
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x899c
leaq 0x180(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x89ee
movq 0x40(%rsp), %rdx
leaq 0x28(%rsp), %rdi
leaq 0x180(%rsp), %rsi
leaq 0x48(%rsp), %rcx
callq 0x4a63
cvtsi2ss %r14, %xmm0
movss %xmm0, 0x4(%rsp)
leaq 0x180(%rsp), %rdi
callq 0x8a32
xorl %r14d, %r14d
testl %r15d, %r15d
cmovlel %r14d, %r15d
leaq 0xb8(%rsp), %rbp
leaq 0x8(%rsp), %r12
cmpq %r14, %r15
je 0x7fcb
testb %bl, %bl
je 0x7f6d
movq 0xf0d4(%rip), %rdi      # 0x16fc8
leaq 0x63a9(%rip), %rsi      # 0xe2a4
callq 0x4290
movq %rax, %rdi
movl %r14d, %esi
callq 0x4460
movq %rax, %rdi
callq 0x4150
movq 0xf0ae(%rip), %rdi      # 0x16fc8
leaq 0x6390(%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 0x61eb(%rip), %rsi      # 0xe13a
callq 0x4290
movq 0x28(%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 0x28(%rsp), %rcx
cvtsi2ssl (%rcx,%r14,4), %xmm0
movss (%rax), %xmm1
ucomiss %xmm0, %xmm1
jne 0x7f93
jnp 0x7fc3
movq %r14, 0x8(%rsp)
movq %rbp, %rdi
movq %r12, %rsi
callq 0x88ac
movss (%rax), %xmm0
ucomiss 0x6172(%rip), %xmm0     # 0xe120
jae 0x7fc3
movq 0x28(%rsp), %rax
cmpl $0x7fffffff, (%rax,%r14,4) # imm = 0x7FFFFFFF
jne 0x809e
incq %r14
jmp 0x7edc
movq 0xeff6(%rip), %rdi      # 0x16fc8
leaq 0x6354(%rip), %rsi      # 0xe32d
callq 0x4290
movq %rax, %rbx
leaq 0x148(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x89ee
leaq 0x118(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x8cba
leaq 0x8(%rsp), %rdi
leaq 0x148(%rsp), %rsi
leaq 0x118(%rsp), %rdx
callq 0x4886
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x4250
movq %rax, %rdi
callq 0x4150
leaq 0x8(%rsp), %rdi
callq 0x4120
leaq 0x118(%rsp), %rdi
callq 0x8ef0
leaq 0x148(%rsp), %rdi
callq 0x8a32
movq 0xef63(%rip), %rdi      # 0x16fc8
leaq 0x62cd(%rip), %rsi      # 0xe339
callq 0x4290
movq %rax, %rdi
movss 0x4(%rsp), %xmm0
callq 0x4200
leaq 0x624c(%rip), %rsi      # 0xe2d2
movq %rax, %rdi
callq 0x4290
movq %rax, %rdi
callq 0x4150
cvttss2si 0x4(%rsp), %ebx
jmp 0x80a1
pushq $-0x1
popq %rbx
leaq 0x28(%rsp), %rdi
callq 0x930c
leaq 0x48(%rsp), %rdi
callq 0x9c58
leaq 0xb8(%rsp), %rdi
callq 0x8ef0
leaq 0xe8(%rsp), %rdi
callq 0x8fb4
leaq 0x80(%rsp), %rdi
callq 0x8a32
movl %ebx, %eax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x813e
movq %rax, %rbx
jmp 0x814b
jmp 0x8162
movq %rax, %rbx
leaq 0x180(%rsp), %rdi
callq 0x8a32
jmp 0x816f
movq %rax, %rbx
jmp 0x816f
movq %rax, %rbx
jmp 0x8179
movq %rax, %rbx
jmp 0x8186
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x4120
jmp 0x81a0
movq %rax, %rbx
jmp 0x81a0
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4120
leaq 0x118(%rsp), %rdi
callq 0x8ef0
leaq 0x148(%rsp), %rdi
callq 0x8a32
jmp 0x8165
jmp 0x8162
jmp 0x8162
jmp 0x8162
jmp 0x8162
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x930c
leaq 0x48(%rsp), %rdi
callq 0x9c58
leaq 0xb8(%rsp), %rdi
callq 0x8ef0
leaq 0xe8(%rsp), %rdi
callq 0x8fb4
leaq 0x80(%rsp), %rdi
callq 0x8a32
movq %rbx, %rdi
callq 0x4470