#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;
scalar_t__ exp(int);
double normal8var();
int /*<<< orphan*/ printf(char *, double, double, double, double);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ seed();
double sqrt(double);
int main(int argc, char *argv[]) {
  double sum = 0;
  double sumSquared = 0;
  double x;
  unsigned int n = 155000000;
  seed();
  puts("Simulation begins");
  for (unsigned int i = 0; i < n; i++) {
    x = normal8var();
    if (x >= 8) {
      sum += exp(32 - 8 * x);
      sumSquared += exp(64 - 16 * x);
    }
  }
  double mean = sum / n;
  double variance = (sumSquared - sum * sum / n) / (n - 1);
  double lower = mean - 1.96 * sqrt(variance / n);
  double upper = mean + 1.96 * sqrt(variance / n);
  printf("The parameter estimate is %.15e\n"
         "The variance is %.15e\n"
         "95%% CI: {%.15e, %.15e}\n",
         mean, variance, lower, upper);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x93d1cc0,-0x2c(%rbp)
mov    $0x0,%al
call   1050 <seed@plt>
lea    0xe9d(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jae    1253 <main+0xf3>
mov    $0x0,%al
call   1060 <normal8var@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe44(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1240 <main+0xe0>
movsd  -0x28(%rbp),%xmm0
movsd  0xe45(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe41(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <exp@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe00(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdfc(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <exp@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1245 <main+0xe5>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11a7 <main+0x47>
movsd  -0x18(%rbp),%xmm0
mov    -0x2c(%rbp),%eax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm1
mov    -0x2c(%rbp),%eax
mov    %eax,%ecx
mov    %ecx,%eax
cvtsi2sd %rcx,%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
add    $0xffffffff,%eax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x2c(%rbp),%eax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
call   1080 <sqrt@plt>
movsd  -0x60(%rbp),%xmm1
movsd  0xd3f(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x2c(%rbp),%eax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
call   1080 <sqrt@plt>
movsd  -0x58(%rbp),%xmm1
movsd  0xcfd(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm3
lea    0xd1f(%rip),%rdi
call   1040 <printf@plt>
mov    0x2ca9(%rip),%rax
mov    (%rax),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
xor    %eax,%eax
call   1050 <seed@plt>
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
xorpd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
mov    $0x93d1cc0,%ebx
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
jmp    11a9 <main+0x49>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0xffffffff,%ebx
je     122b <main+0xcb>
xor    %eax,%eax
call   1060 <normal8var@plt>
ucomisd 0xe48(%rip),%xmm0
jb     11a0 <main+0x40>
movsd  %xmm0,0x10(%rsp)
mulsd  0xe40(%rip),%xmm0
addsd  0xe40(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1070 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xe1b(%rip),%xmm0
addsd  0xe1b(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1070 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
jmp    11a0 <main+0x40>
movsd  0xdf5(%rip),%xmm0
movsd  (%rsp),%xmm2
movapd %xmm2,%xmm4
divsd  %xmm0,%xmm4
mulsd  %xmm2,%xmm2
divsd  %xmm0,%xmm2
movsd  0x8(%rsp),%xmm1
subsd  %xmm2,%xmm1
divsd  0xdd6(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
divsd  %xmm0,%xmm1
sqrtsd %xmm1,%xmm3
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
movapd %xmm3,%xmm2
movsd  %xmm4,0x10(%rsp)
jae    12a9 <main+0x149>
movapd %xmm1,%xmm0
movsd  %xmm3,(%rsp)
movsd  %xmm1,0x18(%rsp)
call   1080 <sqrt@plt>
movsd  0x18(%rsp),%xmm1
movsd  (%rsp),%xmm3
movsd  0x10(%rsp),%xmm4
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
mulsd  0xd87(%rip),%xmm2
addsd  %xmm4,%xmm2
ucomisd %xmm0,%xmm1
jae    12d8 <main+0x178>
movapd %xmm1,%xmm0
movsd  %xmm2,(%rsp)
call   1080 <sqrt@plt>
movsd  (%rsp),%xmm2
movsd  0x10(%rsp),%xmm4
movapd %xmm0,%xmm3
mulsd  0xd60(%rip),%xmm3
addsd  %xmm4,%xmm3
lea    0xd6f(%rip),%rdi
movapd %xmm4,%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <printf@plt>
mov    0x2cdf(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Simulation begins\00"
@.str.1 = [79 x i8] c"The parameter estimate is %.15e\0AThe variance is %.15e\0A95%% CI: {%.15e, %.15e}\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 double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 0.000000e+00, double* %6
store double 0.000000e+00, double* %7
store i32 155000000, i32* %9
%15 = call i32 (...) @seed()
%16 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %10
br label %17
17: ; preds = %41, %2
%18 = load i32, i32* %10
%19 = load i32, i32* %9
%20 = icmp ult i32 %18, %19
br i1 %20, label %21, label %44
21: ; preds = %17
%22 = call double (...) @normal8var()
store double %22, double* %8
%23 = load double, double* %8
%24 = fcmp oge double %23, 8.000000e+00
br i1 %24, label %25, label %40
25: ; preds = %21
%26 = load double, double* %8
%27 = call double @llvm.fmuladd.f64(double -8.000000e+00, double %26, double 3.200000e+01)
%28 = fptosi double %27 to i32
%29 = call i64 @exp(i32 %28)
%30 = sitofp i64 %29 to double
%31 = load double, double* %6
%32 = fadd double %31, %30
store double %32, double* %6
%33 = load double, double* %8
%34 = call double @llvm.fmuladd.f64(double -1.600000e+01, double %33, double 6.400000e+01)
%35 = fptosi double %34 to i32
%36 = call i64 @exp(i32 %35)
%37 = sitofp i64 %36 to double
%38 = load double, double* %7
%39 = fadd double %38, %37
store double %39, double* %7
br label %40
40: ; preds = %25, %21
br label %41
41: ; preds = %40
%42 = load i32, i32* %10
%43 = add i32 %42, 1
store i32 %43, i32* %10
br label %17
44: ; preds = %17
%45 = load double, double* %6
%46 = load i32, i32* %9
%47 = uitofp i32 %46 to double
%48 = fdiv double %45, %47
store double %48, double* %11
%49 = load double, double* %7
%50 = load double, double* %6
%51 = load double, double* %6
%52 = fmul double %50, %51
%53 = load i32, i32* %9
%54 = uitofp i32 %53 to double
%55 = fdiv double %52, %54
%56 = fsub double %49, %55
%57 = load i32, i32* %9
%58 = sub i32 %57, 1
%59 = uitofp i32 %58 to double
%60 = fdiv double %56, %59
store double %60, double* %12
%61 = load double, double* %11
%62 = load double, double* %12
%63 = load i32, i32* %9
%64 = uitofp i32 %63 to double
%65 = fdiv double %62, %64
%66 = call double @sqrt(double %65)
%67 = call double @llvm.fmuladd.f64(double -1.960000e+00, double %66, double %61)
store double %67, double* %13
%68 = load double, double* %11
%69 = load double, double* %12
%70 = load i32, i32* %9
%71 = uitofp i32 %70 to double
%72 = fdiv double %69, %71
%73 = call double @sqrt(double %72)
%74 = call double @llvm.fmuladd.f64(double 1.960000e+00, double %73, double %68)
store double %74, double* %14
%75 = load double, double* %11
%76 = load double, double* %12
%77 = load double, double* %13
%78 = load double, double* %14
%79 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.1, i64 0, i64 0), double %75, double %76, double %77, double %78)
%80 = load i32, i32* @EXIT_SUCCESS
ret i32 %80
}

LLVM IR (-O2):
@.str = [18 x i8] c"Simulation begins\00"
@.str.1 = [79 x i8] c"The parameter estimate is %.15e\0AThe variance is %.15e\0A95%% CI: {%.15e, %.15e}\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @seed()
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %18
5: ; preds = %35
%6 = fdiv double %37, 1.550000e+08
%7 = fmul double %37, %37
%8 = fdiv double %7, 1.550000e+08
%9 = fsub double %36, %8
%10 = fdiv double %9, 0x41A27A397E000000
%11 = fdiv double %10, 1.550000e+08
%12 = tail call double @sqrt(double %11)
%13 = tail call double @llvm.fmuladd.f64(double %12, double -1.960000e+00, double %6)
%14 = tail call double @sqrt(double %11)
%15 = tail call double @llvm.fmuladd.f64(double %14, double 1.960000e+00, double %6)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.1, i64 0, i64 0), double %6, double %10, double %13, double %15)
%17 = load i32, i32* @EXIT_SUCCESS
ret i32 %17
18: ; preds = %2, %35
%19 = phi double [ 0.000000e+00, %2 ], [ %37, %35 ]
%20 = phi double [ 0.000000e+00, %2 ], [ %36, %35 ]
%21 = phi i32 [ 0, %2 ], [ %38, %35 ]
%22 = tail call double (...) @normal8var()
%23 = fcmp ult double %22, 8.000000e+00
br i1 %23, label %35, label %24
24: ; preds = %18
%25 = tail call double @llvm.fmuladd.f64(double %22, double -8.000000e+00, double 3.200000e+01)
%26 = fptosi double %25 to i32
%27 = tail call i64 @exp(i32 %26)
%28 = sitofp i64 %27 to double
%29 = fadd double %19, %28
%30 = tail call double @llvm.fmuladd.f64(double %22, double -1.600000e+01, double 6.400000e+01)
%31 = fptosi double %30 to i32
%32 = tail call i64 @exp(i32 %31)
%33 = sitofp i64 %32 to double
%34 = fadd double %20, %33
br label %35
35: ; preds = %18, %24
%36 = phi double [ %34, %24 ], [ %20, %18 ]
%37 = phi double [ %29, %24 ], [ %19, %18 ]
%38 = add nuw nsw i32 %21, 1
%39 = icmp eq i32 %38, 155000000
br i1 %39, label %5, label %18
}