#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*/ fabs(int);
double invibeta(int /*<<< orphan*/, double, double);
int sqrt(double);
double qt(double p, double df) {
  double t;
  t = invibeta(fabs(2 * p - 1), 0.5, df / 2);
  return ((p > 0.5 ? 1 : -1) * sqrt(t * df / (1 - t)));
}


x86 assembly (clang, -O0):
<qt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xec5(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <fabs@plt>
mov    %eax,%edi
movsd  -0x10(%rbp),%xmm1
movsd  0xea1(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe8d(%rip),%xmm0
call   1040 <invibeta@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe76(%rip),%xmm1
mov    $0xffffffff,%eax
mov    $0x1,%ecx
ucomisd %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0x1c(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xe48(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qt>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
addsd  0xeb0(%rip),%xmm1
cvttsd2si %xmm1,%edi
call   1030 <fabs@plt>
movsd  0xea7(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
mov    %eax,%edi
call   1040 <invibeta@plt>
movsd  0x8(%rsp),%xmm2
mulsd  %xmm0,%xmm2
movsd  0xe8c(%rip),%xmm1
subsd  %xmm0,%xmm1
divsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
call   1050 <sqrt@plt>
mov    %eax,%ecx
neg    %ecx
movsd  0x10(%rsp),%xmm0
ucomisd 0xe61(%rip),%xmm0
cmova  %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @qt(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %6, double -1.000000e+00)
%8 = fptosi double %7 to i32
%9 = call i32 @fabs(i32 %8)
%10 = load double, double* %4
%11 = fdiv double %10, 2.000000e+00
%12 = call double @invibeta(i32 %9, double 5.000000e-01, double %11)
store double %12, double* %5
%13 = load double, double* %3
%14 = fcmp ogt double %13, 5.000000e-01
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 1, i32 -1
%17 = load double, double* %5
%18 = load double, double* %4
%19 = fmul double %17, %18
%20 = load double, double* %5
%21 = fsub double 1.000000e+00, %20
%22 = fdiv double %19, %21
%23 = call i32 @sqrt(double %22)
%24 = mul nsw i32 %16, %23
%25 = sitofp i32 %24 to double
ret double %25
}

LLVM IR (-O2):
define double @qt(double %0, double %1) {
%3 = tail call double @llvm.fmuladd.f64(double %0, double 2.000000e+00, double -1.000000e+00)
%4 = fptosi double %3 to i32
%5 = tail call i32 @fabs(i32 %4)
%6 = fmul double %1, 5.000000e-01
%7 = tail call double @invibeta(i32 %5, double 5.000000e-01, double %6)
%8 = fcmp ogt double %0, 5.000000e-01
%9 = fmul double %7, %1
%10 = fsub double 1.000000e+00, %7
%11 = fdiv double %9, %10
%12 = tail call i32 @sqrt(double %11)
%13 = sub nsw i32 0, %12
%14 = select i1 %8, i32 %12, i32 %13
%15 = sitofp i32 %14 to double
ret double %15
}