long double nbdtril(k, n, p)
int k, n;
long double p;
{
  long double dk, dn, w;
  if ((p < 0.0L) || (p > 1.0L))
    goto domerr;
  if (k < 0) {
  domerr:
    mtherr("nbdtrl", 1);
    return (0.0L);
  }
  dk = k + 1;
  dn = n;
  w = incbil(dn, dk, p);
  return (w);
}


x86 assembly (clang, -O0):
<nbdtril>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
fldt   0x10(%rbp)
mov    %edi,-0x14(%rbp)
mov    %esi,-0x18(%rbp)
fstpt  -0x30(%rbp)
fldt   -0x30(%rbp)
fldz
fucomip %st(1),%st
fstp   %st(0)
ja     1161 <nbdtril+0x41>
jmp    114b <nbdtril+0x2b>
fldt   -0x30(%rbp)
fld1
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jbe    1166 <nbdtril+0x46>
jmp    1161 <nbdtril+0x41>
jmp    1175 <nbdtril+0x55>
cmpl   $0x0,-0x14(%rbp)
jge    1192 <nbdtril+0x72>
jmp    1175 <nbdtril+0x55>
lea    0xe84(%rip),%rdi
xor    %eax,%eax
mov    $0x1,%esi
call   1040 <mtherr@plt>
fldz
fstpt  -0x10(%rbp)
jmp    11d7 <nbdtril+0xb7>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
fildl  -0x6c(%rbp)
fstpt  -0x40(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x68(%rbp)
fildl  -0x68(%rbp)
fstpt  -0x50(%rbp)
fldt   -0x50(%rbp)
fldt   -0x40(%rbp)
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  0x20(%rax)
fstpt  0x10(%rax)
fstpt  (%rax)
xor    %eax,%eax
call   1030 <incbil@plt>
mov    %eax,-0x64(%rbp)
fildl  -0x64(%rbp)
fstpt  -0x60(%rbp)
fldt   -0x60(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nbdtril>:
sub    $0x48,%rsp
fldt   0x50(%rsp)
test   %edi,%edi
js     1172 <nbdtril+0x52>
fldz
fucomip %st(1),%st
ja     1172 <nbdtril+0x52>
fld1
fxch   %st(1)
fucomi %st(1),%st
fstp   %st(1)
ja     1172 <nbdtril+0x52>
add    $0x1,%edi
mov    %edi,0x40(%rsp)
fildl  0x40(%rsp)
mov    %esi,0x3c(%rsp)
fildl  0x3c(%rsp)
fxch   %st(2)
fstpt  0x20(%rsp)
fxch   %st(1)
fstpt  (%rsp)
fstpt  0x10(%rsp)
xor    %eax,%eax
call   1030 <incbil@plt>
mov    %eax,0x44(%rsp)
fildl  0x44(%rsp)
add    $0x48,%rsp
ret
fstp   %st(0)
lea    0xe85(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <mtherr@plt>
fldz
add    $0x48,%rsp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"nbdtrl\00"
define x86_fp80 @nbdtril(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
store i32 %0, i32* %5
store i32 %1, i32* %6
store x86_fp80 %2, x86_fp80* %7
%11 = load x86_fp80, x86_fp80* %7
%12 = fcmp olt x86_fp80 %11, 0xK00000000000000000000
br i1 %12, label %16, label %13
13: ; preds = %3
%14 = load x86_fp80, x86_fp80* %7
%15 = fcmp ogt x86_fp80 %14, 0xK3FFF8000000000000000
br i1 %15, label %16, label %17
16: ; preds = %13, %3
br label %21
17: ; preds = %13
%18 = load i32, i32* %5
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %17
br label %21
21: ; preds = %20, %16
%22 = 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 %35
23: ; preds = %17
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
%26 = sitofp i32 %25 to x86_fp80
store x86_fp80 %26, x86_fp80* %8
%27 = load i32, i32* %6
%28 = sitofp i32 %27 to x86_fp80
store x86_fp80 %28, x86_fp80* %9
%29 = load x86_fp80, x86_fp80* %9
%30 = load x86_fp80, x86_fp80* %8
%31 = load x86_fp80, x86_fp80* %7
%32 = call i32 (x86_fp80, x86_fp80, x86_fp80, ...) bitcast (i32 (...)* @incbil to i32 (x86_fp80, x86_fp80, x86_fp80, ...)*)(x86_fp80 %29, x86_fp80 %30, x86_fp80 %31)
%33 = sitofp i32 %32 to x86_fp80
store x86_fp80 %33, x86_fp80* %10
%34 = load x86_fp80, x86_fp80* %10
store x86_fp80 %34, x86_fp80* %4
br label %35
35: ; preds = %23, %21
%36 = load x86_fp80, x86_fp80* %4
ret x86_fp80 %36
}

LLVM IR (-O2):
@.str = [7 x i8] c"nbdtrl\00"
define x86_fp80 @nbdtril(i32 %0, i32 %1, x86_fp80 %2) {
%4 = fcmp olt x86_fp80 %2, 0xK00000000000000000000
%5 = fcmp ogt x86_fp80 %2, 0xK3FFF8000000000000000
%6 = or i1 %4, %5
%7 = icmp slt i32 %0, 0
%8 = or i1 %7, %6
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = 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 %17
11: ; preds = %3
%12 = add nuw nsw i32 %0, 1
%13 = sitofp i32 %12 to x86_fp80
%14 = sitofp i32 %1 to x86_fp80
%15 = tail call i32 (x86_fp80, x86_fp80, x86_fp80, ...) bitcast (i32 (...)* @incbil to i32 (x86_fp80, x86_fp80, x86_fp80, ...)*)(x86_fp80 %14, x86_fp80 %13, x86_fp80 %2)
%16 = sitofp i32 %15 to x86_fp80
br label %17
17: ; preds = %11, %9
%18 = phi x86_fp80 [ 0xK00000000000000000000, %9 ], [ %16, %11 ]
ret x86_fp80 %18
}