#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 EXIT_SUCCESS;
int fib(int);
double omp_get_wtime();
int /*<<< orphan*/ printf(char *, double);
int main(int argc, char *argv[]) {
  int N;
  int res;
  double t_start, t_end;
  N = 44;
  t_start = omp_get_wtime();
#pragma omp parallel default(none) shared(res, N)
  {
#pragma omp single
    res = fib(N);
  }
  t_end = omp_get_wtime();
  printf("res=%d\n", res);
  printf("Took %g s\n", t_end - t_start);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x2c,-0x14(%rbp)
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <fib@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x28(%rbp)
cvtsi2sdl -0x18(%rbp),%xmm0
lea    0xe84(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e42(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0x2c,%edi
call   1050 <fib@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e55(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"res=%d\0A\00"
@.str.1 = [11 x i8] c"Took %g s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 44, i32* %6
%10 = call double (...) @omp_get_wtime()
store double %10, double* %8
%11 = load i32, i32* %6
%12 = call i32 @fib(i32 %11)
store i32 %12, i32* %7
%13 = call double (...) @omp_get_wtime()
store double %13, double* %9
%14 = load i32, i32* %7
%15 = sitofp i32 %14 to double
%16 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double %15)
%17 = load double, double* %9
%18 = load double, double* %8
%19 = fsub double %17, %18
%20 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), double %19)
%21 = load i32, i32* @EXIT_SUCCESS
ret i32 %21
}

LLVM IR (-O2):
@.str = [8 x i8] c"res=%d\0A\00"
@.str.1 = [11 x i8] c"Took %g s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call double (...) @omp_get_wtime()
%4 = tail call i32 @fib(i32 44)
%5 = tail call double (...) @omp_get_wtime()
%6 = sitofp i32 %4 to double
%7 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double %6)
%8 = fsub double %5, %3
%9 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), double %8)
%10 = load i32, i32* @EXIT_SUCCESS
ret i32 %10
}