double cephes_fdtr(ia, ib, x)
int ia, ib;
double x;
{
  double a, b, w;
  if ((ia < 1) || (ib < 1) || (x < 0.0)) {
    mtherr("fdtr", 1);
    return (0.0);
  }
  a = ia;
  b = ib;
  w = a * x;
  w = w / (b + w);
  return (cephes_incbet(0.5 * a, 0.5 * b, w));
}


x86 assembly (clang, -O0):
<cephes_fdtr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x1,-0xc(%rbp)
jl     1155 <cephes_fdtr+0x35>
cmpl   $0x1,-0x10(%rbp)
jl     1155 <cephes_fdtr+0x35>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1175 <cephes_fdtr+0x55>
lea    0xeac(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <mtherr@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11df <cephes_fdtr+0xbf>
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
addsd  -0x30(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe48(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xe3b(%rip),%xmm1
mulsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
mov    $0x3,%al
call   1040 <cephes_incbet@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cephes_fdtr>:
push   %rax
test   %edi,%edi
jle    1172 <cephes_fdtr+0x52>
test   %esi,%esi
jle    1172 <cephes_fdtr+0x52>
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm0
ja     1172 <cephes_fdtr+0x52>
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
cvtsi2sd %esi,%xmm1
mulsd  %xmm0,%xmm2
movapd %xmm2,%xmm3
addsd  %xmm1,%xmm3
divsd  %xmm3,%xmm2
movsd  0xea6(%rip),%xmm3
mulsd  %xmm3,%xmm0
mulsd  %xmm3,%xmm1
mov    $0x3,%al
call   1040 <cephes_incbet@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
pop    %rax
ret
lea    0xe8f(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <mtherr@plt>
xorpd  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"fdtr\00"
define double @cephes_fdtr(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 i32, i32* %5
%12 = icmp slt i32 %11, 1
br i1 %12, label %19, label %13
13: ; preds = %3
%14 = load i32, i32* %6
%15 = icmp slt i32 %14, 1
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = load double, double* %7
%18 = fcmp olt double %17, 0.000000e+00
br i1 %18, label %19, label %21
19: ; preds = %16, %13, %3
%20 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @mtherr to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1)
store double 0.000000e+00, double* %4
br label %41
21: ; preds = %16
%22 = load i32, i32* %5
%23 = sitofp i32 %22 to double
store double %23, double* %8
%24 = load i32, i32* %6
%25 = sitofp i32 %24 to double
store double %25, double* %9
%26 = load double, double* %8
%27 = load double, double* %7
%28 = fmul double %26, %27
store double %28, double* %10
%29 = load double, double* %10
%30 = load double, double* %9
%31 = load double, double* %10
%32 = fadd double %30, %31
%33 = fdiv double %29, %32
store double %33, double* %10
%34 = load double, double* %8
%35 = fmul double 5.000000e-01, %34
%36 = load double, double* %9
%37 = fmul double 5.000000e-01, %36
%38 = load double, double* %10
%39 = call i32 (double, double, double, ...) bitcast (i32 (...)* @cephes_incbet to i32 (double, double, double, ...)*)(double %35, double %37, double %38)
%40 = sitofp i32 %39 to double
store double %40, double* %4
br label %41
41: ; preds = %21, %19
%42 = load double, double* %4
ret double %42
}

LLVM IR (-O2):
@.str = [5 x i8] c"fdtr\00"
define double @cephes_fdtr(i32 %0, i32 %1, double %2) {
%4 = icmp slt i32 %0, 1
%5 = icmp slt i32 %1, 1
%6 = or i1 %4, %5
%7 = fcmp olt double %2, 0.000000e+00
%8 = or i1 %6, %7
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 ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1)
br label %21
11: ; preds = %3
%12 = sitofp i32 %0 to double
%13 = sitofp i32 %1 to double
%14 = fmul double %12, %2
%15 = fadd double %14, %13
%16 = fdiv double %14, %15
%17 = fmul double %12, 5.000000e-01
%18 = fmul double %13, 5.000000e-01
%19 = tail call i32 (double, double, double, ...) bitcast (i32 (...)* @cephes_incbet to i32 (double, double, double, ...)*)(double %17, double %18, double %16)
%20 = sitofp i32 %19 to double
br label %21
21: ; preds = %11, %9
%22 = phi double [ 0.000000e+00, %9 ], [ %20, %11 ]
ret double %22
}