#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 unitqtlP(double);
double normqtlP(double prob, double mean, double var) {
  assert((var > 0) && (prob >= 0) && (prob <= 1));
  if (var == 1)
    return mean + unitqtlP(prob);
  return mean + unitqtlP(prob) * sqrt(var);
}


x86 assembly (clang, -O0):
<normqtlP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x21(%rbp)
jbe    1188 <normqtlP+0x58>
movsd  -0x10(%rbp),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x21(%rbp)
jb     1188 <normqtlP+0x58>
movsd  0xe83(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
setae  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x20(%rbp),%xmm0
movsd  0xe5e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11dc <normqtlP+0xac>
jp     11dc <normqtlP+0xac>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <unitqtlP@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1219 <normqtlP+0xe9>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <unitqtlP@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  -0x40(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normqtlP>:
sub    $0x18,%rsp
movsd  %xmm2,(%rsp)
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm2
seta   %al
movsd  %xmm0,0x10(%rsp)
ucomisd %xmm3,%xmm0
setae  %cl
and    %al,%cl
movsd  0xea5(%rip),%xmm2
ucomisd %xmm0,%xmm2
movsd  %xmm1,0x8(%rsp)
setae  %al
and    %cl,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  0x10(%rsp),%xmm0
call   1040 <unitqtlP@plt>
movsd  (%rsp),%xmm1
movapd %xmm0,%xmm2
ucomisd 0xe72(%rip),%xmm1
jne    119a <normqtlP+0x6a>
jp     119a <normqtlP+0x6a>
addsd  0x8(%rsp),%xmm2
jmp    11ce <normqtlP+0x9e>
ucomisd 0xe66(%rip),%xmm1
jb     11ad <normqtlP+0x7d>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    11c0 <normqtlP+0x90>
movapd %xmm1,%xmm0
movsd  %xmm2,(%rsp)
call   1050 <sqrt@plt>
movsd  (%rsp),%xmm2
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @normqtlP(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 ogt double %8, 0.000000e+00
br i1 %9, label %10, label %16
10: ; preds = %3
%11 = load double, double* %5
%12 = fcmp oge double %11, 0.000000e+00
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load double, double* %5
%15 = fcmp ole double %14, 1.000000e+00
br label %16
16: ; preds = %13, %10, %3
%17 = phi i1 [ false, %10 ], [ false, %3 ], [ %15, %13 ]
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load double, double* %7
%21 = fcmp oeq double %20, 1.000000e+00
br i1 %21, label %22, label %27
22: ; preds = %16
%23 = load double, double* %6
%24 = load double, double* %5
%25 = call double @unitqtlP(double %24)
%26 = fadd double %23, %25
store double %26, double* %4
br label %34
27: ; preds = %16
%28 = load double, double* %6
%29 = load double, double* %5
%30 = call double @unitqtlP(double %29)
%31 = load double, double* %7
%32 = call double @sqrt(double %31)
%33 = call double @llvm.fmuladd.f64(double %30, double %32, double %28)
store double %33, double* %4
br label %34
34: ; preds = %27, %22
%35 = load double, double* %4
ret double %35
}

LLVM IR (-O2):
define double @normqtlP(double %0, double %1, double %2) {
%4 = fcmp ogt double %2, 0.000000e+00
%5 = fcmp oge double %0, 0.000000e+00
%6 = and i1 %5, %4
%7 = fcmp ole double %0, 1.000000e+00
%8 = and i1 %7, %6
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = fcmp oeq double %2, 1.000000e+00
%12 = tail call double @unitqtlP(double %0)
br i1 %11, label %13, label %15
13: ; preds = %3
%14 = fadd double %12, %1
br label %18
15: ; preds = %3
%16 = tail call double @sqrt(double %2)
%17 = tail call double @llvm.fmuladd.f64(double %12, double %16, double %1)
br label %18
18: ; preds = %15, %13
%19 = phi double [ %14, %13 ], [ %17, %15 ]
ret double %19
}