double cephes_nbdtri(k, n, p)
int k, n;
double p;
{
  double dk, dn, w;
  if ((p < 0.0) || (p > 1.0))
    goto domerr;
  if (k < 0) {
  domerr:
    mtherr("nbdtri", 1);
    return (0.0);
  }
  dk = k + 1;
  dn = n;
  w = cephes_incbi(dn, dk, p);
  return (w);
}


x86 assembly (clang, -O0):
<cephes_nbdtri>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
ja     1158 <cephes_nbdtri+0x38>
movsd  -0x18(%rbp),%xmm0
movsd  0xeb2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    115d <cephes_nbdtri+0x3d>
jmp    116c <cephes_nbdtri+0x4c>
cmpl   $0x0,-0xc(%rbp)
jge    118c <cephes_nbdtri+0x6c>
jmp    116c <cephes_nbdtri+0x4c>
lea    0xe95(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <mtherr@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11ce <cephes_nbdtri+0xae>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
mov    $0x3,%al
call   1030 <cephes_incbi@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cephes_nbdtri>:
push   %rax
test   %edi,%edi
js     115b <cephes_nbdtri+0x3b>
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm0
ja     115b <cephes_nbdtri+0x3b>
ucomisd 0xec5(%rip),%xmm2
ja     115b <cephes_nbdtri+0x3b>
add    $0x1,%edi
cvtsi2sd %edi,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %esi,%xmm0
mov    $0x3,%al
call   1030 <cephes_incbi@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
pop    %rax
ret
lea    0xea6(%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"nbdtri\00"
define double @cephes_nbdtri(i32 %0, i32 %1, double %2) {
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32 %0, i32* %5
store i32 %1, i32* %6
store double %2, double* %7
%11 = load double, double* %7
%12 = fcmp olt double %11, 0.000000e+00
br i1 %12, label %16, label %13
13: ; preds = %3
%14 = load double, double* %7
%15 = fcmp ogt double %14, 1.000000e+00
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 double 0.000000e+00, double* %4
br label %35
23: ; preds = %17
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
%26 = sitofp i32 %25 to double
store double %26, double* %8
%27 = load i32, i32* %6
%28 = sitofp i32 %27 to double
store double %28, double* %9
%29 = load double, double* %9
%30 = load double, double* %8
%31 = load double, double* %7
%32 = call i32 (double, double, double, ...) bitcast (i32 (...)* @cephes_incbi to i32 (double, double, double, ...)*)(double %29, double %30, double %31)
%33 = sitofp i32 %32 to double
store double %33, double* %10
%34 = load double, double* %10
store double %34, double* %4
br label %35
35: ; preds = %23, %21
%36 = load double, double* %4
ret double %36
}

LLVM IR (-O2):
@.str = [7 x i8] c"nbdtri\00"
define double @cephes_nbdtri(i32 %0, i32 %1, double %2) {
%4 = fcmp olt double %2, 0.000000e+00
%5 = fcmp ogt double %2, 1.000000e+00
%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 double
%14 = sitofp i32 %1 to double
%15 = tail call i32 (double, double, double, ...) bitcast (i32 (...)* @cephes_incbi to i32 (double, double, double, ...)*)(double %14, double %13, double %2)
%16 = sitofp i32 %15 to double
br label %17
17: ; preds = %11, %9
%18 = phi double [ 0.000000e+00, %9 ], [ %16, %11 ]
ret double %18
}