// File: flastest[P]HeterogeneousParallelDijkstra/workloads.cc
// Function: test5(bool)
bool test5(bool TEST_DEBUG)
{
	const int num_nodes = 2;
	enum nodes { A, B };
	Edge edge_array[] = { 
			Edge(A, B), 
			Edge(B, B)
	};
	int weights[] = { 
		1, 1
	};
	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));



	// test5a, with source A.
	vertex_descriptor s = vertex(A, g);

	auto distances = dijkstra_algorithm(g, s, p);

	vector<float> true_distances = { 0, 1};
	if (TEST_DEBUG) cout << "test5a\n" << print_dijkstra_results(g,distances);
	for (int i = 0; i < num_nodes; i++)
	{
		if (distances[vertex(i,g)] != true_distances[i]){
			return false;
		}
	}

	// test5b, with source B.
	s = vertex(B, g);

	distances = dijkstra_algorithm(g, s, p);

	true_distances = {INFINITY, 0};
	if (TEST_DEBUG) cout << "test5b\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 $0x350, %rsp            # imm = 0x350
movb %dil, %al
andb $0x1, %al
movb %al, -0x2(%rbp)
movl $0x2, -0x8(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x1, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
movq %rdi, -0x2e0(%rbp)
leaq -0x24(%rbp), %rsi
leaq -0x28(%rbp), %rdx
callq 0x97d0
leaq -0x18(%rbp), %rdi
movl $0x1, -0x2c(%rbp)
movl $0x1, -0x30(%rbp)
leaq -0x2c(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x97d0
movq -0x2e0(%rbp), %rsi
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, -0x38(%rbp)
movl $0x2, -0x3c(%rbp)
movslq -0x3c(%rbp), %rax
leaq -0x20(%rbp,%rax,8), %rdx
movq %rsp, %rax
leaq -0x79(%rbp), %rcx
movq %rcx, (%rax)
xorl %eax, %eax
movl %eax, %r9d
leaq -0x78(%rbp), %rdi
movq %rdi, -0x2d8(%rbp)
leaq -0x38(%rbp), %rcx
movl $0x2, %r8d
callq 0xb180
leaq -0xb0(%rbp), %rdi
callq 0xb210
movq -0x2d8(%rbp), %rdi
callq 0xae10
movq %rax, -0x2d0(%rbp)
jmp 0x917e
leaq -0xd5(%rbp), %rdi
movq %rdi, -0x2e8(%rbp)
callq 0xae50
movq -0x2d0(%rbp), %rsi
movq -0x2e8(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
callq 0xae70
jmp 0x91ad
leaq -0xd5(%rbp), %rdi
callq 0xaee0
xorl %eax, %eax
movl %eax, %edi
leaq -0x78(%rbp), %rsi
callq 0xb230
movq %rax, -0x2f0(%rbp)
jmp 0x91cf
movq -0x2f0(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq 0x3510c(%rip), %rax     # 0x3e2f0
leaq -0x110(%rbp), %rdi
leaq -0x78(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
callq *%rax
jmp 0x9201
movl $0x0, -0x140(%rbp)
movl $0x3f800000, -0x13c(%rbp) # imm = 0x3F800000
leaq -0x140(%rbp), %rax
movq %rax, -0x138(%rbp)
movq $0x2, -0x130(%rbp)
leaq -0x141(%rbp), %rdi
movq %rdi, -0x2f8(%rbp)
callq 0xb5d0
movq -0x2f8(%rbp), %rcx
movq -0x138(%rbp), %rsi
movq -0x130(%rbp), %rdx
leaq -0x128(%rbp), %rdi
callq 0xb5f0
jmp 0x9264
leaq -0x141(%rbp), %rdi
callq 0xb670
testb $0x1, -0x2(%rbp)
je 0x9405
movq 0x34d47(%rip), %rdi     # 0x3dfc8
leaq 0x1fe06(%rip), %rsi     # 0x2908e
callq 0x4310
movq %rax, -0x300(%rbp)
jmp 0x9296
leaq -0x1a0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xb300
jmp 0x92a8
leaq -0x1d0(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0xb3d0
jmp 0x92bd
leaq -0x168(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
leaq -0x1d0(%rbp), %rdx
callq 0x4970
jmp 0x92d9
movq -0x300(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x42f0
jmp 0x92ee
leaq -0x168(%rbp), %rdi
callq 0x41e0
leaq -0x1d0(%rbp), %rdi
callq 0xb400
leaq -0x1a0(%rbp), %rdi
callq 0xb380
jmp 0x9405
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x97ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0xd5(%rbp), %rdi
callq 0xaee0
jmp 0x97ae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x97a2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x141(%rbp), %rdi
callq 0xb670
jmp 0x9796
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x978a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x93f4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x93e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x41e0
leaq -0x1d0(%rbp), %rdi
callq 0xb400
leaq -0x1a0(%rbp), %rdi
callq 0xb380
jmp 0x978a
movl $0x0, -0x1d4(%rbp)
cmpl $0x2, -0x1d4(%rbp)
jge 0x94bf
movslq -0x1d4(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xb230
movq %rax, -0x308(%rbp)
jmp 0x9435
movq -0x308(%rbp), %rax
movq %rax, -0x1e0(%rbp)
leaq -0x110(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0xad00
movq %rax, -0x310(%rbp)
jmp 0x945f
movq -0x310(%rbp), %rax
movss (%rax), %xmm0
movss %xmm0, -0x314(%rbp)
movslq -0x1d4(%rbp), %rsi
leaq -0x128(%rbp), %rdi
callq 0xb690
movss -0x314(%rbp), %xmm0
ucomiss (%rax), %xmm0
jne 0x9496
jp 0x9496
jmp 0x94a9
movb $0x0, -0x1(%rbp)
movl $0x1, -0x1e4(%rbp)
jmp 0x9743
jmp 0x94ab
movl -0x1d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d4(%rbp)
jmp 0x940f
movl $0x1, %edi
leaq -0x78(%rbp), %rsi
callq 0xb230
movq %rax, -0x320(%rbp)
jmp 0x94d6
movq -0x320(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq 0x34e05(%rip), %rax     # 0x3e2f0
leaq -0x218(%rbp), %rdi
leaq -0x78(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
callq *%rax
jmp 0x9508
leaq -0x110(%rbp), %rdi
leaq -0x218(%rbp), %rsi
movq %rsi, -0x328(%rbp)
callq 0xb420
movq -0x328(%rbp), %rdi
callq 0xb400
movl $0x7f800000, -0x230(%rbp) # imm = 0x7F800000
movl $0x0, -0x22c(%rbp)
leaq -0x230(%rbp), %rax
movq %rax, -0x228(%rbp)
movq $0x2, -0x220(%rbp)
movq -0x228(%rbp), %rsi
movq -0x220(%rbp), %rdx
leaq -0x128(%rbp), %rdi
callq 0xb6b0
jmp 0x9577
testb $0x1, -0x2(%rbp)
je 0x967e
movq 0x34a40(%rip), %rdi     # 0x3dfc8
leaq 0x1fb07(%rip), %rsi     # 0x29096
callq 0x4310
movq %rax, -0x330(%rbp)
jmp 0x959d
leaq -0x288(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xb300
jmp 0x95af
leaq -0x2b8(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0xb3d0
jmp 0x95c4
leaq -0x250(%rbp), %rdi
leaq -0x288(%rbp), %rsi
leaq -0x2b8(%rbp), %rdx
callq 0x4970
jmp 0x95e0
movq -0x330(%rbp), %rdi
leaq -0x250(%rbp), %rsi
callq 0x42f0
jmp 0x95f5
leaq -0x250(%rbp), %rdi
callq 0x41e0
leaq -0x2b8(%rbp), %rdi
callq 0xb400
leaq -0x288(%rbp), %rdi
callq 0xb380
jmp 0x967e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x966d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x9661
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x41e0
leaq -0x2b8(%rbp), %rdi
callq 0xb400
leaq -0x288(%rbp), %rdi
callq 0xb380
jmp 0x978a
movl $0x0, -0x2bc(%rbp)
cmpl $0x2, -0x2bc(%rbp)
jge 0x9735
movslq -0x2bc(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xb230
movq %rax, -0x338(%rbp)
jmp 0x96ae
movq -0x338(%rbp), %rax
movq %rax, -0x2c8(%rbp)
leaq -0x110(%rbp), %rdi
leaq -0x2c8(%rbp), %rsi
callq 0xad00
movq %rax, -0x340(%rbp)
jmp 0x96d8
movq -0x340(%rbp), %rax
movss (%rax), %xmm0
movss %xmm0, -0x344(%rbp)
movslq -0x2bc(%rbp), %rsi
leaq -0x128(%rbp), %rdi
callq 0xb690
movss -0x344(%rbp), %xmm0
ucomiss (%rax), %xmm0
jne 0x970f
jp 0x970f
jmp 0x971f
movb $0x0, -0x1(%rbp)
movl $0x1, -0x1e4(%rbp)
jmp 0x9743
jmp 0x9721
movl -0x2bc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2bc(%rbp)
jmp 0x9688
movb $0x1, -0x1(%rbp)
movl $0x1, -0x1e4(%rbp)
leaq -0x128(%rbp), %rdi
callq 0xb700
leaq -0x110(%rbp), %rdi
callq 0xb400
leaq -0xc8(%rbp), %rdi
callq 0xb120
leaq -0xb0(%rbp), %rdi
callq 0xb530
leaq -0x78(%rbp), %rdi
callq 0xb380
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x350, %rsp            # imm = 0x350
popq %rbp
retq
leaq -0x128(%rbp), %rdi
callq 0xb700
leaq -0x110(%rbp), %rdi
callq 0xb400
leaq -0xc8(%rbp), %rdi
callq 0xb120
leaq -0xb0(%rbp), %rdi
callq 0xb530
leaq -0x78(%rbp), %rdi
callq 0xb380
movq -0xd0(%rbp), %rdi
callq 0x4520
nop