#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 */
struct timespec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
double atan(double);
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ elapsed_time_hr(struct timespec, struct timespec, char *);
double piapprox(int, unsigned int);
double recur_piapprox(int, unsigned int);
int /*<<< orphan*/ sleep(int);
int function_calls_recursive(unsigned int N) {
  double pi, exactpi;
  int i = 0, j = 0, rep = N;
  struct timespec start, end;
  if (N > 10000) {
    rep = N / 10000;
    N = 10000;
  }
  pi = 0.0;
#pragma omp parallel private(i) firstprivate(pi)
  for (i = 1; i <= 1000; i++) {
    pi = pi + 1.0 / (1.0 + (((double)i) - 0.5) / ((double)1000) *
                               (((double)i) - 0.5) / ((double)1000));
  }
  clock_gettime(CLOCK_MONOTONIC, &start);
#pragma omp parallel private(i, j, pi)
  for (j = 0; j < rep; j++) {
    pi = 0.0;
    for (i = N; i >= 1; i--) {
      pi = pi + 1.0 / (1.0 + (((double)i) - 0.5) / ((double)N) *
                                 (((double)i) - 0.5) / ((double)N));
    }
  }
  clock_gettime(CLOCK_MONOTONIC, &end);
  elapsed_time_hr(start, end, "No Function Calls");
  pi = pi * 4.0 / ((double)N);
  exactpi = 4.0 * atan(1.0);
  sleep(5);
  pi = 0.0;
#pragma omp parallel private(i) firstprivate(pi)
  for (i = 1; i <= 1000; i++) {
    pi = pi + piapprox(i, 1000);
  }
  clock_gettime(CLOCK_MONOTONIC, &start);
#pragma omp parallel private(i, j, pi)
  for (j = 0; j < rep; j++) {
    pi = 0.0;
    for (i = N; i >= 1; i--) {
      pi = pi + piapprox(i, N);
    }
  }
  clock_gettime(CLOCK_MONOTONIC, &end);
  elapsed_time_hr(start, end, "Function Calls");
  pi = pi * 4.0 / ((double)N);
  exactpi = 4.0 * atan(1.0);
  sleep(5);
  i = 1000;
  pi = recur_piapprox(i, N);
  clock_gettime(CLOCK_MONOTONIC, &start);
  i = N;
#pragma omp parallel private(j, pi)
  for (j = 0; j < rep; j++) {
    pi = 0.0;
    pi = recur_piapprox(i, N);
  }
  clock_gettime(CLOCK_MONOTONIC, &end);
  elapsed_time_hr(start, end, "Recursive Function Calls");
  pi = pi * 4.0 / ((double)N);
  exactpi = 4.0 * atan(1.0);
  return 0;
}


x86 assembly (clang, -O0):
<function_calls_recursive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x2710,-0x4(%rbp)
jbe    11a2 <function_calls_recursive+0x42>
mov    -0x4(%rbp),%eax
mov    $0x2710,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x24(%rbp)
movl   $0x2710,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpl   $0x3e8,-0x1c(%rbp)
jg     1230 <function_calls_recursive+0xd0>
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
movsd  0xe50(%rip),%xmm2
subsd  %xmm2,%xmm1
movsd  0xe3c(%rip),%xmm2
divsd  %xmm2,%xmm1
cvtsi2sdl -0x1c(%rbp),%xmm2
movsd  0xe33(%rip),%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe1b(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0xdff(%rip),%xmm2
addsd  %xmm1,%xmm2
movsd  0xdf3(%rip),%xmm1
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b1 <function_calls_recursive+0x51>
mov    0x2db1(%rip),%rax
mov    (%rax),%edi
lea    -0x28(%rbp),%rsi
call   1040 <clock_gettime@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    12dc <function_calls_recursive+0x17c>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jl     12c9 <function_calls_recursive+0x169>
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm3
movsd  0xd91(%rip),%xmm1
addsd  %xmm1,%xmm3
mov    -0x4(%rbp),%eax
cvtsi2sd %rax,%xmm2
movaps %xmm3,%xmm1
divsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm1
divsd  %xmm2,%xmm1
movsd  0xd66(%rip),%xmm2
addsd  %xmm1,%xmm2
movsd  0xd5a(%rip),%xmm1
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    1263 <function_calls_recursive+0x103>
jmp    12ce <function_calls_recursive+0x16e>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1249 <function_calls_recursive+0xe9>
mov    0x2d05(%rip),%rax
mov    (%rax),%edi
lea    -0x30(%rbp),%rsi
call   1040 <clock_gettime@plt>
mov    -0x28(%rbp),%edi
mov    -0x30(%rbp),%esi
lea    0xd2d(%rip),%rdx
call   1030 <elapsed_time_hr@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xcf3(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x4(%rbp),%eax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xcde(%rip),%xmm0
call   1070 <atan@plt>
movaps %xmm0,%xmm1
movsd  0xcc6(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x5,%edi
call   1080 <sleep@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpl   $0x3e8,-0x1c(%rbp)
jg     139f <function_calls_recursive+0x23f>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x1c(%rbp),%edi
mov    $0x3e8,%esi
call   1060 <piapprox@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    135c <function_calls_recursive+0x1fc>
mov    0x2c42(%rip),%rax
mov    (%rax),%edi
lea    -0x28(%rbp),%rsi
call   1040 <clock_gettime@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1423 <function_calls_recursive+0x2c3>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jl     1410 <function_calls_recursive+0x2b0>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1060 <piapprox@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    13d2 <function_calls_recursive+0x272>
jmp    1415 <function_calls_recursive+0x2b5>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    13b8 <function_calls_recursive+0x258>
mov    0x2bbe(%rip),%rax
mov    (%rax),%edi
lea    -0x30(%rbp),%rsi
call   1040 <clock_gettime@plt>
mov    -0x28(%rbp),%edi
mov    -0x30(%rbp),%esi
lea    0xc02(%rip),%rdx
call   1030 <elapsed_time_hr@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xbac(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x4(%rbp),%eax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xb97(%rip),%xmm0
call   1070 <atan@plt>
movaps %xmm0,%xmm1
movsd  0xb7f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x5,%edi
call   1080 <sleep@plt>
movl   $0x3e8,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1050 <recur_piapprox@plt>
movsd  %xmm0,-0x10(%rbp)
mov    0x2b36(%rip),%rax
mov    (%rax),%edi
lea    -0x28(%rbp),%rsi
call   1040 <clock_gettime@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    14fc <function_calls_recursive+0x39c>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1050 <recur_piapprox@plt>
movsd  %xmm0,-0x10(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    14ca <function_calls_recursive+0x36a>
mov    0x2ae5(%rip),%rax
mov    (%rax),%edi
lea    -0x30(%rbp),%rsi
call   1040 <clock_gettime@plt>
mov    -0x28(%rbp),%edi
mov    -0x30(%rbp),%esi
lea    0xb1f(%rip),%rdx
call   1030 <elapsed_time_hr@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xad3(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x4(%rbp),%eax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xabe(%rip),%xmm0
call   1070 <atan@plt>
movaps %xmm0,%xmm1
movsd  0xaa6(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<function_calls_recursive>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %edi,%eax
mov    $0xd1b71759,%r15d
imul   %rax,%r15
shr    $0x2d,%r15
cmp    $0x2711,%edi
mov    $0x2710,%r12d
cmovb  %edi,%r12d
cmovb  %edi,%r15d
mov    0x2e51(%rip),%r14
mov    (%r14),%edi
lea    0x8(%rsp),%rsi
call   1040 <clock_gettime@plt>
mov    (%r14),%edi
mov    %rsp,%rsi
call   1040 <clock_gettime@plt>
mov    0x8(%rsp),%edi
mov    (%rsp),%esi
lea    0xe4b(%rip),%rdx
call   1030 <elapsed_time_hr@plt>
movsd  0xe36(%rip),%xmm0
call   1070 <atan@plt>
mov    $0x5,%edi
call   1080 <sleep@plt>
mov    $0x1,%ebp
xchg   %ax,%ax
mov    %ebp,%edi
mov    $0x3e8,%esi
call   1060 <piapprox@plt>
add    $0x1,%ebp
cmp    $0x3e9,%ebp
jne    11e0 <function_calls_recursive+0x80>
mov    (%r14),%edi
lea    0x8(%rsp),%rsi
call   1040 <clock_gettime@plt>
test   %r15d,%r15d
je     12b3 <function_calls_recursive+0x153>
xor    %ebx,%ebx
jmp    1228 <function_calls_recursive+0xc8>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    %r15d,%ebx
je     1246 <function_calls_recursive+0xe6>
test   %r12d,%r12d
jle    1220 <function_calls_recursive+0xc0>
mov    %r12d,%ebp
mov    %ebp,%edi
mov    %r12d,%esi
call   1060 <piapprox@plt>
lea    -0x1(%rbp),%eax
cmp    $0x1,%ebp
mov    %eax,%ebp
ja     1230 <function_calls_recursive+0xd0>
jmp    1220 <function_calls_recursive+0xc0>
mov    (%r14),%edi
mov    %rsp,%rsi
call   1040 <clock_gettime@plt>
mov    0x8(%rsp),%edi
mov    (%rsp),%esi
lea    0xdc5(%rip),%rdx
call   1030 <elapsed_time_hr@plt>
movsd  0xd94(%rip),%xmm0
call   1070 <atan@plt>
mov    $0x5,%edi
call   1080 <sleep@plt>
mov    $0x3e8,%edi
mov    %r12d,%esi
call   1050 <recur_piapprox@plt>
mov    (%r14),%edi
lea    0x8(%rsp),%rsi
call   1040 <clock_gettime@plt>
test   %r15d,%r15d
je     1302 <function_calls_recursive+0x1a2>
nopw   0x0(%rax,%rax,1)
mov    %r12d,%edi
mov    %r12d,%esi
call   1050 <recur_piapprox@plt>
add    $0xffffffff,%r15d
jne    12a0 <function_calls_recursive+0x140>
jmp    1302 <function_calls_recursive+0x1a2>
mov    (%r14),%edi
mov    %rsp,%rsi
call   1040 <clock_gettime@plt>
mov    0x8(%rsp),%edi
mov    (%rsp),%esi
lea    0xd58(%rip),%rdx
call   1030 <elapsed_time_hr@plt>
movsd  0xd27(%rip),%xmm0
call   1070 <atan@plt>
mov    $0x5,%edi
call   1080 <sleep@plt>
mov    $0x3e8,%edi
mov    %r12d,%esi
call   1050 <recur_piapprox@plt>
mov    (%r14),%edi
lea    0x8(%rsp),%rsi
call   1040 <clock_gettime@plt>
mov    (%r14),%edi
mov    %rsp,%rsi
call   1040 <clock_gettime@plt>
mov    0x8(%rsp),%edi
mov    (%rsp),%esi
lea    0xcff(%rip),%rdx
call   1030 <elapsed_time_hr@plt>
movsd  0xcd8(%rip),%xmm0
call   1070 <atan@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_MONOTONIC = global i32 0
@.str = [18 x i8] c"No Function Calls\00"
@.str.1 = [15 x i8] c"Function Calls\00"
@.str.2 = [25 x i8] c"Recursive Function Calls\00"
define i32 @function_calls_recursive(i32 %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.timespec
%9 = alloca %struct.timespec
store i32 %0, i32* %2
store i32 0, i32* %5
store i32 0, i32* %6
%10 = load i32, i32* %2
store i32 %10, i32* %7
%11 = load i32, i32* %2
%12 = icmp ugt i32 %11, 10000
br i1 %12, label %13, label %16
13: ; preds = %1
%14 = load i32, i32* %2
%15 = udiv i32 %14, 10000
store i32 %15, i32* %7
store i32 10000, i32* %2
br label %16
16: ; preds = %13, %1
store double 0.000000e+00, double* %3
store i32 1, i32* %5
br label %17
17: ; preds = %34, %16
%18 = load i32, i32* %5
%19 = icmp sle i32 %18, 1000
br i1 %19, label %20, label %37
20: ; preds = %17
%21 = load double, double* %3
%22 = load i32, i32* %5
%23 = sitofp i32 %22 to double
%24 = fsub double %23, 5.000000e-01
%25 = fdiv double %24, 1.000000e+03
%26 = load i32, i32* %5
%27 = sitofp i32 %26 to double
%28 = fsub double %27, 5.000000e-01
%29 = fmul double %25, %28
%30 = fdiv double %29, 1.000000e+03
%31 = fadd double 1.000000e+00, %30
%32 = fdiv double 1.000000e+00, %31
%33 = fadd double %21, %32
store double %33, double* %3
br label %34
34: ; preds = %20
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %17
37: ; preds = %17
%38 = load i32, i32* @CLOCK_MONOTONIC
%39 = call i32 @clock_gettime(i32 %38, %struct.timespec* %8)
store i32 0, i32* %6
br label %40
40: ; preds = %71, %37
%41 = load i32, i32* %6
%42 = load i32, i32* %7
%43 = icmp slt i32 %41, %42
br i1 %43, label %44, label %74
44: ; preds = %40
store double 0.000000e+00, double* %3
%45 = load i32, i32* %2
store i32 %45, i32* %5
br label %46
46: ; preds = %67, %44
%47 = load i32, i32* %5
%48 = icmp sge i32 %47, 1
br i1 %48, label %49, label %70
49: ; preds = %46
%50 = load double, double* %3
%51 = load i32, i32* %5
%52 = sitofp i32 %51 to double
%53 = fsub double %52, 5.000000e-01
%54 = load i32, i32* %2
%55 = uitofp i32 %54 to double
%56 = fdiv double %53, %55
%57 = load i32, i32* %5
%58 = sitofp i32 %57 to double
%59 = fsub double %58, 5.000000e-01
%60 = fmul double %56, %59
%61 = load i32, i32* %2
%62 = uitofp i32 %61 to double
%63 = fdiv double %60, %62
%64 = fadd double 1.000000e+00, %63
%65 = fdiv double 1.000000e+00, %64
%66 = fadd double %50, %65
store double %66, double* %3
br label %67
67: ; preds = %49
%68 = load i32, i32* %5
%69 = add nsw i32 %68, -1
store i32 %69, i32* %5
br label %46
70: ; preds = %46
br label %71
71: ; preds = %70
%72 = load i32, i32* %6
%73 = add nsw i32 %72, 1
store i32 %73, i32* %6
br label %40
74: ; preds = %40
%75 = load i32, i32* @CLOCK_MONOTONIC
%76 = call i32 @clock_gettime(i32 %75, %struct.timespec* %9)
%77 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 0
%78 = load i32, i32* %77
%79 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 0
%80 = load i32, i32* %79
%81 = call i32 @elapsed_time_hr(i32 %78, i32 %80, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%82 = load double, double* %3
%83 = fmul double %82, 4.000000e+00
%84 = load i32, i32* %2
%85 = uitofp i32 %84 to double
%86 = fdiv double %83, %85
store double %86, double* %3
%87 = call double @atan(double 1.000000e+00)
%88 = fmul double 4.000000e+00, %87
store double %88, double* %4
%89 = call i32 @sleep(i32 5)
store double 0.000000e+00, double* %3
store i32 1, i32* %5
br label %90
90: ; preds = %98, %74
%91 = load i32, i32* %5
%92 = icmp sle i32 %91, 1000
br i1 %92, label %93, label %101
93: ; preds = %90
%94 = load double, double* %3
%95 = load i32, i32* %5
%96 = call double @piapprox(i32 %95, i32 1000)
%97 = fadd double %94, %96
store double %97, double* %3
br label %98
98: ; preds = %93
%99 = load i32, i32* %5
%100 = add nsw i32 %99, 1
store i32 %100, i32* %5
br label %90
101: ; preds = %90
%102 = load i32, i32* @CLOCK_MONOTONIC
%103 = call i32 @clock_gettime(i32 %102, %struct.timespec* %8)
store i32 0, i32* %6
br label %104
104: ; preds = %123, %101
%105 = load i32, i32* %6
%106 = load i32, i32* %7
%107 = icmp slt i32 %105, %106
br i1 %107, label %108, label %126
108: ; preds = %104
store double 0.000000e+00, double* %3
%109 = load i32, i32* %2
store i32 %109, i32* %5
br label %110
110: ; preds = %119, %108
%111 = load i32, i32* %5
%112 = icmp sge i32 %111, 1
br i1 %112, label %113, label %122
113: ; preds = %110
%114 = load double, double* %3
%115 = load i32, i32* %5
%116 = load i32, i32* %2
%117 = call double @piapprox(i32 %115, i32 %116)
%118 = fadd double %114, %117
store double %118, double* %3
br label %119
119: ; preds = %113
%120 = load i32, i32* %5
%121 = add nsw i32 %120, -1
store i32 %121, i32* %5
br label %110
122: ; preds = %110
br label %123
123: ; preds = %122
%124 = load i32, i32* %6
%125 = add nsw i32 %124, 1
store i32 %125, i32* %6
br label %104
126: ; preds = %104
%127 = load i32, i32* @CLOCK_MONOTONIC
%128 = call i32 @clock_gettime(i32 %127, %struct.timespec* %9)
%129 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 0
%130 = load i32, i32* %129
%131 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 0
%132 = load i32, i32* %131
%133 = call i32 @elapsed_time_hr(i32 %130, i32 %132, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%134 = load double, double* %3
%135 = fmul double %134, 4.000000e+00
%136 = load i32, i32* %2
%137 = uitofp i32 %136 to double
%138 = fdiv double %135, %137
store double %138, double* %3
%139 = call double @atan(double 1.000000e+00)
%140 = fmul double 4.000000e+00, %139
store double %140, double* %4
%141 = call i32 @sleep(i32 5)
store i32 1000, i32* %5
%142 = load i32, i32* %5
%143 = load i32, i32* %2
%144 = call double @recur_piapprox(i32 %142, i32 %143)
store double %144, double* %3
%145 = load i32, i32* @CLOCK_MONOTONIC
%146 = call i32 @clock_gettime(i32 %145, %struct.timespec* %8)
%147 = load i32, i32* %2
store i32 %147, i32* %5
store i32 0, i32* %6
br label %148
148: ; preds = %156, %126
%149 = load i32, i32* %6
%150 = load i32, i32* %7
%151 = icmp slt i32 %149, %150
br i1 %151, label %152, label %159
152: ; preds = %148
store double 0.000000e+00, double* %3
%153 = load i32, i32* %5
%154 = load i32, i32* %2
%155 = call double @recur_piapprox(i32 %153, i32 %154)
store double %155, double* %3
br label %156
156: ; preds = %152
%157 = load i32, i32* %6
%158 = add nsw i32 %157, 1
store i32 %158, i32* %6
br label %148
159: ; preds = %148
%160 = load i32, i32* @CLOCK_MONOTONIC
%161 = call i32 @clock_gettime(i32 %160, %struct.timespec* %9)
%162 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 0
%163 = load i32, i32* %162
%164 = getelementptr inbounds %struct.timespec, %struct.timespec* %9, i32 0, i32 0
%165 = load i32, i32* %164
%166 = call i32 @elapsed_time_hr(i32 %163, i32 %165, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%167 = load double, double* %3
%168 = fmul double %167, 4.000000e+00
%169 = load i32, i32* %2
%170 = uitofp i32 %169 to double
%171 = fdiv double %168, %170
store double %171, double* %3
%172 = call double @atan(double 1.000000e+00)
%173 = fmul double 4.000000e+00, %172
store double %173, double* %4
ret i32 0
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_MONOTONIC = global i32 0
@.str = [18 x i8] c"No Function Calls\00"
@.str.1 = [15 x i8] c"Function Calls\00"
@.str.2 = [25 x i8] c"Recursive Function Calls\00"
define i32 @function_calls_recursive(i32 %0) {
%2 = alloca %struct.timespec
%3 = alloca %struct.timespec
%4 = bitcast %struct.timespec* %2 to i8*
%5 = bitcast %struct.timespec* %3 to i8*
%6 = icmp ugt i32 %0, 10000
%7 = select i1 %6, i32 10000, i32 %0
%8 = udiv i32 %0, 10000
%9 = select i1 %6, i32 %8, i32 %0
%10 = load i32, i32* @CLOCK_MONOTONIC
%11 = call i32 @clock_gettime(i32 %10, %struct.timespec* %2)
%12 = icmp eq i32 %9, 0
%13 = load i32, i32* @CLOCK_MONOTONIC
%14 = call i32 @clock_gettime(i32 %13, %struct.timespec* %3)
%15 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 0
%18 = load i32, i32* %17
%19 = call i32 @elapsed_time_hr(i32 %16, i32 %18, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%20 = call double @atan(double 1.000000e+00)
%21 = call i32 @sleep(i32 5)
br label %22
22: ; preds = %1, %22
%23 = phi i32 [ 1, %1 ], [ %25, %22 ]
%24 = call double @piapprox(i32 %23, i32 1000)
%25 = add nuw nsw i32 %23, 1
%26 = icmp eq i32 %25, 1001
br i1 %26, label %27, label %22
27: ; preds = %22
%28 = load i32, i32* @CLOCK_MONOTONIC
%29 = call i32 @clock_gettime(i32 %28, %struct.timespec* %2)
br i1 %12, label %58, label %30
30: ; preds = %27
%31 = icmp sgt i32 %7, 0
br label %32
32: ; preds = %30, %39
%33 = phi i32 [ 0, %30 ], [ %40, %39 ]
br i1 %31, label %34, label %39
34: ; preds = %32, %34
%35 = phi i32 [ %37, %34 ], [ %7, %32 ]
%36 = call double @piapprox(i32 %35, i32 %7)
%37 = add nsw i32 %35, -1
%38 = icmp ugt i32 %35, 1
br i1 %38, label %34, label %39
39: ; preds = %34, %32
%40 = add nuw nsw i32 %33, 1
%41 = icmp eq i32 %40, %9
br i1 %41, label %42, label %32
42: ; preds = %39
%43 = load i32, i32* @CLOCK_MONOTONIC
%44 = call i32 @clock_gettime(i32 %43, %struct.timespec* %3)
%45 = load i32, i32* %15
%46 = load i32, i32* %17
%47 = call i32 @elapsed_time_hr(i32 %45, i32 %46, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%48 = call double @atan(double 1.000000e+00)
%49 = call i32 @sleep(i32 5)
%50 = call double @recur_piapprox(i32 1000, i32 %7)
%51 = load i32, i32* @CLOCK_MONOTONIC
%52 = call i32 @clock_gettime(i32 %51, %struct.timespec* %2)
br i1 %12, label %69, label %53
53: ; preds = %42, %53
%54 = phi i32 [ %56, %53 ], [ 0, %42 ]
%55 = call double @recur_piapprox(i32 %7, i32 %7)
%56 = add nuw nsw i32 %54, 1
%57 = icmp eq i32 %56, %9
br i1 %57, label %69, label %53
58: ; preds = %27
%59 = load i32, i32* @CLOCK_MONOTONIC
%60 = call i32 @clock_gettime(i32 %59, %struct.timespec* %3)
%61 = load i32, i32* %15
%62 = load i32, i32* %17
%63 = call i32 @elapsed_time_hr(i32 %61, i32 %62, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%64 = call double @atan(double 1.000000e+00)
%65 = call i32 @sleep(i32 5)
%66 = call double @recur_piapprox(i32 1000, i32 %7)
%67 = load i32, i32* @CLOCK_MONOTONIC
%68 = call i32 @clock_gettime(i32 %67, %struct.timespec* %2)
br label %69
69: ; preds = %53, %58, %42
%70 = load i32, i32* @CLOCK_MONOTONIC
%71 = call i32 @clock_gettime(i32 %70, %struct.timespec* %3)
%72 = load i32, i32* %15
%73 = load i32, i32* %17
%74 = call i32 @elapsed_time_hr(i32 %72, i32 %73, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%75 = call double @atan(double 1.000000e+00)
ret i32 0
}