#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 exp(int);
int pow(double, int);
double sqrt(int);
double probNormal(double a) {
  int i;
  double j;
  double sum;
  double term;
  j = 1;
  sum = 0;
  for (i = 1; i < 200; i += 2) {
    j = j * i;
    term = pow(a, i) / j;
    sum = sum + term;
  }
  return sum * exp(-pow(a, 2) / 2) / sqrt(2 * 3.141592654) + 0.5;
}


x86 assembly (clang, -O0):
<probNormal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xebb(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0xc8,-0xc(%rbp)
jge    11b1 <probNormal+0x81>
movsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1040 <pow@plt>
cvtsi2sd %eax,%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    1159 <probNormal+0x29>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    $0x6,%edi
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  0xdfa(%rip),%xmm1
addsd  %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<probNormal>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0x1,%ebx
movsd  0xeaf(%rip),%xmm0
movapd %xmm0,%xmm1
cs nopw 0x0(%rax,%rax,1)
nop
movsd  %xmm0,0x18(%rsp)
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x10(%rsp),%xmm0
mov    %ebx,%edi
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  (%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0x2(%rbx),%edi
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
movsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <pow@plt>
movsd  (%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  %xmm1,%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
addsd  0xe27(%rip),%xmm0
lea    0x4(%rbx),%eax
cmp    $0xc4,%ebx
mov    %eax,%ebx
jb     1160 <probNormal+0x30>
movsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%edi
shr    $0x1f,%edi
add    %eax,%edi
sar    %edi
neg    %edi
call   1030 <exp@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    $0x6,%edi
call   1050 <sqrt@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
addsd  0xdd8(%rip),%xmm1
movapd %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @probNormal(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %2
store double 1.000000e+00, double* %4
store double 0.000000e+00, double* %5
store i32 1, i32* %3
br label %7
7: ; preds = %24, %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 200
br i1 %9, label %10, label %27
10: ; preds = %7
%11 = load double, double* %4
%12 = load i32, i32* %3
%13 = sitofp i32 %12 to double
%14 = fmul double %11, %13
store double %14, double* %4
%15 = load double, double* %2
%16 = load i32, i32* %3
%17 = call i32 @pow(double %15, i32 %16)
%18 = sitofp i32 %17 to double
%19 = load double, double* %4
%20 = fdiv double %18, %19
store double %20, double* %6
%21 = load double, double* %5
%22 = load double, double* %6
%23 = fadd double %21, %22
store double %23, double* %5
br label %24
24: ; preds = %10
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 2
store i32 %26, i32* %3
br label %7
27: ; preds = %7
%28 = load double, double* %5
%29 = load double, double* %2
%30 = call i32 @pow(double %29, i32 2)
%31 = sub nsw i32 0, %30
%32 = sdiv i32 %31, 2
%33 = call double @exp(i32 %32)
%34 = fmul double %28, %33
%35 = call double @sqrt(i32 6)
%36 = fdiv double %34, %35
%37 = fadd double %36, 5.000000e-01
ret double %37
}

LLVM IR (-O2):
define double @probNormal(double %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 1, %1 ], [ %19, %2 ]
%4 = phi double [ 0.000000e+00, %1 ], [ %18, %2 ]
%5 = phi double [ 1.000000e+00, %1 ], [ %14, %2 ]
%6 = sitofp i32 %3 to double
%7 = fmul double %5, %6
%8 = tail call i32 @pow(double %0, i32 %3)
%9 = sitofp i32 %8 to double
%10 = fdiv double %9, %7
%11 = fadd double %4, %10
%12 = add nuw nsw i32 %3, 2
%13 = sitofp i32 %12 to double
%14 = fmul double %7, %13
%15 = tail call i32 @pow(double %0, i32 %12)
%16 = sitofp i32 %15 to double
%17 = fdiv double %16, %14
%18 = fadd double %11, %17
%19 = add nuw nsw i32 %3, 4
%20 = icmp ult i32 %3, 196
br i1 %20, label %2, label %21
21: ; preds = %2
%22 = tail call i32 @pow(double %0, i32 2)
%23 = sdiv i32 %22, -2
%24 = tail call double @exp(i32 %23)
%25 = fmul double %18, %24
%26 = tail call double @sqrt(i32 6)
%27 = fdiv double %25, %26
%28 = fadd double %27, 5.000000e-01
ret double %28
}