#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*/ assert(int);
double sqrt(double);
double unitcdfP(double);
double normcdfP(double x, double mean, double var) {
  assert(var >= 0);
  if (var == 1)
    return unitcdfP(x - mean);
  return unitcdfP((x - mean) / sqrt(var));
}


x86 assembly (clang, -O0):
<normcdfP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x20(%rbp),%xmm0
movsd  0xe93(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1196 <normcdfP+0x66>
jp     1196 <normcdfP+0x66>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
call   1040 <unitcdfP@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11c5 <normcdfP+0x95>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
divsd  %xmm1,%xmm0
call   1040 <unitcdfP@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normcdfP>:
sub    $0x18,%rsp
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,(%rsp)
xorpd  %xmm0,%xmm0
xor    %edi,%edi
ucomisd %xmm0,%xmm2
setae  %dil
call   1030 <assert@plt>
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
ucomisd 0xe95(%rip),%xmm0
subsd  0x10(%rsp),%xmm1
jne    1175 <normcdfP+0x45>
jnp    1198 <normcdfP+0x68>
ucomisd 0xe8b(%rip),%xmm0
jb     1185 <normcdfP+0x55>
sqrtsd %xmm0,%xmm0
jmp    1194 <normcdfP+0x64>
movsd  %xmm1,(%rsp)
call   1050 <sqrt@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
jmp    1040 <unitcdfP@plt>

LLVM IR (-O0):
define double @normcdfP(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%8 = load double, double* %7
%9 = fcmp oge double %8, 0.000000e+00
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load double, double* %7
%13 = fcmp oeq double %12, 1.000000e+00
br i1 %13, label %14, label %19
14: ; preds = %3
%15 = load double, double* %5
%16 = load double, double* %6
%17 = fsub double %15, %16
%18 = call double @unitcdfP(double %17)
store double %18, double* %4
br label %27
19: ; preds = %3
%20 = load double, double* %5
%21 = load double, double* %6
%22 = fsub double %20, %21
%23 = load double, double* %7
%24 = call double @sqrt(double %23)
%25 = fdiv double %22, %24
%26 = call double @unitcdfP(double %25)
store double %26, double* %4
br label %27
27: ; preds = %19, %14
%28 = load double, double* %4
ret double %28
}

LLVM IR (-O2):
define double @normcdfP(double %0, double %1, double %2) {
%4 = fcmp oge double %2, 0.000000e+00
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = fcmp oeq double %2, 1.000000e+00
%8 = fsub double %0, %1
br i1 %7, label %12, label %9
9: ; preds = %3
%10 = tail call double @sqrt(double %2)
%11 = fdiv double %8, %10
br label %12
12: ; preds = %3, %9
%13 = phi double [ %11, %9 ], [ %8, %3 ]
%14 = tail call double @unitcdfP(double %13)
ret double %14
}