double chdtri(df, y)
double df, y;
{
  double x;
  if ((y < 0.0) || (y > 1.0) || (df < 1.0)) {
    mtherr("chdtri", 1);
    return (0.0);
  }
  x = igami(0.5 * df, y);
  return (2.0 * x);
}


x86 assembly (clang, -O0):
<chdtri>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
ja     116a <chdtri+0x4a>
movsd  -0x18(%rbp),%xmm0
movsd  0xeb3(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     116a <chdtri+0x4a>
movsd  0xea1(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    118a <chdtri+0x6a>
lea    0xea7(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <mtherr@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11be <chdtri+0x9e>
movsd  0xe7e(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    $0x2,%al
call   1030 <igami@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe54(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chdtri>:
push   %rax
movsd  0xed7(%rip),%xmm2
ucomisd %xmm0,%xmm2
ja     115f <chdtri+0x3f>
xorpd  %xmm2,%xmm2
ucomisd %xmm1,%xmm2
ja     115f <chdtri+0x3f>
ucomisd 0xebf(%rip),%xmm1
ja     115f <chdtri+0x3f>
mulsd  0xebd(%rip),%xmm0
mov    $0x2,%al
call   1030 <igami@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  %xmm0,%xmm0
pop    %rax
ret
lea    0xeaa(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <mtherr@plt>
xorpd  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"chdtri\00"
define double @chdtri(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
%7 = load double, double* %5
%8 = fcmp olt double %7, 0.000000e+00
br i1 %8, label %15, label %9
9: ; preds = %2
%10 = load double, double* %5
%11 = fcmp ogt double %10, 1.000000e+00
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = load double, double* %4
%14 = fcmp olt double %13, 1.000000e+00
br i1 %14, label %15, label %17
15: ; preds = %12, %9, %2
%16 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @mtherr to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 1)
store double 0.000000e+00, double* %3
br label %25
17: ; preds = %12
%18 = load double, double* %4
%19 = fmul double 5.000000e-01, %18
%20 = load double, double* %5
%21 = call i32 (double, double, ...) bitcast (i32 (...)* @igami to i32 (double, double, ...)*)(double %19, double %20)
%22 = sitofp i32 %21 to double
store double %22, double* %6
%23 = load double, double* %6
%24 = fmul double 2.000000e+00, %23
store double %24, double* %3
br label %25
25: ; preds = %17, %15
%26 = load double, double* %3
ret double %26
}

LLVM IR (-O2):
@.str = [7 x i8] c"chdtri\00"
define double @chdtri(double %0, double %1) {
%3 = fcmp olt double %1, 0.000000e+00
%4 = fcmp ogt double %1, 1.000000e+00
%5 = or i1 %3, %4
%6 = fcmp olt double %0, 1.000000e+00
%7 = or i1 %6, %5
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @mtherr to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 1)
br label %15
10: ; preds = %2
%11 = fmul double %0, 5.000000e-01
%12 = tail call i32 (double, double, ...) bitcast (i32 (...)* @igami to i32 (double, double, ...)*)(double %11, double %1)
%13 = sitofp i32 %12 to double
%14 = fmul double %13, 2.000000e+00
br label %15
15: ; preds = %10, %8
%16 = phi double [ 0.000000e+00, %8 ], [ %14, %10 ]
ret double %16
}