#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ exit(int);
int fib(int);
int omp_get_num_threads();
int /*<<< orphan*/ omp_set_dynamic(int /*<<< orphan*/);
int /*<<< orphan*/ omp_set_num_threads(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  int number, numThreads;
  if (argc != 3) {
    printf("\t\t Very Few Arguments\n ");
    printf("\t\t Syntax : exec <Number> <No. of Threads>\n");
    exit(-1);
  }
  number = atoi(argv[1]);
  numThreads = atoi(argv[2]);
  omp_set_dynamic(0);
  omp_set_num_threads(numThreads);
#pragma omp parallel shared(number)
  {
#pragma omp single
    {
      printf("\n Total Threads %d ", omp_get_num_threads());
      printf("\n Fibnacci Number fib(%d) = %d\n\n", number, fib(number));
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x4(%rbp)
je     11af <main+0x3f>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x18(%rbp)
xor    %edi,%edi
call   1050 <omp_set_dynamic@plt>
mov    -0x18(%rbp),%edi
call   1060 <omp_set_num_threads@plt>
mov    $0x0,%al
call   1040 <omp_get_num_threads@plt>
mov    %eax,%esi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
call   1070 <fib@plt>
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    11e8 <main+0x68>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1090 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1090 <atoi@plt>
mov    %eax,%ebx
xor    %edi,%edi
call   1060 <omp_set_dynamic@plt>
mov    %ebx,%edi
call   1070 <omp_set_num_threads@plt>
xor    %eax,%eax
call   1050 <omp_get_num_threads@plt>
lea    0xe5b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%edi
call   1080 <fib@plt>
lea    0xe58(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe11(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe50(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"\09\09 Very Few Arguments\0A \00"
@.str.1 = [44 x i8] c"\09\09 Syntax : exec <Number> <No. of Threads>\0A\00"
@.str.2 = [20 x i8] c"\0A Total Threads %d \00"
@.str.3 = [33 x i8] c"\0A Fibnacci Number fib(%d) = %d\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 3
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @exit(i32 -1)
unreachable
13: ; preds = %2
%14 = load i8**, i8*** %4
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @atoi(i8* %16)
store i32 %17, i32* %5
%18 = load i8**, i8*** %4
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %6
%22 = call i32 @omp_set_dynamic(i32 0)
%23 = load i32, i32* %6
%24 = call i32 @omp_set_num_threads(i32 %23)
%25 = call i32 (...) @omp_get_num_threads()
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %5
%28 = load i32, i32* %5
%29 = call i32 @fib(i32 %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %27, i32 %29)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"\09\09 Very Few Arguments\0A \00"
@.str.2 = [20 x i8] c"\0A Total Threads %d \00"
@.str.3 = [33 x i8] c"\0A Fibnacci Number fib(%d) = %d\0A\0A\00"
@str = [43 x i8] c"\09\09 Syntax : exec <Number> <No. of Threads>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = tail call i32 @omp_set_dynamic(i32 0)
%16 = tail call i32 @omp_set_num_threads(i32 %14)
%17 = tail call i32 (...) @omp_get_num_threads()
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = tail call i32 @fib(i32 %11)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %11, i32 %19)
ret i32 0
}