// File: flastest[P]HeterogeneousParallelDijkstra/parallel_workloads.cc
// Function: test_cit(bool, int)
bool test_cit(bool TEST_DEBUG, int num_threads)
{
	if (TEST_DEBUG) std::cout<<"loading graph from cit"<<std::endl;
	graph_t g = cit_graph_from_file("cit-Patents.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;

	distance_map_t parallel_results = parallel_dijkstra(g, s, pred, num_threads);

	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 false;
		}
		
		//not sure if I need to check predecessors because they might be different
	}

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x200, %rsp            # imm = 0x200
movb %dil, %al
andb $0x1, %al
movb %al, -0x2(%rbp)
movl %esi, -0x8(%rbp)
testb $0x1, -0x2(%rbp)
je 0xab6e
movq 0x30475(%rip), %rdi     # 0x3afc8
leaq 0x1c669(%rip), %rsi     # 0x271c3
callq 0x4320
movq %rax, %rdi
movq 0x30437(%rip), %rsi     # 0x3afa0
callq 0x4380
leaq -0x61(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x4590
movq -0x180(%rbp), %rdx
leaq 0x1c64e(%rip), %rsi     # 0x271da
leaq -0x60(%rbp), %rdi
callq 0xd040
jmp 0xab97
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
movl $0x1, %edx
callq 0x24550
jmp 0xabab
leaq -0x60(%rbp), %rdi
callq 0x41d0
leaq -0x61(%rbp), %rdi
callq 0x43a0
leaq -0x40(%rbp), %rdi
callq 0xc720
movq %rax, -0x188(%rbp)
jmp 0xabcf
movq -0x188(%rbp), %rax
movl %eax, -0x78(%rbp)
movl $0x1, %edi
leaq -0x40(%rbp), %rsi
callq 0xcb40
movq %rax, -0x190(%rbp)
jmp 0xabf0
movq -0x190(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x198(%rbp)
callq 0xcb20
movq -0x198(%rbp), %rcx
movl -0x8(%rbp), %r8d
leaq -0xe0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq 0x1cbe0
jmp 0xac2f
movslq -0x78(%rbp), %rax
movq %rax, -0x1a8(%rbp)
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x1a0(%rbp)
callq 0xcb60
movq -0x1a8(%rbp), %rsi
movq -0x1a0(%rbp), %rdx
leaq -0xf8(%rbp), %rdi
callq 0xcb80
jmp 0xac69
leaq -0xf9(%rbp), %rdi
callq 0xcbf0
leaq -0x150(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0xcc10
jmp 0xac87
movq -0x80(%rbp), %rdx
leaq -0x118(%rbp), %rdi
leaq -0x150(%rbp), %rsi
leaq -0xf8(%rbp), %rcx
callq 0x4fa0
jmp 0xaca7
leaq -0x150(%rbp), %rdi
callq 0xcc90
movl $0x0, -0x154(%rbp)
movl -0x154(%rbp), %eax
cmpl -0x78(%rbp), %eax
jge 0xafaf
testb $0x1, -0x2(%rbp)
je 0xaea3
movq 0x302eb(%rip), %rdi     # 0x3afc8
leaq 0x1c4a4(%rip), %rsi     # 0x27188
callq 0x4320
movq %rax, -0x1b0(%rbp)
jmp 0xacf2
movq -0x1b0(%rbp), %rdi
movl -0x154(%rbp), %esi
callq 0x4570
movq %rax, -0x1b8(%rbp)
jmp 0xad0d
movq -0x1b8(%rbp), %rdi
movq 0x30285(%rip), %rsi     # 0x3afa0
callq 0x4380
jmp 0xad22
movq 0x3029f(%rip), %rdi     # 0x3afc8
leaq 0x1c465(%rip), %rsi     # 0x27195
callq 0x4320
movq %rax, -0x1c0(%rbp)
jmp 0xad3e
movslq -0x154(%rbp), %rax
movq %rax, -0x160(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0xc610
movq %rax, -0x1c8(%rbp)
jmp 0xad68
movq -0x1c0(%rbp), %rdi
movq -0x1c8(%rbp), %rax
movss (%rax), %xmm0
callq 0x4270
movq %rax, -0x1d0(%rbp)
jmp 0xad88
movq -0x1d0(%rbp), %rdi
leaq 0x1c288(%rip), %rsi     # 0x2701e
callq 0x4320
movq %rax, -0x1d8(%rbp)
jmp 0xada4
movslq -0x154(%rbp), %rsi
leaq -0x118(%rbp), %rdi
callq 0xccc0
movq -0x1d8(%rbp), %rdi
movl (%rax), %esi
callq 0x4570
movq %rax, -0x1e0(%rbp)
jmp 0xadce
movq -0x1e0(%rbp), %rdi
movq 0x301c4(%rip), %rsi     # 0x3afa0
callq 0x4380
jmp 0xade3
jmp 0xaea3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0xae0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x41d0
leaq -0x61(%rbp), %rdi
callq 0x43a0
jmp 0xb031
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0xb028
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0xb01c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xf9(%rbp), %rdi
callq 0xcbf0
jmp 0xb010
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0xb004
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x150(%rbp), %rdi
callq 0xcc90
jmp 0xb004
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x118(%rbp), %rdi
callq 0xca30
jmp 0xb004
movslq -0x154(%rbp), %rax
movq %rax, -0x168(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0xc610
movq %rax, -0x1e8(%rbp)
jmp 0xaecd
movq -0x1e8(%rbp), %rax
movss (%rax), %xmm0
movss %xmm0, -0x1ec(%rbp)
movslq -0x154(%rbp), %rsi
leaq -0x118(%rbp), %rdi
callq 0xccc0
movss -0x1ec(%rbp), %xmm0
cvtsi2ssl (%rax), %xmm1
ucomiss %xmm1, %xmm0
jne 0xaf0b
jp 0xaf0b
jmp 0xaf99
movslq -0x154(%rbp), %rax
movq %rax, -0x170(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0xc610
movq %rax, -0x1f8(%rbp)
jmp 0xaf35
movq -0x1f8(%rbp), %rax
movss (%rax), %xmm0
xorl %eax, %eax
movss 0x1c0ba(%rip), %xmm1    # 0x27004
ucomiss %xmm1, %xmm0
movb %al, -0x1f9(%rbp)
jne 0xaf59
jp 0xaf59
jmp 0xaf7b
movslq -0x154(%rbp), %rsi
leaq -0x118(%rbp), %rdi
callq 0xccc0
cmpl $0x7fffffff, (%rax)     # imm = 0x7FFFFFFF
setne %al
movb %al, -0x1f9(%rbp)
movb -0x1f9(%rbp), %al
testb $0x1, %al
jne 0xaf87
jmp 0xaf97
movb $0x0, -0x1(%rbp)
movl $0x1, -0x174(%rbp)
jmp 0xafbd
jmp 0xaf99
jmp 0xaf9b
movl -0x154(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x154(%rbp)
jmp 0xacbd
movb $0x1, -0x1(%rbp)
movl $0x1, -0x174(%rbp)
leaq -0x118(%rbp), %rdi
callq 0xca30
leaq -0xf8(%rbp), %rdi
callq 0xcdb0
leaq -0xe0(%rbp), %rdi
callq 0xcd10
leaq -0xb0(%rbp), %rdi
callq 0xce10
leaq -0x40(%rbp), %rdi
callq 0xcc90
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x200, %rsp            # imm = 0x200
popq %rbp
retq
leaq -0xf8(%rbp), %rdi
callq 0xcdb0
leaq -0xe0(%rbp), %rdi
callq 0xcd10
leaq -0xb0(%rbp), %rdi
callq 0xce10
leaq -0x40(%rbp), %rdi
callq 0xcc90
movq -0x70(%rbp), %rdi
callq 0x4580
nopw (%rax,%rax)