// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movq %rsi, %rbp
movl %edi, %r15d
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x6c5c(%rip), %rdx      # 0x103c6
leaq 0x8(%rsp), %rdi
movq %rdx, %rsi
callq 0xa2a8
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x6bf7(%rip), %rsi      # 0x1037e
leaq 0x6bf9(%rip), %rdx      # 0x10387
leaq 0x28(%rsp), %rdi
callq 0xa2a8
movl $0x1, %ebx
movl $0x1, 0x4(%rsp)
cmpl $0x2, %r15d
jl 0x97b8
movq 0x8(%rbp), %rdi
callq 0x33e0
movl %eax, 0x4(%rsp)
movl $0x2, %r13d
cmpl $0x3, %r15d
jl 0x97d5
movq 0x10(%rbp), %rdi
callq 0x33e0
movl %eax, %ebx
movl %eax, %r13d
incl %r13d
cmpl $0x4, %r15d
jl 0x97ee
movq 0x18(%rbp), %rdi
callq 0x33e0
leal 0x1(%rbx), %r13d
cmpl %ebx, %eax
cmovgl %eax, %r13d
cmpl $0x5, %r15d
jl 0x9824
movq 0x20(%rbp), %r12
leaq 0x8(%rsp), %rax
movq %rbp, %r14
movq 0x8(%rax), %rbp
movq %r12, %rdi
callq 0x3130
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
movq %rbp, %rdx
movq %r14, %rbp
movq %r12, %rcx
movq %rax, %r8
callq 0x33d0
cmpl $0x4, %r15d
jg 0x98dd
leaq 0x8(%rsp), %rdi
movq 0x8(%rdi), %rdx
leaq 0x6b4a(%rip), %rcx      # 0x10388
movl $0xb, %r8d
xorl %esi, %esi
callq 0x33d0
leaq 0x78(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
leaq 0x68(%rsp), %rdi
callq 0xa218
leaq 0x68(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
movl $0x1388, %edx           # imm = 0x1388
callq 0x377c
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x9896
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0xd733(%rip), %r12      # 0x16fd0
leaq 0x6af0(%rip), %rsi      # 0x10394
movl $0x19, %edx
movq %r12, %rdi
callq 0x3300
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq 0xd700(%rip), %rdi      # 0x16fd0
callq 0x3040
movq %rax, %rdi
callq 0x31d0
cmpl $0x6, %r15d
jl 0x990b
movq 0x28(%rbp), %r14
leaq 0x28(%rsp), %r15
movq 0x8(%r15), %r12
movq %r14, %rdi
callq 0x3130
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %r14, %rcx
movq %rax, %r8
callq 0x33d0
leaq 0x88(%rsp), %rdi
callq 0x3440
leaq 0x88(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movl $0x10, %edx
callq 0x3150
cmpl %r13d, %ebx
jg 0x9a24
leaq 0x58(%rsp), %r15
movq 0xd68c(%rip), %r14      # 0x16fd0
leaq 0x48(%rsp), %rbp
movl $0x16, %edx
movq %r14, %rdi
leaq 0x6a56(%rip), %rsi      # 0x103ae
callq 0x3300
movq %r14, %rdi
movl %ebx, %esi
callq 0x3480
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %r12, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31d0
leaq 0x88(%rsp), %rdi
movl %ebx, %esi
callq 0x3480
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
leaq 0x6a13(%rip), %rsi      # 0x103c5
callq 0x3300
movq %r15, 0x48(%rsp)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0xa218
movl $0x1, %edi
movl %ebx, %esi
movl 0x4(%rsp), %edx
movq %rbp, %rcx
callq 0x9150
movq %r12, %rdi
movl %eax, %esi
callq 0x3480
movl $0x1, %edx
movq %rax, %rdi
leaq 0x6782(%rip), %rsi      # 0x1017f
callq 0x3300
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x9a19
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x32b0
addl %ebx, %ebx
cmpl %r13d, %ebx
jle 0x9949
leaq 0x88(%rsp), %rdi
callq 0x3370
movq 0xd588(%rip), %rax      # 0x16fc0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x90(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x88(%rsp,%rcx)
callq 0x3240
leaq 0x180(%rsp), %rdi
callq 0x30f0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x9a85
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x9aa1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32b0
xorl %eax, %eax
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x9b0b
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x9b0b
jmp 0x9ada
movq %rax, %rbx
jmp 0x9b27
jmp 0x9afb
movq %rax, %rbx
jmp 0x9b0b
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x9afe
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x9afe
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x33b0
leaq 0x38(%rsp), %rax
movq 0x28(%rsp), %rdi
cmpq %rax, %rdi
je 0x9b27
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x9b43
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x34a0
nop