// File: flastest[P]HeterogeneousParallelDijkstra/workloads.cc
// Function: test2(bool)
bool test2(bool TEST_DEBUG)
{
	const int num_nodes = 3;
	enum nodes { A, B, C };
	//char name[] = "ABCDE";
	Edge edge_array[] = { 
			Edge(A, B), Edge(A, C), 
			Edge(B, A), Edge(B, C), 
			Edge(C, A), Edge(C, B)
	};
	int weights[] = { 
		0, 3,
		0, 2,
		3, 2
	};
	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));



	// test2a, with source A.
	vertex_descriptor s = vertex(A, g);

	auto distances = dijkstra_algorithm(g, s, p);

	vector<int> true_distances = {0, 0, 2};
	if (TEST_DEBUG) cout << "test2a\n" << print_dijkstra_results(g,distances);
	for (int i = 0; i < num_nodes; i++)
	{
		if (distances[vertex(i,g)] != true_distances[i]){
			return false;
		}
	}
	


	// test2b, with source B.
	s = vertex(B, g);

	distances = dijkstra_algorithm(g, s, p);

	true_distances = {0, 0, 2};
	if (TEST_DEBUG) cout << "test2b\n" << print_dijkstra_results(g,distances);
	for (int i = 0; i < num_nodes; i++)
	{
		if (distances[vertex(i,g)] != true_distances[i]){
			return false;
		}
	}
	

	// test2c, with source C.
	s = vertex(C, g);

	distances = dijkstra_algorithm(g, s, p);

	true_distances = {2, 2, 0};
	if (TEST_DEBUG) cout << "test2c\n" << print_dijkstra_results(g,distances);
	for (int i = 0; i < num_nodes; i++)
	{
		if (distances[vertex(i,g)] != true_distances[i]){
			return false;
		}
	}
	
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4d0, %rsp            # imm = 0x4D0
movb %dil, %al
andb $0x1, %al
movb %al, -0x2(%rbp)
movl $0x3, -0x8(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x1, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0x428(%rbp)
leaq -0x44(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x6b90
leaq -0x38(%rbp), %rdi
movl $0x0, -0x4c(%rbp)
movl $0x2, -0x50(%rbp)
leaq -0x4c(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x6b90
leaq -0x30(%rbp), %rdi
movl $0x1, -0x54(%rbp)
movl $0x0, -0x58(%rbp)
leaq -0x54(%rbp), %rsi
leaq -0x58(%rbp), %rdx
callq 0x6b90
leaq -0x28(%rbp), %rdi
movl $0x1, -0x5c(%rbp)
movl $0x2, -0x60(%rbp)
leaq -0x5c(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x6b90
leaq -0x20(%rbp), %rdi
movl $0x2, -0x64(%rbp)
movl $0x0, -0x68(%rbp)
leaq -0x64(%rbp), %rsi
leaq -0x68(%rbp), %rdx
callq 0x6b90
leaq -0x18(%rbp), %rdi
movl $0x2, -0x6c(%rbp)
movl $0x1, -0x70(%rbp)
leaq -0x6c(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0x6b90
movq -0x428(%rbp), %rsi
movabsq $0x200000003, %rax      # imm = 0x200000003
movq %rax, -0x80(%rbp)
movaps 0x24289(%rip), %xmm0    # 0x2a480
movaps %xmm0, -0x90(%rbp)
movl $0x6, -0x94(%rbp)
movslq -0x94(%rbp), %rax
leaq -0x40(%rbp,%rax,8), %rdx
movq %rsp, %rax
leaq -0xd1(%rbp), %rcx
movq %rcx, (%rax)
xorl %eax, %eax
movl %eax, %r9d
leaq -0xd0(%rbp), %rdi
movq %rdi, -0x420(%rbp)
leaq -0x90(%rbp), %rcx
movl $0x3, %r8d
callq 0xb180
leaq -0x108(%rbp), %rdi
callq 0xb210
movq -0x420(%rbp), %rdi
callq 0xae10
movq %rax, -0x418(%rbp)
jmp 0x6267
leaq -0x12d(%rbp), %rdi
movq %rdi, -0x430(%rbp)
callq 0xae50
movq -0x418(%rbp), %rsi
movq -0x430(%rbp), %rdx
leaq -0x120(%rbp), %rdi
callq 0xae70
jmp 0x6296
leaq -0x12d(%rbp), %rdi
callq 0xaee0
xorl %eax, %eax
movl %eax, %edi
leaq -0xd0(%rbp), %rsi
callq 0xb230
movq %rax, -0x438(%rbp)
jmp 0x62bb
movq -0x438(%rbp), %rax
movq %rax, -0x138(%rbp)
movq 0x38020(%rip), %rax     # 0x3e2f0
leaq -0x168(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
leaq -0x138(%rbp), %rdx
leaq -0x108(%rbp), %rcx
callq *%rax
jmp 0x62f0
movl $0x0, -0x19c(%rbp)
movl $0x0, -0x198(%rbp)
movl $0x2, -0x194(%rbp)
leaq -0x19c(%rbp), %rax
movq %rax, -0x190(%rbp)
movq $0x3, -0x188(%rbp)
leaq -0x19d(%rbp), %rdi
movq %rdi, -0x440(%rbp)
callq 0xae50
movq -0x440(%rbp), %rcx
movq -0x190(%rbp), %rsi
movq -0x188(%rbp), %rdx
leaq -0x180(%rbp), %rdi
callq 0xb550
jmp 0x635d
leaq -0x19d(%rbp), %rdi
callq 0xaee0
testb $0x1, -0x2(%rbp)
je 0x6501
movq 0x37c4e(%rip), %rdi     # 0x3dfc8
leaq 0x22cbd(%rip), %rsi     # 0x2903e
callq 0x4310
movq %rax, -0x448(%rbp)
jmp 0x638f
leaq -0x1f8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xb300
jmp 0x63a4
leaq -0x228(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0xb3d0
jmp 0x63b9
leaq -0x1c0(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
leaq -0x228(%rbp), %rdx
callq 0x4970
jmp 0x63d5
movq -0x448(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x42f0
jmp 0x63ea
leaq -0x1c0(%rbp), %rdi
callq 0x41e0
leaq -0x228(%rbp), %rdi
callq 0xb400
leaq -0x1f8(%rbp), %rdi
callq 0xb380
jmp 0x6501
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0x6b61
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x12d(%rbp), %rdi
callq 0xaee0
jmp 0x6b61
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0x6b55
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x19d(%rbp), %rdi
callq 0xaee0
jmp 0x6b49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0x6b3d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0x64f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0x64e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0x41e0
leaq -0x228(%rbp), %rdi
callq 0xb400
leaq -0x1f8(%rbp), %rdi
callq 0xb380
jmp 0x6b3d
movl $0x0, -0x22c(%rbp)
cmpl $0x3, -0x22c(%rbp)
jge 0x65c2
movslq -0x22c(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xb230
movq %rax, -0x450(%rbp)
jmp 0x6534
movq -0x450(%rbp), %rax
movq %rax, -0x238(%rbp)
leaq -0x168(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0xad00
movq %rax, -0x458(%rbp)
jmp 0x655e
movq -0x458(%rbp), %rax
movss (%rax), %xmm0
movss %xmm0, -0x45c(%rbp)
movslq -0x22c(%rbp), %rsi
leaq -0x180(%rbp), %rdi
callq 0xb3b0
movss -0x45c(%rbp), %xmm0
cvtsi2ssl (%rax), %xmm1
ucomiss %xmm1, %xmm0
jne 0x6599
jp 0x6599
jmp 0x65ac
movb $0x0, -0x1(%rbp)
movl $0x1, -0x23c(%rbp)
jmp 0x6af3
jmp 0x65ae
movl -0x22c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x22c(%rbp)
jmp 0x650b
movl $0x1, %edi
leaq -0xd0(%rbp), %rsi
callq 0xb230
movq %rax, -0x468(%rbp)
jmp 0x65dc
movq -0x468(%rbp), %rax
movq %rax, -0x138(%rbp)
movq 0x37cff(%rip), %rax     # 0x3e2f0
leaq -0x270(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
leaq -0x138(%rbp), %rdx
leaq -0x108(%rbp), %rcx
callq *%rax
jmp 0x6611
leaq -0x168(%rbp), %rdi
leaq -0x270(%rbp), %rsi
movq %rsi, -0x470(%rbp)
callq 0xb420
movq -0x470(%rbp), %rdi
callq 0xb400
movl $0x0, -0x28c(%rbp)
movl $0x0, -0x288(%rbp)
movl $0x2, -0x284(%rbp)
leaq -0x28c(%rbp), %rax
movq %rax, -0x280(%rbp)
movq $0x3, -0x278(%rbp)
movq -0x280(%rbp), %rsi
movq -0x278(%rbp), %rdx
leaq -0x180(%rbp), %rdi
callq 0xb480
jmp 0x668a
testb $0x1, -0x2(%rbp)
je 0x6794
movq 0x3792d(%rip), %rdi     # 0x3dfc8
leaq 0x229a4(%rip), %rsi     # 0x29046
callq 0x4310
movq %rax, -0x478(%rbp)
jmp 0x66b0
leaq -0x2e8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xb300
jmp 0x66c5
leaq -0x318(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0xb3d0
jmp 0x66da
leaq -0x2b0(%rbp), %rdi
leaq -0x2e8(%rbp), %rsi
leaq -0x318(%rbp), %rdx
callq 0x4970
jmp 0x66f6
movq -0x478(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x42f0
jmp 0x670b
leaq -0x2b0(%rbp), %rdi
callq 0x41e0
leaq -0x318(%rbp), %rdi
callq 0xb400
leaq -0x2e8(%rbp), %rdi
callq 0xb380
jmp 0x6794
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0x6783
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0x6777
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x2b0(%rbp), %rdi
callq 0x41e0
leaq -0x318(%rbp), %rdi
callq 0xb400
leaq -0x2e8(%rbp), %rdi
callq 0xb380
jmp 0x6b3d
movl $0x0, -0x31c(%rbp)
cmpl $0x3, -0x31c(%rbp)
jge 0x6855
movslq -0x31c(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xb230
movq %rax, -0x480(%rbp)
jmp 0x67c7
movq -0x480(%rbp), %rax
movq %rax, -0x328(%rbp)
leaq -0x168(%rbp), %rdi
leaq -0x328(%rbp), %rsi
callq 0xad00
movq %rax, -0x488(%rbp)
jmp 0x67f1
movq -0x488(%rbp), %rax
movss (%rax), %xmm0
movss %xmm0, -0x48c(%rbp)
movslq -0x31c(%rbp), %rsi
leaq -0x180(%rbp), %rdi
callq 0xb3b0
movss -0x48c(%rbp), %xmm0
cvtsi2ssl (%rax), %xmm1
ucomiss %xmm1, %xmm0
jne 0x682c
jp 0x682c
jmp 0x683f
movb $0x0, -0x1(%rbp)
movl $0x1, -0x23c(%rbp)
jmp 0x6af3
jmp 0x6841
movl -0x31c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x31c(%rbp)
jmp 0x679e
movl $0x2, %edi
leaq -0xd0(%rbp), %rsi
callq 0xb230
movq %rax, -0x498(%rbp)
jmp 0x686f
movq -0x498(%rbp), %rax
movq %rax, -0x138(%rbp)
movq 0x37a6c(%rip), %rax     # 0x3e2f0
leaq -0x358(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
leaq -0x138(%rbp), %rdx
leaq -0x108(%rbp), %rcx
callq *%rax
jmp 0x68a4
leaq -0x168(%rbp), %rdi
leaq -0x358(%rbp), %rsi
movq %rsi, -0x4a0(%rbp)
callq 0xb420
movq -0x4a0(%rbp), %rdi
callq 0xb400
movl $0x2, -0x374(%rbp)
movl $0x2, -0x370(%rbp)
movl $0x0, -0x36c(%rbp)
leaq -0x374(%rbp), %rax
movq %rax, -0x368(%rbp)
movq $0x3, -0x360(%rbp)
movq -0x368(%rbp), %rsi
movq -0x360(%rbp), %rdx
leaq -0x180(%rbp), %rdi
callq 0xb480
jmp 0x691d
testb $0x1, -0x2(%rbp)
je 0x6a27
movq 0x3769a(%rip), %rdi     # 0x3dfc8
leaq 0x22719(%rip), %rsi     # 0x2904e
callq 0x4310
movq %rax, -0x4a8(%rbp)
jmp 0x6943
leaq -0x3d0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xb300
jmp 0x6958
leaq -0x400(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0xb3d0
jmp 0x696d
leaq -0x398(%rbp), %rdi
leaq -0x3d0(%rbp), %rsi
leaq -0x400(%rbp), %rdx
callq 0x4970
jmp 0x6989
movq -0x4a8(%rbp), %rdi
leaq -0x398(%rbp), %rsi
callq 0x42f0
jmp 0x699e
leaq -0x398(%rbp), %rdi
callq 0x41e0
leaq -0x400(%rbp), %rdi
callq 0xb400
leaq -0x3d0(%rbp), %rdi
callq 0xb380
jmp 0x6a27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0x6a16
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0x6a0a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x398(%rbp), %rdi
callq 0x41e0
leaq -0x400(%rbp), %rdi
callq 0xb400
leaq -0x3d0(%rbp), %rdi
callq 0xb380
jmp 0x6b3d
movl $0x0, -0x404(%rbp)
cmpl $0x3, -0x404(%rbp)
jge 0x6ae5
movslq -0x404(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xb230
movq %rax, -0x4b0(%rbp)
jmp 0x6a5a
movq -0x4b0(%rbp), %rax
movq %rax, -0x410(%rbp)
leaq -0x168(%rbp), %rdi
leaq -0x410(%rbp), %rsi
callq 0xad00
movq %rax, -0x4b8(%rbp)
jmp 0x6a84
movq -0x4b8(%rbp), %rax
movss (%rax), %xmm0
movss %xmm0, -0x4bc(%rbp)
movslq -0x404(%rbp), %rsi
leaq -0x180(%rbp), %rdi
callq 0xb3b0
movss -0x4bc(%rbp), %xmm0
cvtsi2ssl (%rax), %xmm1
ucomiss %xmm1, %xmm0
jne 0x6abf
jp 0x6abf
jmp 0x6acf
movb $0x0, -0x1(%rbp)
movl $0x1, -0x23c(%rbp)
jmp 0x6af3
jmp 0x6ad1
movl -0x404(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x404(%rbp)
jmp 0x6a31
movb $0x1, -0x1(%rbp)
movl $0x1, -0x23c(%rbp)
leaq -0x180(%rbp), %rdi
callq 0xb120
leaq -0x168(%rbp), %rdi
callq 0xb400
leaq -0x120(%rbp), %rdi
callq 0xb120
leaq -0x108(%rbp), %rdi
callq 0xb530
leaq -0xd0(%rbp), %rdi
callq 0xb380
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x4d0, %rsp            # imm = 0x4D0
popq %rbp
retq
leaq -0x180(%rbp), %rdi
callq 0xb120
leaq -0x168(%rbp), %rdi
callq 0xb400
leaq -0x120(%rbp), %rdi
callq 0xb120
leaq -0x108(%rbp), %rdi
callq 0xb530
leaq -0xd0(%rbp), %rdi
callq 0xb380
movq -0x128(%rbp), %rdi
callq 0x4520
nopw %cs:(%rax,%rax)