// File: /workspace/github_cpp_makefile_star2_O2/flastest[P]HeterogeneousParallelDijkstra/parallel_workloads.cc
// Function: test1(bool, int)
bool test1 (bool TEST_DEBUG, int num_threads)
{
	const int num_nodes = 5;
	enum nodes { A, B, C, D, E };
	//char name[] = "ABCDE";
	Edge edge_array[] = { 
			Edge(A, B), Edge(A, C), Edge(A, D), 
			Edge(B, A), Edge(B, D), Edge(B, E), 
			Edge(C, A), Edge(C, D), 
			Edge(D, A), Edge(D, B), Edge(D, C), Edge(D, E), 
			Edge(E, B), Edge(E, D)
	};
	int weights[] = { 
		12, 2, 10, 
		12, 3, 1, 
		2, 4,
		10, 3, 4, 5,
		1, 5
	};
	int num_arcs = sizeof(edge_array) / sizeof(Edge);

	//the graph
	graph_t g(edge_array, edge_array + num_arcs, weights, num_nodes);

	// Keeps track of the predecessor of each vertex
	predecessor_map_t p;
	

	// Keeps track of the distance to each vertex
	std::vector<int> d(num_vertices(g));



	// test1a, with source A.
	vertex_descriptor s = vertex(A, g);

	auto distances = dijkstra_algorithm(g, s, p, num_threads);

	std::vector<vertex_descriptor> p_BGL(num_nodes);

	vector<int> true_distances = testBGL ( g,  s, p_BGL);
//	vector<int> true_distances = {0,9,2,6,10};
	
	//this needs to iterate thru the vectors

	for (int i = 0; i < 5; i++)
	{
		if (distances[vertex(i, g)] != true_distances[i]){
			return false;
		}
	}
	if (TEST_DEBUG) cout << "test1a\n" << print_dijkstra_results(g,distances);

	//test1b with source B
	s = vertex(B, g);
	distances = dijkstra_algorithm(g, s, p, num_threads);

	true_distances = {9,0,7,3,1};
	for (int i = 0; i < 5; i++)
	{
		if (distances[vertex(i,g)] != true_distances[i]){
			return false;
		}
	}
	if (TEST_DEBUG) cout << "test1b\n" << print_dijkstra_results(g,distances);


	//test1c with source C
	s = vertex(C, g);
	distances = dijkstra_algorithm(g, s, p, num_threads);

	true_distances = {2,7,0,4,8};
	for (int i = 0; i < 5; i++)
	{
		if (distances[vertex(i,g)] != true_distances[i]){
			return false;
		}
	}
	if (TEST_DEBUG) cout << "test1c\n" << print_dijkstra_results(g,distances);



	//test1d with source D
	s = vertex(D, g);
	distances = dijkstra_algorithm(g, s, p, num_threads);

	true_distances = {6,3,4,0,4};
	for (int i = 0; i < 5; i++)
	{
		if (distances[vertex(i,g)] != true_distances[i]){
			return false;
		}
	}
	if (TEST_DEBUG) cout << "test1d\n" << print_dijkstra_results(g,distances);

	//test1e with source E
	s = vertex(E, g);
	distances = dijkstra_algorithm(g, s, p, num_threads);

	true_distances = {10,1,8,4,0};
	for (int i = 0; i < 5; i++)
	{
		if (distances[vertex(i,g)] != true_distances[i]){
			return false;
		}
	}
	if (TEST_DEBUG) cout << "test1e\n" << print_dijkstra_results(g,distances);



	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x420, %rsp            # imm = 0x420
movl %esi, %ebp
movl %edi, %ebx
movaps 0x951e(%rip), %xmm0     # 0xe010
leaq 0x420(%rsp), %rdx
movaps %xmm0, -0x70(%rdx)
movaps 0x951b(%rip), %xmm0     # 0xe020
movaps %xmm0, -0x60(%rdx)
movaps 0x9520(%rip), %xmm0     # 0xe030
movaps %xmm0, -0x50(%rdx)
movaps 0x9525(%rip), %xmm0     # 0xe040
movaps %xmm0, -0x40(%rdx)
movaps 0x952a(%rip), %xmm0     # 0xe050
movaps %xmm0, -0x30(%rdx)
movaps 0x952f(%rip), %xmm0     # 0xe060
movaps %xmm0, -0x20(%rdx)
movaps 0x9534(%rip), %xmm0     # 0xe070
movaps %xmm0, -0x10(%rdx)
movaps 0xab29(%rip), %xmm0     # 0xf670
leaq 0x370(%rsp), %rcx
movaps %xmm0, 0x20(%rcx)
movaps 0xab06(%rip), %xmm0     # 0xf660
movaps %xmm0, 0x10(%rcx)
movaps 0xaaeb(%rip), %xmm0     # 0xf650
movaps %xmm0, (%rcx)
movabsq $0x500000001, %rax      # imm = 0x500000001
movq %rax, 0x30(%rcx)
leaq 0xd0(%rsp), %rax
movq %rax, (%rsp)
leaq 0x98(%rsp), %r14
leaq 0x3b0(%rsp), %rsi
pushq $0x5
popq %r8
movq %r14, %rdi
xorl %r9d, %r9d
callq 0x895a
leaq 0xd8(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq 0x20(%r14), %rsi
subq 0x18(%r14), %rsi
sarq $0x5, %rsi
leaq 0x118(%rsp), %rdi
leaq 0x68(%rsp), %rdx
callq 0x88fc
leaq 0x48(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0x68(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0xd0(%rsp), %rcx
movl %ebp, %r8d
callq *0x1267d(%rip)          # 0x17280
leaq 0x100(%rsp), %rdi
pushq $0x5
popq %rsi
leaq 0x10(%rsp), %rdx
callq 0x899c
leaq 0x338(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x89ee
movq 0x48(%rsp), %rdx
leaq 0x50(%rsp), %rdi
leaq 0x338(%rsp), %rsi
leaq 0x100(%rsp), %rcx
callq 0x4a63
leaq 0x338(%rsp), %rdi
callq 0x8a32
xorl %r12d, %r12d
leaq 0x68(%rsp), %r14
leaq 0x10(%rsp), %r15
cmpq $0x5, %r12
je 0x4c9e
movq %r12, 0x10(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x88ac
movq 0x50(%rsp), %rcx
cvtsi2ssl (%rcx,%r12,4), %xmm0
movss (%rax), %xmm1
incq %r12
ucomiss %xmm0, %xmm1
jne 0x5196
jnp 0x4c66
jmp 0x5196
testb %bl, %bl
je 0x4d2e
movq 0x1231b(%rip), %rdi     # 0x16fc8
leaq 0x9518(%rip), %rsi      # 0xe1cc
callq 0x4290
movq %rax, %r14
leaq 0x300(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x89ee
leaq 0x1f0(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x8cba
leaq 0x10(%rsp), %rdi
leaq 0x300(%rsp), %rsi
leaq 0x1f0(%rsp), %rdx
callq 0x4886
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x4250
leaq 0x10(%rsp), %rdi
callq 0x4120
leaq 0x1f0(%rsp), %rdi
callq 0x8ef0
leaq 0x300(%rsp), %rdi
callq 0x8a32
leaq 0x48(%rsp), %rdx
movq $0x1, (%rdx)
leaq 0x10(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0xd0(%rsp), %rcx
movl %ebp, %r8d
callq *0x12528(%rip)          # 0x17280
leaq 0x68(%rsp), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0x8f04
movq %r14, %rdi
callq 0x8ef0
movups 0xa90f(%rip), %xmm0     # 0xf688
movaps %xmm0, (%r14)
movl $0x1, 0x10(%r14)
leaq 0x24(%rsp), %rdx
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xb162
xorl %r12d, %r12d
leaq 0x68(%rsp), %r14
leaq 0x10(%rsp), %r15
cmpq $0x5, %r12
je 0x4dde
movq %r12, 0x10(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x88ac
movq 0x50(%rsp), %rcx
cvtsi2ssl (%rcx,%r12,4), %xmm0
movss (%rax), %xmm1
incq %r12
ucomiss %xmm0, %xmm1
jne 0x5196
jnp 0x4da6
jmp 0x5196
testb %bl, %bl
je 0x4e6e
movq 0x121db(%rip), %rdi     # 0x16fc8
leaq 0x93e0(%rip), %rsi      # 0xe1d4
callq 0x4290
movq %rax, %r14
leaq 0x2c8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x89ee
leaq 0x1c0(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x8cba
leaq 0x10(%rsp), %rdi
leaq 0x2c8(%rsp), %rsi
leaq 0x1c0(%rsp), %rdx
callq 0x4886
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x4250
leaq 0x10(%rsp), %rdi
callq 0x4120
leaq 0x1c0(%rsp), %rdi
callq 0x8ef0
leaq 0x2c8(%rsp), %rdi
callq 0x8a32
leaq 0x48(%rsp), %rdx
movq $0x2, (%rdx)
leaq 0x10(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0xd0(%rsp), %rcx
movl %ebp, %r8d
callq *0x123e8(%rip)          # 0x17280
leaq 0x68(%rsp), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0x8f04
movq %r14, %rdi
callq 0x8ef0
movups 0xa7e3(%rip), %xmm0     # 0xf69c
movaps %xmm0, (%r14)
movl $0x8, 0x10(%r14)
leaq 0x24(%rsp), %rdx
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xb162
xorl %r12d, %r12d
leaq 0x68(%rsp), %r14
leaq 0x10(%rsp), %r15
cmpq $0x5, %r12
je 0x4f1e
movq %r12, 0x10(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x88ac
movq 0x50(%rsp), %rcx
cvtsi2ssl (%rcx,%r12,4), %xmm0
movss (%rax), %xmm1
incq %r12
ucomiss %xmm0, %xmm1
jne 0x5196
jnp 0x4ee6
jmp 0x5196
testb %bl, %bl
je 0x4fae
movq 0x1209b(%rip), %rdi     # 0x16fc8
leaq 0x92a8(%rip), %rsi      # 0xe1dc
callq 0x4290
movq %rax, %r14
leaq 0x290(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x89ee
leaq 0x190(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x8cba
leaq 0x10(%rsp), %rdi
leaq 0x290(%rsp), %rsi
leaq 0x190(%rsp), %rdx
callq 0x4886
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x4250
leaq 0x10(%rsp), %rdi
callq 0x4120
leaq 0x190(%rsp), %rdi
callq 0x8ef0
leaq 0x290(%rsp), %rdi
callq 0x8a32
leaq 0x48(%rsp), %rdx
movq $0x3, (%rdx)
leaq 0x10(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0xd0(%rsp), %rcx
movl %ebp, %r8d
callq *0x122a8(%rip)          # 0x17280
leaq 0x68(%rsp), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0x8f04
movq %r14, %rdi
callq 0x8ef0
movups 0xa6b7(%rip), %xmm0     # 0xf6b0
movaps %xmm0, (%r14)
movl $0x4, 0x10(%r14)
leaq 0x24(%rsp), %rdx
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xb162
xorl %r12d, %r12d
leaq 0x68(%rsp), %r14
leaq 0x10(%rsp), %r15
cmpq $0x5, %r12
je 0x505e
movq %r12, 0x10(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x88ac
movq 0x50(%rsp), %rcx
cvtsi2ssl (%rcx,%r12,4), %xmm0
movss (%rax), %xmm1
incq %r12
ucomiss %xmm0, %xmm1
jne 0x5196
jnp 0x5026
jmp 0x5196
testb %bl, %bl
je 0x50ee
movq 0x11f5b(%rip), %rdi     # 0x16fc8
leaq 0x9170(%rip), %rsi      # 0xe1e4
callq 0x4290
movq %rax, %r14
leaq 0x258(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x89ee
leaq 0x160(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x8cba
leaq 0x10(%rsp), %rdi
leaq 0x258(%rsp), %rsi
leaq 0x160(%rsp), %rdx
callq 0x4886
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x4250
leaq 0x10(%rsp), %rdi
callq 0x4120
leaq 0x160(%rsp), %rdi
callq 0x8ef0
leaq 0x258(%rsp), %rdi
callq 0x8a32
leaq 0x48(%rsp), %rdx
movq $0x4, (%rdx)
leaq 0x10(%rsp), %rdi
leaq 0x98(%rsp), %rsi
leaq 0xd0(%rsp), %rcx
movl %ebp, %r8d
callq *0x12168(%rip)          # 0x17280
leaq 0x68(%rsp), %rdi
leaq 0x10(%rsp), %r14
movq %r14, %rsi
callq 0x8f04
movq %r14, %rdi
callq 0x8ef0
movups 0xa66b(%rip), %xmm0     # 0xf7a4
movaps %xmm0, (%r14)
andl $0x0, 0x10(%r14)
leaq 0x24(%rsp), %rdx
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xb162
xorl %r12d, %r12d
leaq 0x68(%rsp), %r14
leaq 0x10(%rsp), %r15
cmpq $0x5, %r12
je 0x51f2
movq %r12, 0x10(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x88ac
movq 0x50(%rsp), %rcx
cvtsi2ssl (%rcx,%r12,4), %xmm0
movss (%rax), %xmm1
incq %r12
ucomiss %xmm0, %xmm1
jne 0x5196
jnp 0x5163
xorl %ebp, %ebp
leaq 0x50(%rsp), %rdi
callq 0x930c
leaq 0x100(%rsp), %rdi
callq 0x9c58
leaq 0x68(%rsp), %rdi
callq 0x8ef0
leaq 0x118(%rsp), %rdi
callq 0x930c
leaq 0xd0(%rsp), %rdi
callq 0x8fb4
leaq 0x98(%rsp), %rdi
callq 0x8a32
movl %ebp, %eax
addq $0x420, %rsp            # imm = 0x420
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %bpl
testb %bl, %bl
je 0x5198
movq 0x11dc8(%rip), %rdi     # 0x16fc8
leaq 0x8fe5(%rip), %rsi      # 0xe1ec
callq 0x4290
movq %rax, %rbx
leaq 0x220(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x89ee
leaq 0x130(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x8cba
leaq 0x10(%rsp), %rdi
leaq 0x220(%rsp), %rsi
leaq 0x130(%rsp), %rdx
callq 0x4886
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x4250
leaq 0x10(%rsp), %rdi
callq 0x4120
leaq 0x130(%rsp), %rdi
callq 0x8ef0
leaq 0x220(%rsp), %rdi
callq 0x8a32
jmp 0x5198
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x4120
jmp 0x5298
movq %rax, %rbx
leaq 0x130(%rsp), %rdi
callq 0x8ef0
jmp 0x52aa
movq %rax, %rbx
leaq 0x220(%rsp), %rdi
jmp 0x538f
jmp 0x53d0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x4120
jmp 0x52ce
movq %rax, %rbx
leaq 0x160(%rsp), %rdi
callq 0x8ef0
jmp 0x52e0
movq %rax, %rbx
leaq 0x258(%rsp), %rdi
jmp 0x538f
jmp 0x53d0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x4120
jmp 0x5304
movq %rax, %rbx
leaq 0x190(%rsp), %rdi
callq 0x8ef0
jmp 0x5316
movq %rax, %rbx
leaq 0x290(%rsp), %rdi
jmp 0x538f
jmp 0x53d0
jmp 0x53d0
jmp 0x53d0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x4120
jmp 0x5341
movq %rax, %rbx
leaq 0x1c0(%rsp), %rdi
callq 0x8ef0
jmp 0x5353
movq %rax, %rbx
leaq 0x2c8(%rsp), %rdi
jmp 0x538f
jmp 0x53d0
jmp 0x53d0
jmp 0x53d0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x4120
jmp 0x5375
movq %rax, %rbx
leaq 0x1f0(%rsp), %rdi
callq 0x8ef0
jmp 0x5387
movq %rax, %rbx
leaq 0x300(%rsp), %rdi
callq 0x8a32
jmp 0x53d3
jmp 0x53d0
jmp 0x53d0
jmp 0x53d0
jmp 0x53d0
jmp 0x53d0
jmp 0x53d0
movq %rax, %rbx
leaq 0x338(%rsp), %rdi
callq 0x8a32
jmp 0x53dd
movq %rax, %rbx
jmp 0x53dd
movq %rax, %rbx
jmp 0x53ea
movq %rax, %rbx
jmp 0x53f4
movq %rax, %rbx
jmp 0x5401
jmp 0x53d0
jmp 0x53d0
jmp 0x53d0
jmp 0x53d0
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x930c
leaq 0x100(%rsp), %rdi
callq 0x9c58
leaq 0x68(%rsp), %rdi
callq 0x8ef0
leaq 0x118(%rsp), %rdi
callq 0x930c
leaq 0xd0(%rsp), %rdi
callq 0x8fb4
leaq 0x98(%rsp), %rdi
callq 0x8a32
movq %rbx, %rdi
callq 0x4470