long double fdtril(ia, ib, y)
int ia, ib;
long double y;
{
  long double a, b, w, x;
  if ((ia < 1) || (ib < 1) || (y <= 0.0L) || (y > 1.0L)) {
    mtherr("fdtril", 1);
    return (0.0L);
  }
  a = ia;
  b = ib;
  w = incbetl(0.5L * b, 0.5L * a, 0.5L);
  if (w > y || y < 0.001L) {
    w = incbil(0.5L * b, 0.5L * a, y);
    x = (b - b * w) / (a * w);
  } else {
    w = incbil(0.5L * a, 0.5L * b, 1.0L - y);
    x = b * w / (a * (1.0L - w));
  }
  return (x);
}


x86 assembly (clang, -O0):
<fdtril>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
fldt   0x10(%rbp)
mov    %edi,-0x14(%rbp)
mov    %esi,-0x18(%rbp)
fstpt  -0x30(%rbp)
cmpl   $0x1,-0x14(%rbp)
jl     1185 <fdtril+0x55>
cmpl   $0x1,-0x18(%rbp)
jl     1185 <fdtril+0x55>
fldt   -0x30(%rbp)
fldz
fucomip %st(1),%st
fstp   %st(0)
jae    1185 <fdtril+0x55>
jmp    116f <fdtril+0x3f>
fldt   -0x30(%rbp)
fld1
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jbe    11a2 <fdtril+0x72>
jmp    1185 <fdtril+0x55>
lea    0xe94(%rip),%rdi
xor    %eax,%eax
mov    $0x1,%esi
call   1050 <mtherr@plt>
fldz
fstpt  -0x10(%rbp)
jmp    12c1 <fdtril+0x191>
mov    -0x14(%rbp),%eax
mov    %eax,-0x7c(%rbp)
fildl  -0x7c(%rbp)
fstpt  -0x40(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x78(%rbp)
fildl  -0x78(%rbp)
fstpt  -0x50(%rbp)
fldt   -0x50(%rbp)
flds   0xe3d(%rip)
fmul   %st,%st(1)
fldt   -0x40(%rbp)
fmul   %st(1),%st
mov    %rsp,%rax
fxch   %st(1)
fstpt  0x20(%rax)
fstpt  0x10(%rax)
fstpt  (%rax)
xor    %eax,%eax
call   1030 <incbetl@plt>
mov    %eax,-0x74(%rbp)
fildl  -0x74(%rbp)
fstpt  -0x60(%rbp)
fldt   -0x60(%rbp)
fldt   -0x30(%rbp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
ja     1216 <fdtril+0xe6>
jmp    11fe <fdtril+0xce>
fldt   -0x30(%rbp)
fldt   0xe09(%rip)
fucomip %st(1),%st
fstp   %st(0)
jbe    1265 <fdtril+0x135>
jmp    1216 <fdtril+0xe6>
fldt   -0x50(%rbp)
flds   0xde1(%rip)
fmul   %st,%st(1)
fldt   -0x40(%rbp)
fmulp  %st,%st(1)
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  0x20(%rax)
fstpt  0x10(%rax)
fstpt  (%rax)
xor    %eax,%eax
call   1040 <incbil@plt>
mov    %eax,-0x84(%rbp)
fildl  -0x84(%rbp)
fstpt  -0x60(%rbp)
fldt   -0x50(%rbp)
fldt   -0x60(%rbp)
fld    %st(1)
fmul   %st(1),%st
fsubrp %st,%st(2)
fldt   -0x40(%rbp)
fmulp  %st,%st(1)
fdivrp %st,%st(1)
fstpt  -0x70(%rbp)
jmp    12bb <fdtril+0x18b>
fldt   -0x40(%rbp)
flds   0xd92(%rip)
fmul   %st,%st(1)
fldt   -0x50(%rbp)
fmulp  %st,%st(1)
fldt   -0x30(%rbp)
fld1
fld    %st(0)
fstpt  -0x90(%rbp)
fsubp  %st,%st(1)
mov    %rsp,%rax
fstpt  0x20(%rax)
fstpt  0x10(%rax)
fstpt  (%rax)
xor    %eax,%eax
call   1040 <incbil@plt>
fldt   -0x90(%rbp)
mov    %eax,-0x80(%rbp)
fildl  -0x80(%rbp)
fstpt  -0x60(%rbp)
fldt   -0x50(%rbp)
fldt   -0x60(%rbp)
fmul   %st,%st(1)
fldt   -0x40(%rbp)
fxch   %st(3)
fsubp  %st,%st(1)
fmulp  %st,%st(2)
fdivp  %st,%st(1)
fstpt  -0x70(%rbp)
fldt   -0x70(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdtril>:
sub    $0x98,%rsp
fldt   0xa0(%rsp)
fld1
fxch   %st(1)
fucomi %st(1),%st
ja     1219 <fdtril+0xe9>
test   %edi,%edi
jle    1219 <fdtril+0xe9>
test   %esi,%esi
jle    1219 <fdtril+0xe9>
fldz
fucomip %st(1),%st
jae    1219 <fdtril+0xe9>
fxch   %st(1)
fstpt  0x80(%rsp)
mov    %edi,0x44(%rsp)
fildl  0x44(%rsp)
mov    %esi,0x48(%rsp)
fxch   %st(1)
fstpt  0x8c(%rsp)
fildl  0x48(%rsp)
flds   0xe74(%rip)
fld    %st(1)
fstpt  0x68(%rsp)
fmul   %st,%st(1)
fld    %st(2)
fstpt  0x74(%rsp)
fmul   %st,%st(2)
fstpt  0x20(%rsp)
fld    %st(1)
fstpt  0x50(%rsp)
fxch   %st(1)
fstpt  0x10(%rsp)
fld    %st(0)
fstpt  0x5c(%rsp)
fstpt  (%rsp)
xor    %eax,%eax
call   1030 <incbetl@plt>
fldt   0x8c(%rsp)
mov    %eax,0x4c(%rsp)
fildl  0x4c(%rsp)
fldt   0xe3f(%rip)
fucomip %st(2),%st
ja     123a <fdtril+0x10a>
fucomip %st(1),%st
fldz
ja     123a <fdtril+0x10a>
fstp   %st(0)
fldt   0x80(%rsp)
fsubp  %st,%st(1)
fstpt  0x20(%rsp)
fldt   0x5c(%rsp)
fstpt  0x10(%rsp)
fldt   0x50(%rsp)
fstpt  (%rsp)
xor    %eax,%eax
call   1040 <incbil@plt>
mov    %eax,0x40(%rsp)
fildl  0x40(%rsp)
fldt   0x68(%rsp)
fmul   %st(1),%st
fldt   0x80(%rsp)
fsubp  %st,%st(2)
jmp    1268 <fdtril+0x138>
fstp   %st(1)
fstp   %st(0)
lea    0xdfc(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <mtherr@plt>
fldz
add    $0x98,%rsp
ret
fstp   %st(0)
fstpt  0x20(%rsp)
fldt   0x50(%rsp)
fstpt  0x10(%rsp)
fldt   0x5c(%rsp)
fstpt  (%rsp)
xor    %eax,%eax
call   1040 <incbil@plt>
mov    %eax,0x3c(%rsp)
fildl  0x3c(%rsp)
fldt   0x68(%rsp)
fld    %st(0)
fmul   %st(2),%st
fsubrp %st,%st(1)
fldt   0x74(%rsp)
fmulp  %st,%st(2)
fdivp  %st,%st(1)
add    $0x98,%rsp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"fdtril\00"
define x86_fp80 @fdtril(i32 %0, i32 %1, x86_fp80 %2) {
%4 = alloca x86_fp80
%5 = alloca i32
%6 = alloca i32
%7 = alloca x86_fp80
%8 = alloca x86_fp80
%9 = alloca x86_fp80
%10 = alloca x86_fp80
%11 = alloca x86_fp80
store i32 %0, i32* %5
store i32 %1, i32* %6
store x86_fp80 %2, x86_fp80* %7
%12 = load i32, i32* %5
%13 = icmp slt i32 %12, 1
br i1 %13, label %23, label %14
14: ; preds = %3
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 1
br i1 %16, label %23, label %17
17: ; preds = %14
%18 = load x86_fp80, x86_fp80* %7
%19 = fcmp ole x86_fp80 %18, 0xK00000000000000000000
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = load x86_fp80, x86_fp80* %7
%22 = fcmp ogt x86_fp80 %21, 0xK3FFF8000000000000000
br i1 %22, label %23, label %25
23: ; preds = %20, %17, %14, %3
%24 = 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 x86_fp80 0xK00000000000000000000, x86_fp80* %4
br label %78
25: ; preds = %20
%26 = load i32, i32* %5
%27 = sitofp i32 %26 to x86_fp80
store x86_fp80 %27, x86_fp80* %8
%28 = load i32, i32* %6
%29 = sitofp i32 %28 to x86_fp80
store x86_fp80 %29, x86_fp80* %9
%30 = load x86_fp80, x86_fp80* %9
%31 = fmul x86_fp80 0xK3FFE8000000000000000, %30
%32 = load x86_fp80, x86_fp80* %8
%33 = fmul x86_fp80 0xK3FFE8000000000000000, %32
%34 = call i32 (x86_fp80, x86_fp80, x86_fp80, ...) bitcast (i32 (...)* @incbetl to i32 (x86_fp80, x86_fp80, x86_fp80, ...)*)(x86_fp80 %31, x86_fp80 %33, x86_fp80 0xK3FFE8000000000000000)
%35 = sitofp i32 %34 to x86_fp80
store x86_fp80 %35, x86_fp80* %10
%36 = load x86_fp80, x86_fp80* %10
%37 = load x86_fp80, x86_fp80* %7
%38 = fcmp ogt x86_fp80 %36, %37
br i1 %38, label %42, label %39
39: ; preds = %25
%40 = load x86_fp80, x86_fp80* %7
%41 = fcmp olt x86_fp80 %40, 0xK3FF583126E978D4FDF3B
br i1 %41, label %42, label %59
42: ; preds = %39, %25
%43 = load x86_fp80, x86_fp80* %9
%44 = fmul x86_fp80 0xK3FFE8000000000000000, %43
%45 = load x86_fp80, x86_fp80* %8
%46 = fmul x86_fp80 0xK3FFE8000000000000000, %45
%47 = load x86_fp80, x86_fp80* %7
%48 = call i32 (x86_fp80, x86_fp80, x86_fp80, ...) bitcast (i32 (...)* @incbil to i32 (x86_fp80, x86_fp80, x86_fp80, ...)*)(x86_fp80 %44, x86_fp80 %46, x86_fp80 %47)
%49 = sitofp i32 %48 to x86_fp80
store x86_fp80 %49, x86_fp80* %10
%50 = load x86_fp80, x86_fp80* %9
%51 = load x86_fp80, x86_fp80* %9
%52 = load x86_fp80, x86_fp80* %10
%53 = fneg x86_fp80 %51
%54 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %53, x86_fp80 %52, x86_fp80 %50)
%55 = load x86_fp80, x86_fp80* %8
%56 = load x86_fp80, x86_fp80* %10
%57 = fmul x86_fp80 %55, %56
%58 = fdiv x86_fp80 %54, %57
store x86_fp80 %58, x86_fp80* %11
br label %76
59: ; preds = %39
%60 = load x86_fp80, x86_fp80* %8
%61 = fmul x86_fp80 0xK3FFE8000000000000000, %60
%62 = load x86_fp80, x86_fp80* %9
%63 = fmul x86_fp80 0xK3FFE8000000000000000, %62
%64 = load x86_fp80, x86_fp80* %7
%65 = fsub x86_fp80 0xK3FFF8000000000000000, %64
%66 = call i32 (x86_fp80, x86_fp80, x86_fp80, ...) bitcast (i32 (...)* @incbil to i32 (x86_fp80, x86_fp80, x86_fp80, ...)*)(x86_fp80 %61, x86_fp80 %63, x86_fp80 %65)
%67 = sitofp i32 %66 to x86_fp80
store x86_fp80 %67, x86_fp80* %10
%68 = load x86_fp80, x86_fp80* %9
%69 = load x86_fp80, x86_fp80* %10
%70 = fmul x86_fp80 %68, %69
%71 = load x86_fp80, x86_fp80* %8
%72 = load x86_fp80, x86_fp80* %10
%73 = fsub x86_fp80 0xK3FFF8000000000000000, %72
%74 = fmul x86_fp80 %71, %73
%75 = fdiv x86_fp80 %70, %74
store x86_fp80 %75, x86_fp80* %11
br label %76
76: ; preds = %59, %42
%77 = load x86_fp80, x86_fp80* %11
store x86_fp80 %77, x86_fp80* %4
br label %78
78: ; preds = %76, %23
%79 = load x86_fp80, x86_fp80* %4
ret x86_fp80 %79
}

LLVM IR (-O2):
@.str = [7 x i8] c"fdtril\00"
define x86_fp80 @fdtril(i32 %0, i32 %1, x86_fp80 %2) {
%4 = icmp slt i32 %0, 1
%5 = icmp slt i32 %1, 1
%6 = or i1 %4, %5
%7 = fcmp ole x86_fp80 %2, 0xK00000000000000000000
%8 = or i1 %6, %7
%9 = fcmp ogt x86_fp80 %2, 0xK3FFF8000000000000000
%10 = or i1 %9, %8
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = 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 %38
13: ; preds = %3
%14 = sitofp i32 %0 to x86_fp80
%15 = sitofp i32 %1 to x86_fp80
%16 = fmul x86_fp80 %15, 0xK3FFE8000000000000000
%17 = fmul x86_fp80 %14, 0xK3FFE8000000000000000
%18 = tail call i32 (x86_fp80, x86_fp80, x86_fp80, ...) bitcast (i32 (...)* @incbetl to i32 (x86_fp80, x86_fp80, x86_fp80, ...)*)(x86_fp80 %16, x86_fp80 %17, x86_fp80 0xK3FFE8000000000000000)
%19 = sitofp i32 %18 to x86_fp80
%20 = fcmp ogt x86_fp80 %19, %2
%21 = fcmp olt x86_fp80 %2, 0xK3FF583126E978D4FDF3B
%22 = or i1 %21, %20
br i1 %22, label %23, label %30
23: ; preds = %13
%24 = tail call i32 (x86_fp80, x86_fp80, x86_fp80, ...) bitcast (i32 (...)* @incbil to i32 (x86_fp80, x86_fp80, x86_fp80, ...)*)(x86_fp80 %16, x86_fp80 %17, x86_fp80 %2)
%25 = sitofp i32 %24 to x86_fp80
%26 = fneg x86_fp80 %15
%27 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %26, x86_fp80 %25, x86_fp80 %15)
%28 = fmul x86_fp80 %14, %25
%29 = fdiv x86_fp80 %27, %28
br label %38
30: ; preds = %13
%31 = fsub x86_fp80 0xK3FFF8000000000000000, %2
%32 = tail call i32 (x86_fp80, x86_fp80, x86_fp80, ...) bitcast (i32 (...)* @incbil to i32 (x86_fp80, x86_fp80, x86_fp80, ...)*)(x86_fp80 %17, x86_fp80 %16, x86_fp80 %31)
%33 = sitofp i32 %32 to x86_fp80
%34 = fmul x86_fp80 %15, %33
%35 = fsub x86_fp80 0xK3FFF8000000000000000, %33
%36 = fmul x86_fp80 %35, %14
%37 = fdiv x86_fp80 %34, %36
br label %38
38: ; preds = %23, %30, %11
%39 = phi x86_fp80 [ 0xK00000000000000000000, %11 ], [ %29, %23 ], [ %37, %30 ]
ret x86_fp80 %39
}