// File: flastest[P]HeterogeneousParallelDijkstra/workloads.cc
// Function: test4(bool)
bool test4(bool TEST_DEBUG)
{
	const int num_nodes = 3;
	enum nodes { A, B, C};
	Edge edge_array[] = { 
			Edge(A, B), 
			Edge(B, C)
	};
	int weights[] = { 
		2, 3
	};
	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));



	// test4a, with source A.
	vertex_descriptor s = vertex(A, g);

	auto distances = dijkstra_algorithm(g, s, p);

	vector<float> true_distances = { 0, 2, 5};
	if (TEST_DEBUG) cout << "test4a\n" << print_dijkstra_results(g,distances);
	for (int i = 0; i < num_nodes; i++)
	{
		if (distances[vertex(i,g)] != true_distances[i]){
			return false;
		}
	}

	// test4b, with source B.
	s = vertex(B, g);

	distances = dijkstra_algorithm(g, s, p);

	true_distances = {INFINITY, 0, 3};
	if (TEST_DEBUG) cout << "test4b\n" << print_dijkstra_results(g,distances);
	for (int i = 0; i < num_nodes; i++)
	{
		if (distances[vertex(i,g)] != true_distances[i]){
			return false;
		}
	}


	// test4c, with source C.
	s = vertex(C, g);

	distances = dijkstra_algorithm(g, s, p);

	true_distances = {INFINITY, INFINITY, 0};
	if (TEST_DEBUG) cout << "test4c\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 $0x470, %rsp            # imm = 0x470
movb %dil, %al
andb $0x1, %al
movb %al, -0x2(%rbp)
movl $0x3, -0x8(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x1, -0x28(%rbp)
leaq -0x20(%rbp), %rdi
movq %rdi, -0x3d0(%rbp)
leaq -0x24(%rbp), %rsi
leaq -0x28(%rbp), %rdx
callq 0x9080
leaq -0x18(%rbp), %rdi
movl $0x1, -0x2c(%rbp)
movl $0x2, -0x30(%rbp)
leaq -0x2c(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x9080
movq -0x3d0(%rbp), %rsi
movabsq $0x300000002, %rax      # imm = 0x300000002
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, -0x3c8(%rbp)
leaq -0x38(%rbp), %rcx
movl $0x3, %r8d
callq 0xb180
leaq -0xb0(%rbp), %rdi
callq 0xb210
movq -0x3c8(%rbp), %rdi
callq 0xae10
movq %rax, -0x3c0(%rbp)
jmp 0x878e
leaq -0xd5(%rbp), %rdi
movq %rdi, -0x3d8(%rbp)
callq 0xae50
movq -0x3c0(%rbp), %rsi
movq -0x3d8(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
callq 0xae70
jmp 0x87bd
leaq -0xd5(%rbp), %rdi
callq 0xaee0
xorl %eax, %eax
movl %eax, %edi
leaq -0x78(%rbp), %rsi
callq 0xb230
movq %rax, -0x3e0(%rbp)
jmp 0x87df
movq -0x3e0(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq 0x35afc(%rip), %rax     # 0x3e2f0
leaq -0x110(%rbp), %rdi
leaq -0x78(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
callq *%rax
jmp 0x8811
movl $0x0, -0x144(%rbp)
movl $0x40000000, -0x140(%rbp) # imm = 0x40000000
movl $0x40a00000, -0x13c(%rbp) # imm = 0x40A00000
leaq -0x144(%rbp), %rax
movq %rax, -0x138(%rbp)
movq $0x3, -0x130(%rbp)
leaq -0x145(%rbp), %rdi
movq %rdi, -0x3e8(%rbp)
callq 0xb5d0
movq -0x3e8(%rbp), %rcx
movq -0x138(%rbp), %rsi
movq -0x130(%rbp), %rdx
leaq -0x128(%rbp), %rdi
callq 0xb5f0
jmp 0x887e
leaq -0x145(%rbp), %rdi
callq 0xb670
testb $0x1, -0x2(%rbp)
je 0x8a1f
movq 0x3572d(%rip), %rdi     # 0x3dfc8
leaq 0x207d4(%rip), %rsi     # 0x29076
callq 0x4310
movq %rax, -0x3f0(%rbp)
jmp 0x88b0
leaq -0x1a0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xb300
jmp 0x88c2
leaq -0x1d0(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0xb3d0
jmp 0x88d7
leaq -0x168(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
leaq -0x1d0(%rbp), %rdx
callq 0x4970
jmp 0x88f3
movq -0x3f0(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x42f0
jmp 0x8908
leaq -0x168(%rbp), %rdi
callq 0x41e0
leaq -0x1d0(%rbp), %rdi
callq 0xb400
leaq -0x1a0(%rbp), %rdi
callq 0xb380
jmp 0x8a1f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x9055
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0xd5(%rbp), %rdi
callq 0xaee0
jmp 0x9055
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x9049
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x145(%rbp), %rdi
callq 0xb670
jmp 0x903d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x9031
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x8a0e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x8a02
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 0x9031
movl $0x0, -0x1d4(%rbp)
cmpl $0x3, -0x1d4(%rbp)
jge 0x8ad9
movslq -0x1d4(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xb230
movq %rax, -0x3f8(%rbp)
jmp 0x8a4f
movq -0x3f8(%rbp), %rax
movq %rax, -0x1e0(%rbp)
leaq -0x110(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0xad00
movq %rax, -0x400(%rbp)
jmp 0x8a79
movq -0x400(%rbp), %rax
movss (%rax), %xmm0
movss %xmm0, -0x404(%rbp)
movslq -0x1d4(%rbp), %rsi
leaq -0x128(%rbp), %rdi
callq 0xb690
movss -0x404(%rbp), %xmm0
ucomiss (%rax), %xmm0
jne 0x8ab0
jp 0x8ab0
jmp 0x8ac3
movb $0x0, -0x1(%rbp)
movl $0x1, -0x1e4(%rbp)
jmp 0x8fea
jmp 0x8ac5
movl -0x1d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d4(%rbp)
jmp 0x8a29
movl $0x1, %edi
leaq -0x78(%rbp), %rsi
callq 0xb230
movq %rax, -0x410(%rbp)
jmp 0x8af0
movq -0x410(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq 0x357eb(%rip), %rax     # 0x3e2f0
leaq -0x218(%rbp), %rdi
leaq -0x78(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
callq *%rax
jmp 0x8b22
leaq -0x110(%rbp), %rdi
leaq -0x218(%rbp), %rsi
movq %rsi, -0x418(%rbp)
callq 0xb420
movq -0x418(%rbp), %rdi
callq 0xb400
movl $0x7f800000, -0x234(%rbp) # imm = 0x7F800000
movl $0x0, -0x230(%rbp)
movl $0x40400000, -0x22c(%rbp) # imm = 0x40400000
leaq -0x234(%rbp), %rax
movq %rax, -0x228(%rbp)
movq $0x3, -0x220(%rbp)
movq -0x228(%rbp), %rsi
movq -0x220(%rbp), %rdx
leaq -0x128(%rbp), %rdi
callq 0xb6b0
jmp 0x8b9b
testb $0x1, -0x2(%rbp)
je 0x8ca2
movq 0x3541c(%rip), %rdi     # 0x3dfc8
leaq 0x204cb(%rip), %rsi     # 0x2907e
callq 0x4310
movq %rax, -0x420(%rbp)
jmp 0x8bc1
leaq -0x290(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xb300
jmp 0x8bd3
leaq -0x2c0(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0xb3d0
jmp 0x8be8
leaq -0x258(%rbp), %rdi
leaq -0x290(%rbp), %rsi
leaq -0x2c0(%rbp), %rdx
callq 0x4970
jmp 0x8c04
movq -0x420(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x42f0
jmp 0x8c19
leaq -0x258(%rbp), %rdi
callq 0x41e0
leaq -0x2c0(%rbp), %rdi
callq 0xb400
leaq -0x290(%rbp), %rdi
callq 0xb380
jmp 0x8ca2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x8c91
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x8c85
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x41e0
leaq -0x2c0(%rbp), %rdi
callq 0xb400
leaq -0x290(%rbp), %rdi
callq 0xb380
jmp 0x9031
movl $0x0, -0x2c4(%rbp)
cmpl $0x3, -0x2c4(%rbp)
jge 0x8d5c
movslq -0x2c4(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xb230
movq %rax, -0x428(%rbp)
jmp 0x8cd2
movq -0x428(%rbp), %rax
movq %rax, -0x2d0(%rbp)
leaq -0x110(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0xad00
movq %rax, -0x430(%rbp)
jmp 0x8cfc
movq -0x430(%rbp), %rax
movss (%rax), %xmm0
movss %xmm0, -0x434(%rbp)
movslq -0x2c4(%rbp), %rsi
leaq -0x128(%rbp), %rdi
callq 0xb690
movss -0x434(%rbp), %xmm0
ucomiss (%rax), %xmm0
jne 0x8d33
jp 0x8d33
jmp 0x8d46
movb $0x0, -0x1(%rbp)
movl $0x1, -0x1e4(%rbp)
jmp 0x8fea
jmp 0x8d48
movl -0x2c4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c4(%rbp)
jmp 0x8cac
movl $0x2, %edi
leaq -0x78(%rbp), %rsi
callq 0xb230
movq %rax, -0x440(%rbp)
jmp 0x8d73
movq -0x440(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq 0x35568(%rip), %rax     # 0x3e2f0
leaq -0x300(%rbp), %rdi
leaq -0x78(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
callq *%rax
jmp 0x8da5
leaq -0x110(%rbp), %rdi
leaq -0x300(%rbp), %rsi
movq %rsi, -0x448(%rbp)
callq 0xb420
movq -0x448(%rbp), %rdi
callq 0xb400
movl $0x7f800000, -0x31c(%rbp) # imm = 0x7F800000
movl $0x7f800000, -0x318(%rbp) # imm = 0x7F800000
movl $0x0, -0x314(%rbp)
leaq -0x31c(%rbp), %rax
movq %rax, -0x310(%rbp)
movq $0x3, -0x308(%rbp)
movq -0x310(%rbp), %rsi
movq -0x308(%rbp), %rdx
leaq -0x128(%rbp), %rdi
callq 0xb6b0
jmp 0x8e1e
testb $0x1, -0x2(%rbp)
je 0x8f25
movq 0x35199(%rip), %rdi     # 0x3dfc8
leaq 0x20250(%rip), %rsi     # 0x29086
callq 0x4310
movq %rax, -0x450(%rbp)
jmp 0x8e44
leaq -0x378(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xb300
jmp 0x8e56
leaq -0x3a8(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0xb3d0
jmp 0x8e6b
leaq -0x340(%rbp), %rdi
leaq -0x378(%rbp), %rsi
leaq -0x3a8(%rbp), %rdx
callq 0x4970
jmp 0x8e87
movq -0x450(%rbp), %rdi
leaq -0x340(%rbp), %rsi
callq 0x42f0
jmp 0x8e9c
leaq -0x340(%rbp), %rdi
callq 0x41e0
leaq -0x3a8(%rbp), %rdi
callq 0xb400
leaq -0x378(%rbp), %rdi
callq 0xb380
jmp 0x8f25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x8f14
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x8f08
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x340(%rbp), %rdi
callq 0x41e0
leaq -0x3a8(%rbp), %rdi
callq 0xb400
leaq -0x378(%rbp), %rdi
callq 0xb380
jmp 0x9031
movl $0x0, -0x3ac(%rbp)
cmpl $0x3, -0x3ac(%rbp)
jge 0x8fdc
movslq -0x3ac(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xb230
movq %rax, -0x458(%rbp)
jmp 0x8f55
movq -0x458(%rbp), %rax
movq %rax, -0x3b8(%rbp)
leaq -0x110(%rbp), %rdi
leaq -0x3b8(%rbp), %rsi
callq 0xad00
movq %rax, -0x460(%rbp)
jmp 0x8f7f
movq -0x460(%rbp), %rax
movss (%rax), %xmm0
movss %xmm0, -0x464(%rbp)
movslq -0x3ac(%rbp), %rsi
leaq -0x128(%rbp), %rdi
callq 0xb690
movss -0x464(%rbp), %xmm0
ucomiss (%rax), %xmm0
jne 0x8fb6
jp 0x8fb6
jmp 0x8fc6
movb $0x0, -0x1(%rbp)
movl $0x1, -0x1e4(%rbp)
jmp 0x8fea
jmp 0x8fc8
movl -0x3ac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3ac(%rbp)
jmp 0x8f2f
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 $0x470, %rsp            # imm = 0x470
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
nopw %cs:(%rax,%rax)