// File: /workspace/github_cpp_makefile_star2_O1/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 $0x1c8, %rsp            # imm = 0x1C8
movl %esi, %ebx
movl %edi, 0xc(%rsp)
testl %edi, %edi
je 0x8b3b
movq 0xe4d0(%rip), %r14      # 0x16fd0
leaq 0x77cf(%rip), %rsi      # 0x102d6
movl $0x1a, %edx
movq %r14, %rdi
callq 0x3300
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31d0
leaq 0x80(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x77a3(%rip), %rsi      # 0x102f1
leaq 0x77a7(%rip), %rdx      # 0x102fc
leaq 0x70(%rsp), %r14
movq %r14, %rdi
callq 0xa2a8
leaq 0x90(%rsp), %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0xeaf0
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x8b91
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x32b0
leaq 0x90(%rsp), %r15
movq 0x20(%r15), %rbp
subq 0x18(%r15), %rbp
leaq 0x68(%rsp), %r12
movq $0x1, (%r12)
leaq 0x1a0(%rsp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
callq 0x3060
movq %rax, %r14
leaq 0xc8(%rsp), %rdi
leaq 0x198(%rsp), %rcx
movq %r15, %rsi
movq %r12, %rdx
movl %ebx, %r8d
callq 0xc863
shrq $0x5, %rbp
callq 0x3060
subq %r14, %rax
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
imulq %rcx
movq %rdx, 0x48(%rsp)
movslq %ebp, %rsi
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x9c80
leaq 0x130(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x9d0a
movq 0x68(%rsp), %rdx
leaq 0x30(%rsp), %rdi
leaq 0x130(%rsp), %r14
leaq 0x50(%rsp), %rcx
movq %r14, %rsi
callq 0x4146
movq 0x160(%rsp), %rdi
testq %rdi, %rdi
je 0x8c6f
movl $0x1, %esi
callq 0x32b0
leaq 0x148(%rsp), %rbx
movq %rbx, %rdi
callq 0x9f26
movq -0x18(%rbx), %rdi
cmpq %r14, %rdi
je 0x8c9d
movq (%rdi), %rbx
movl $0x28, %esi
callq 0x32b0
movq %rbx, %rdi
cmpq %r14, %rbx
jne 0x8c88
testl %ebp, %ebp
jle 0x8e00
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
xorl %r15d, %r15d
movq 0xe31b(%rip), %r12      # 0x16fd0
leaq 0xc8(%rsp), %r13
leaq 0x10(%rsp), %r14
cmpb $0x0, 0xc(%rsp)
je 0x8d9b
movl $0xc, %edx
movq %r12, %rdi
leaq 0x7598(%rip), %rsi      # 0x10274
callq 0x3300
movq %r12, %rdi
movl %r15d, %esi
callq 0x3480
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31d0
movl $0xa, %edx
movq %r12, %rdi
leaq 0x755c(%rip), %rsi      # 0x10281
callq 0x3300
movq %r15, 0x10(%rsp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x9b4c
xorps %xmm0, %xmm0
cvtss2sd (%rax), %xmm0
movq %r12, %rdi
callq 0x33f0
movq %rax, %rbx
movl $0x5, %edx
movq %rax, %rdi
leaq 0x73af(%rip), %rsi      # 0x1010a
callq 0x3300
movq 0x30(%rsp), %rax
movl (%rax,%r15,4), %esi
movq %rbx, %rdi
callq 0x3480
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31d0
movq %r15, 0x10(%rsp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x9b4c
movq 0x30(%rsp), %rcx
xorps %xmm0, %xmm0
cvtsi2ssl (%rcx,%r15,4), %xmm0
movss (%rax), %xmm1
ucomiss %xmm0, %xmm1
jne 0x8dc4
jnp 0x8df4
movq %r15, 0x10(%rsp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x9b4c
movss (%rax), %xmm0
ucomiss 0x7311(%rip), %xmm0     # 0x100f0
jae 0x8df4
movq 0x30(%rsp), %rax
cmpl $0x7fffffff, (%rax,%r15,4) # imm = 0x7FFFFFFF
jne 0x903f
incq %r15
cmpq %r15, %rbp
jne 0x8cc2
movq 0xe1c9(%rip), %rdi      # 0x16fd0
leaq 0x74ef(%rip), %rsi      # 0x102fd
movl $0xb, %edx
callq 0x3300
leaq 0xf8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x9d0a
leaq 0x168(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x9fb2
leaq 0x10(%rsp), %rdi
leaq 0xf8(%rsp), %r14
leaq 0x168(%rsp), %rdx
movq %r14, %rsi
callq 0x3adc
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0xe160(%rip), %rdi      # 0x16fd0
callq 0x3300
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31d0
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8eba
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32b0
leaq 0x168(%rsp), %rdi
callq 0xa186
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x8ede
movl $0x1, %esi
callq 0x32b0
leaq 0x110(%rsp), %rbx
movq %rbx, %rdi
callq 0x9f26
movq -0x18(%rbx), %rdi
cmpq %r14, %rdi
je 0x8f0c
movq (%rdi), %rbx
movl $0x28, %esi
callq 0x32b0
movq %rbx, %rdi
cmpq %r14, %rbx
jne 0x8ef7
movq 0xe0bd(%rip), %rdi      # 0x16fd0
leaq 0x73ef(%rip), %rsi      # 0x10309
movl $0x12, %edx
callq 0x3300
movq 0x48(%rsp), %rcx
movq %rcx, %rax
shrq $0x3f, %rax
sarq $0x7, %rcx
addq %rax, %rcx
cvtsi2ss %rcx, %xmm0
movss %xmm0, 0xc(%rsp)
cvtss2sd %xmm0, %xmm0
movq 0xe083(%rip), %rdi      # 0x16fd0
callq 0x33f0
movq %rax, %r14
leaq 0x7346(%rip), %rsi      # 0x102a2
movl $0xc, %edx
movq %rax, %rdi
callq 0x3300
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31d0
cvttss2si 0xc(%rsp), %ebp
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x8fad
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x8fc4
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
leaq 0xa8(%rsp), %r14
leaq 0xc8(%rsp), %rdi
callq 0xa186
leaq 0x198(%rsp), %rdi
callq 0xa1c8
movq 0x18(%r14), %rdi
testq %rdi, %rdi
je 0x8ff9
movl $0x1, %esi
callq 0x32b0
movq %r14, %rdi
callq 0x9f26
movq 0x90(%rsp), %rdi
leaq 0x90(%rsp), %r14
cmpq %r14, %rdi
je 0x902b
movq (%rdi), %rbx
movl $0x28, %esi
callq 0x32b0
movq %rbx, %rdi
cmpq %r14, %rbx
jne 0x9016
movl %ebp, %eax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x8f96
movq %rax, %rbx
jmp 0x90cc
movq %rax, %rbx
jmp 0x90d9
jmp 0x90f0
movq %rax, %rbx
leaq 0x130(%rsp), %rdi
callq 0x9da4
jmp 0x910a
movq %rax, %rbx
jmp 0x910a
movq %rax, %rbx
jmp 0x9121
movq %rax, %rbx
jmp 0x912e
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x9148
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x9148
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x90cc
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32b0
leaq 0x168(%rsp), %rdi
callq 0xa186
leaq 0xf8(%rsp), %rdi
callq 0x9da4
jmp 0x90f3
jmp 0x90f0
jmp 0x90f0
jmp 0x90f0
jmp 0x90f0
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x910a
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x9121
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x32b0
leaq 0xc8(%rsp), %rdi
callq 0xa186
leaq 0x198(%rsp), %rdi
callq 0xa1c8
leaq 0x90(%rsp), %rdi
callq 0x9da4
movq %rbx, %rdi
callq 0x34a0