#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 /*<<< orphan*/ printf(char *, ...);
double sqrt(double);
void printStats(int sum, int n, char *caller) {
  double mean = sum / (n + 0.0);
  double var = (sum * (1 - mean)) / (n - 1);
  printf("\nStatistics of %s:\n", caller);
  printf("Number of simulations: %d\n", n);
  printf("Parameter Estimate = %f\n", mean);
  printf("Variance is %f\n", var);
  printf("95%% CI: {%f, %f}\n", mean - 1.96 * sqrt(var / n),
         mean + 1.96 * sqrt(var / n));
}


x86 assembly (clang, -O0):
<printStats>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
xorps  %xmm2,%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xeb7(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xea3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
lea    0xea9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  -0x38(%rbp),%xmm1
movsd  0xe20(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  -0x30(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  0xdd9(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
lea    0xe3a(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printStats>:
push   %rbx
sub    $0x20,%rsp
mov    %esi,%ebx
cvtsi2sd %edi,%xmm0
cvtsi2sd %esi,%xmm1
movsd  %xmm1,0x10(%rsp)
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
movsd  %xmm2,0x18(%rsp)
movsd  0xeb5(%rip),%xmm1
subsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
lea    -0x1(%rbx),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
lea    0xeaa(%rip),%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
divsd  0x10(%rsp),%xmm0
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm0
movapd %xmm1,%xmm2
jae    11fc <printStats+0xdc>
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  %xmm1,0x10(%rsp)
call   1040 <sqrt@plt>
xorpd  %xmm3,%xmm3
movsd  0x10(%rsp),%xmm1
movapd %xmm0,%xmm2
movsd  0x8(%rsp),%xmm0
mulsd  0xe04(%rip),%xmm2
addsd  0x18(%rsp),%xmm2
ucomisd %xmm3,%xmm0
jae    1225 <printStats+0x105>
movsd  %xmm2,0x8(%rsp)
call   1040 <sqrt@plt>
movsd  0x8(%rsp),%xmm2
movapd %xmm0,%xmm1
mulsd  0xde3(%rip),%xmm1
addsd  0x18(%rsp),%xmm1
lea    0xe36(%rip),%rdi
movapd %xmm2,%xmm0
mov    $0x2,%al
add    $0x20,%rsp
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"\0AStatistics of %s:\0A\00"
@.str.1 = [27 x i8] c"Number of simulations: %d\0A\00"
@.str.2 = [25 x i8] c"Parameter Estimate = %f\0A\00"
@.str.3 = [16 x i8] c"Variance is %f\0A\00"
@.str.4 = [19 x i8] c"95%% CI: {%f, %f}\0A\00"
define void @printStats(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca double
%8 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%9 = load i32, i32* %4
%10 = sitofp i32 %9 to double
%11 = load i32, i32* %5
%12 = sitofp i32 %11 to double
%13 = fadd double %12, 0.000000e+00
%14 = fdiv double %10, %13
store double %14, double* %7
%15 = load i32, i32* %4
%16 = sitofp i32 %15 to double
%17 = load double, double* %7
%18 = fsub double 1.000000e+00, %17
%19 = fmul double %16, %18
%20 = load i32, i32* %5
%21 = sub nsw i32 %20, 1
%22 = sitofp i32 %21 to double
%23 = fdiv double %19, %22
store double %23, double* %8
%24 = load i8*, i8** %6
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = load i32, i32* %5
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = load double, double* %7
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), double %28)
%30 = load double, double* %8
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), double %30)
%32 = load double, double* %7
%33 = load double, double* %8
%34 = load i32, i32* %5
%35 = sitofp i32 %34 to double
%36 = fdiv double %33, %35
%37 = call double @sqrt(double %36)
%38 = call double @llvm.fmuladd.f64(double -1.960000e+00, double %37, double %32)
%39 = load double, double* %7
%40 = load double, double* %8
%41 = load i32, i32* %5
%42 = sitofp i32 %41 to double
%43 = fdiv double %40, %42
%44 = call double @sqrt(double %43)
%45 = call double @llvm.fmuladd.f64(double 1.960000e+00, double %44, double %39)
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), double %38, double %45)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"\0AStatistics of %s:\0A\00"
@.str.1 = [27 x i8] c"Number of simulations: %d\0A\00"
@.str.2 = [25 x i8] c"Parameter Estimate = %f\0A\00"
@.str.3 = [16 x i8] c"Variance is %f\0A\00"
@.str.4 = [19 x i8] c"95%% CI: {%f, %f}\0A\00"
define void @printStats(i32 %0, i32 %1, i8* %2) {
%4 = sitofp i32 %0 to double
%5 = sitofp i32 %1 to double
%6 = fdiv double %4, %5
%7 = fsub double 1.000000e+00, %6
%8 = fmul double %7, %4
%9 = add nsw i32 %1, -1
%10 = sitofp i32 %9 to double
%11 = fdiv double %8, %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %2)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), double %6)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), double %11)
%16 = fdiv double %11, %5
%17 = tail call double @sqrt(double %16)
%18 = tail call double @llvm.fmuladd.f64(double %17, double -1.960000e+00, double %6)
%19 = tail call double @sqrt(double %16)
%20 = tail call double @llvm.fmuladd.f64(double %19, double 1.960000e+00, double %6)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), double %18, double %20)
ret void
}