#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 normqtlQ(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):
<normqtlQ>:
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 <normqtlQ+0x58>
movsd  -0x10(%rbp),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x21(%rbp)
jb     1188 <normqtlQ+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 <normqtlQ+0xac>
jp     11dc <normqtlQ+0xac>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <unitqtlP@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1230 <normqtlQ+0x100>
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
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%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):
<normqtlQ>:
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    11a1 <normqtlQ+0x71>
jp     11a1 <normqtlQ+0x71>
movsd  0x8(%rsp),%xmm0
subsd  %xmm2,%xmm0
add    $0x18,%rsp
ret
ucomisd 0xe5f(%rip),%xmm1
jb     11b4 <normqtlQ+0x84>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    11c7 <normqtlQ+0x97>
movapd %xmm1,%xmm0
movsd  %xmm2,(%rsp)
call   1050 <sqrt@plt>
movsd  (%rsp),%xmm2
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm2
subsd  %xmm2,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @normqtlQ(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 = fsub double %23, %25
store double %26, double* %4
br label %35
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 = fneg double %30
%34 = call double @llvm.fmuladd.f64(double %33, double %32, double %28)
store double %34, double* %4
br label %35
35: ; preds = %27, %22
%36 = load double, double* %4
ret double %36
}

LLVM IR (-O2):
define double @normqtlQ(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 = fsub double %1, %12
br label %19
15: ; preds = %3
%16 = tail call double @sqrt(double %2)
%17 = fneg double %12
%18 = tail call double @llvm.fmuladd.f64(double %17, double %16, double %1)
br label %19
19: ; preds = %15, %13
%20 = phi double [ %14, %13 ], [ %18, %15 ]
ret double %20
}