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


x86 assembly (clang, -O0):
<nbdtrcl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%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     1171 <nbdtrcl+0x41>
jmp    115b <nbdtrcl+0x2b>
fldt   -0x30(%rbp)
fld1
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jbe    1176 <nbdtrcl+0x46>
jmp    1171 <nbdtrcl+0x41>
jmp    1185 <nbdtrcl+0x55>
cmpl   $0x0,-0x14(%rbp)
jge    11a2 <nbdtrcl+0x72>
jmp    1185 <nbdtrcl+0x55>
lea    0xe74(%rip),%rdi
xor    %eax,%eax
mov    $0x1,%esi
call   1050 <mtherr@plt>
fldz
fstpt  -0x10(%rbp)
jmp    120e <nbdtrcl+0xde>
mov    -0x18(%rbp),%eax
mov    %eax,-0x54(%rbp)
fildl  -0x54(%rbp)
fstpt  -0x50(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11d7 <nbdtrcl+0xa7>
fldt   -0x30(%rbp)
fldt   -0x50(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
call   1030 <powl@plt>
fld1
fsubp  %st,%st(1)
fstpt  -0x10(%rbp)
jmp    120e <nbdtrcl+0xde>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
fildl  -0x5c(%rbp)
fstpt  -0x40(%rbp)
fldt   -0x40(%rbp)
fldt   -0x50(%rbp)
fldt   -0x30(%rbp)
fld1
fsubp  %st,%st(1)
mov    %rsp,%rax
fstpt  0x20(%rax)
fstpt  0x10(%rax)
fstpt  (%rax)
xor    %eax,%eax
call   1040 <incbetl@plt>
mov    %eax,-0x58(%rbp)
fildl  -0x58(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nbdtrcl>:
sub    $0x48,%rsp
fldt   0x50(%rsp)
test   %edi,%edi
fldz
js     1192 <nbdtrcl+0x62>
fstp   %st(0)
fldz
fucomip %st(1),%st
fldz
ja     1192 <nbdtrcl+0x62>
fstp   %st(0)
fld1
fxch   %st(1)
fucomi %st(1),%st
fxch   %st(1)
ja     1192 <nbdtrcl+0x62>
mov    %esi,0x38(%rsp)
fildl  0x38(%rsp)
test   %edi,%edi
je     11b0 <nbdtrcl+0x80>
add    $0x1,%edi
mov    %edi,0x30(%rsp)
fildl  0x30(%rsp)
fxch   %st(2)
fsubp  %st,%st(3)
fxch   %st(2)
fstpt  0x20(%rsp)
fxch   %st(1)
fstpt  0x10(%rsp)
fstpt  (%rsp)
xor    %eax,%eax
call   1040 <incbetl@plt>
mov    %eax,0x34(%rsp)
fildl  0x34(%rsp)
add    $0x48,%rsp
ret
fstp   %st(1)
fstp   %st(0)
lea    0xe63(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <mtherr@plt>
fldz
add    $0x48,%rsp
ret
fstpt  0x10(%rsp)
fxch   %st(1)
fstpt  (%rsp)
fstpt  0x3c(%rsp)
call   1030 <powl@plt>
fldt   0x3c(%rsp)
fsubp  %st,%st(1)
add    $0x48,%rsp
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"nbdtrl\00"
define x86_fp80 @nbdtrcl(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 %23
11: ; preds = %3
%12 = sitofp i32 %1 to x86_fp80
%13 = icmp eq i32 %0, 0
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = tail call x86_fp80 @powl(x86_fp80 %2, x86_fp80 %12)
%16 = fsub x86_fp80 0xK3FFF8000000000000000, %15
br label %23
17: ; preds = %11
%18 = add nuw nsw i32 %0, 1
%19 = sitofp i32 %18 to x86_fp80
%20 = fsub x86_fp80 0xK3FFF8000000000000000, %2
%21 = tail call i32 (x86_fp80, x86_fp80, x86_fp80, ...) bitcast (i32 (...)* @incbetl to i32 (x86_fp80, x86_fp80, x86_fp80, ...)*)(x86_fp80 %19, x86_fp80 %12, x86_fp80 %20)
%22 = sitofp i32 %21 to x86_fp80
br label %23
23: ; preds = %17, %14, %9
%24 = phi x86_fp80 [ 0xK00000000000000000000, %9 ], [ %16, %14 ], [ %22, %17 ]
ret x86_fp80 %24
}