#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 */
double erf(double);
int /*<<< orphan*/ printf(char *, double, double, double);
double sqrt(int);
void evaluate(double x) {
  double probability = erf(x);
  printf("The probability that Normal(0, 1) random variable has a value "
         "between %g and %g is: %g\n",
         -x, x, probability);
  double area = erf(x * sqrt(1 / 2.));
  printf("The integral of a Normal(0, 1) distribution "
         "between %g and %g is: %g\n",
         -x, x, area);
}


x86 assembly (clang, -O0):
<evaluate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <erf@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
xor    %edi,%edi
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1050 <erf@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evaluate>:
sub    $0x28,%rsp
movaps %xmm0,(%rsp)
call   1050 <erf@plt>
movaps %xmm0,%xmm2
movapd 0xeb8(%rip),%xmm0
movapd (%rsp),%xmm1
xorpd  %xmm1,%xmm0
movapd %xmm0,0x10(%rsp)
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <sqrt@plt>
mulsd  (%rsp),%xmm0
call   1050 <erf@plt>
movapd %xmm0,%xmm2
lea    0xee9(%rip),%rdi
movaps 0x10(%rsp),%xmm0
movaps (%rsp),%xmm1
add    $0x28,%rsp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [88 x i8] c"The probability that Normal(0, 1) random variable has a value between %g and %g is: %g\0A\00"
@.str.1 = [70 x i8] c"The integral of a Normal(0, 1) distribution between %g and %g is: %g\0A\00"
define void @evaluate(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
%6 = call double @erf(double %5)
store double %6, double* %3
%7 = load double, double* %2
%8 = fneg double %7
%9 = load double, double* %2
%10 = load double, double* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str, i64 0, i64 0), double %8, double %9, double %10)
%12 = load double, double* %2
%13 = call double @sqrt(i32 0)
%14 = fmul double %12, %13
%15 = call double @erf(double %14)
store double %15, double* %4
%16 = load double, double* %2
%17 = fneg double %16
%18 = load double, double* %2
%19 = load double, double* %4
%20 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.1, i64 0, i64 0), double %17, double %18, double %19)
ret void
}

LLVM IR (-O2):
@.str = [88 x i8] c"The probability that Normal(0, 1) random variable has a value between %g and %g is: %g\0A\00"
@.str.1 = [70 x i8] c"The integral of a Normal(0, 1) distribution between %g and %g is: %g\0A\00"
define void @evaluate(double %0) {
%2 = tail call double @erf(double %0)
%3 = fneg double %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str, i64 0, i64 0), double %3, double %0, double %2)
%5 = tail call double @sqrt(i32 0)
%6 = fmul double %5, %0
%7 = tail call double @erf(double %6)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.1, i64 0, i64 0), double %3, double %0, double %7)
ret void
}