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


x86 assembly (clang, -O0):
<probNormal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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    11b5 <probNormal+0x85>
cvtsi2sdl -0xc(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    1159 <probNormal+0x29>
movsd  -0x8(%rbp),%xmm0
movsd  0xe56(%rip),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe28(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  0xe0a(%rip),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  0xde1(%rip),%xmm1
addsd  %xmm1,%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<probNormal>:
push   %rbx
sub    $0x30,%rsp
movapd %xmm0,0x20(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xec3(%rip),%xmm1
mov    $0xfffffffd,%ebx
movapd %xmm1,%xmm2
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm1,0x18(%rsp)
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x10(%rsp)
movapd 0x20(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
call   1040 <pow@plt>
divsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0x6(%rbx),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0x10(%rsp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movapd 0x20(%rsp),%xmm0
call   1040 <pow@plt>
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm1
divsd  %xmm2,%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
addsd  0xe3c(%rip),%xmm1
add    $0x4,%ebx
cmp    $0xc4,%ebx
jb     1150 <probNormal+0x30>
movapd 0xe3d(%rip),%xmm0
movapd 0x20(%rsp),%xmm1
xorpd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  0xe17(%rip),%xmm0
call   1030 <exp@plt>
mulsd  0x8(%rsp),%xmm0
divsd  0xe0c(%rip),%xmm0
addsd  0xdfc(%rip),%xmm0
add    $0x30,%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
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = 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 %11
11: ; preds = %14, %1
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 200
br i1 %13, label %14, label %31
14: ; preds = %11
%15 = load i32, i32* %3
%16 = sitofp i32 %15 to double
%17 = load double, double* %4
%18 = fmul double %17, %16
store double %18, double* %4
%19 = load double, double* %2
%20 = load i32, i32* %3
%21 = sitofp i32 %20 to double
%22 = call double @pow(double %19, double %21)
store double %22, double* %7
%23 = load double, double* %7
%24 = load double, double* %4
%25 = fdiv double %23, %24
store double %25, double* %6
%26 = load double, double* %6
%27 = load double, double* %5
%28 = fadd double %27, %26
store double %28, double* %5
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 2
store i32 %30, i32* %3
br label %11
31: ; preds = %11
%32 = load double, double* %2
%33 = call double @pow(double %32, double 2.000000e+00)
store double %33, double* %8
%34 = load double, double* %8
%35 = fneg double %34
%36 = fdiv double %35, 2.000000e+00
%37 = call double @exp(double %36)
store double %37, double* %9
%38 = call double @sqrt(double 0x401921FB54524550)
store double %38, double* %10
%39 = load double, double* %5
%40 = load double, double* %9
%41 = fmul double %39, %40
%42 = load double, double* %10
%43 = fdiv double %41, %42
%44 = fadd double %43, 5.000000e-01
ret double %44
}

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