// File: flastest[P]HeterogeneousParallelDijkstra/parallel_workloads.cc
// Function: main
int main(int argc, char** argv)
{


	bool debug_on = true;
	int number_trials = 1;
	int num_threads = 1;
	int max_threads = 2;
	std::string graph_name = "";
	std::string ostream_name = "times.txt";

	if (argc >= 2)
	{
		number_trials = atoi(argv[1]);
	}
	if (argc >= 3)
	{
		num_threads = atoi(argv[2]);
		max_threads = num_threads + 1;
	}
	if (argc >= 4)
	{
		max_threads = atoi(argv[3]);
		if (max_threads	< num_threads + 1) max_threads = num_threads + 1;
	} 
	if (argc >= 5) 
	{
		graph_name = argv[4];
	}
	if (argc<5) {
		graph_name = "1knodes.txt";

		generate_graph(graph_name,1000,5000);
		std::cout<<"graph has been generated." <<std::endl;
	}

	if (argc >= 6)
	{
		ostream_name = argv[5];
	}
	


	ofstream file_stream;
  	file_stream.open (ostream_name);

  	for (int i = num_threads; i <= max_threads; i*=2)
  	{
  		std::cout <<"about to start thread "<<i<<std::endl;
  		file_stream<<i<<"\t"<<get_min_graph_time_for_given_amount_of_threads(debug_on, i, number_trials, graph_name)<< "\n";

  	}

	file_stream.close();


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x320, %rsp            # imm = 0x320
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x1, -0x11(%rbp)
movl $0x1, -0x18(%rbp)
movl $0x1, -0x1c(%rbp)
movl $0x2, -0x20(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0x2d0(%rbp)
callq 0x4590
movq -0x2d0(%rbp), %rdx
leaq 0x1b4ca(%rip), %rsi     # 0x272da
leaq -0x40(%rbp), %rdi
callq 0xd040
jmp 0xbe1b
leaq -0x41(%rbp), %rdi
callq 0x43a0
leaq -0x79(%rbp), %rdi
movq %rdi, -0x2d8(%rbp)
callq 0x4590
movq -0x2d8(%rbp), %rdx
leaq 0x1b450(%rip), %rsi     # 0x27292
leaq -0x78(%rbp), %rdi
callq 0xd040
jmp 0xbe4d
leaq -0x79(%rbp), %rdi
callq 0x43a0
cmpl $0x2, -0x8(%rbp)
jl 0xbea2
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x44d0
movl %eax, -0x18(%rbp)
jmp 0xbea2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x41(%rbp), %rdi
callq 0x43a0
jmp 0xc1c1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x79(%rbp), %rdi
callq 0x43a0
jmp 0xc1b8
cmpl $0x3, -0x8(%rbp)
jl 0xbec1
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x44d0
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
cmpl $0x4, -0x8(%rbp)
jl 0xbeef
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x44d0
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jge 0xbeed
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xbeef
cmpl $0x5, -0x8(%rbp)
jl 0xbf1b
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
leaq -0x40(%rbp), %rdi
callq 0x4420
jmp 0xbf08
jmp 0xbf1b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xc1af
cmpl $0x5, -0x8(%rbp)
jge 0xbfbd
leaq 0x1b370(%rip), %rsi     # 0x2729c
leaq -0x40(%rbp), %rdi
callq 0x4420
jmp 0xbf37
leaq -0xa0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x4140
jmp 0xbf49
leaq -0xa0(%rbp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
movl $0x1388, %edx           # imm = 0x1388
callq 0x49c0
jmp 0xbf61
leaq -0xa0(%rbp), %rdi
callq 0x41d0
movq 0x2f054(%rip), %rdi     # 0x3afc8
leaq 0x1b32d(%rip), %rsi     # 0x272a8
callq 0x4320
movq %rax, -0x2e0(%rbp)
jmp 0xbf89
movq -0x2e0(%rbp), %rdi
movq 0x2f009(%rip), %rsi     # 0x3afa0
callq 0x4380
jmp 0xbf9e
jmp 0xbfbd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x41d0
jmp 0xc1af
cmpl $0x6, -0x8(%rbp)
jl 0xbfd8
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
leaq -0x78(%rbp), %rdi
callq 0x4420
jmp 0xbfd6
jmp 0xbfd8
leaq -0x2a0(%rbp), %rdi
callq 0x4530
jmp 0xbfe6
leaq -0x2a0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
movl $0x10, %edx
callq 0x4170
jmp 0xbffd
movl -0x1c(%rbp), %eax
movl %eax, -0x2a4(%rbp)
movl -0x2a4(%rbp), %eax
cmpl -0x20(%rbp), %eax
jg 0xc16b
movq 0x2efac(%rip), %rdi     # 0x3afc8
leaq 0x1b29f(%rip), %rsi     # 0x272c2
callq 0x4320
movq %rax, -0x2e8(%rbp)
jmp 0xc031
movq -0x2e8(%rbp), %rdi
movl -0x2a4(%rbp), %esi
callq 0x4570
movq %rax, -0x2f0(%rbp)
jmp 0xc04c
movq -0x2f0(%rbp), %rdi
movq 0x2ef46(%rip), %rsi     # 0x3afa0
callq 0x4380
jmp 0xc061
movl -0x2a4(%rbp), %esi
leaq -0x2a0(%rbp), %rdi
callq 0x4570
movq %rax, -0x2f8(%rbp)
jmp 0xc07c
movq -0x2f8(%rbp), %rdi
leaq 0x1b24f(%rip), %rsi     # 0x272d9
callq 0x4320
movq %rax, -0x300(%rbp)
jmp 0xc098
movb -0x11(%rbp), %al
movb %al, -0x309(%rbp)
movl -0x2a4(%rbp), %eax
movl %eax, -0x308(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x304(%rbp)
leaq -0x2c8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x4140
jmp 0xc0c8
movl -0x304(%rbp), %edx
movl -0x308(%rbp), %esi
movb -0x309(%rbp), %al
movzbl %al, %edi
andl $0x1, %edi
leaq -0x2c8(%rbp), %rcx
callq 0xb770
movl %eax, -0x310(%rbp)
jmp 0xc0f4
movl -0x310(%rbp), %esi
movq -0x300(%rbp), %rdi
callq 0x4570
movq %rax, -0x318(%rbp)
jmp 0xc10f
movq -0x318(%rbp), %rdi
leaq 0x1af76(%rip), %rsi     # 0x27093
callq 0x4320
jmp 0xc124
leaq -0x2c8(%rbp), %rdi
callq 0x41d0
movl -0x2a4(%rbp), %eax
shll %eax
movl %eax, -0x2a4(%rbp)
jmp 0xc006
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xc1a3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x2c8(%rbp), %rdi
callq 0x41d0
jmp 0xc1a3
leaq -0x2a0(%rbp), %rdi
callq 0x4460
jmp 0xc179
leaq -0x2a0(%rbp), %rdi
callq 0x44a0
leaq -0x78(%rbp), %rdi
callq 0x41d0
leaq -0x40(%rbp), %rdi
callq 0x41d0
movl -0x4(%rbp), %eax
addq $0x320, %rsp            # imm = 0x320
popq %rbp
retq
leaq -0x2a0(%rbp), %rdi
callq 0x44a0
leaq -0x78(%rbp), %rdi
callq 0x41d0
leaq -0x40(%rbp), %rdi
callq 0x41d0
movq -0x50(%rbp), %rdi
callq 0x4580
nopw (%rax,%rax)