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


x86 assembly (clang, -O0):
<fdtrc>:
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 <fdtrc+0x35>
cmpl   $0x1,-0x10(%rbp)
jl     1155 <fdtrc+0x35>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1175 <fdtrc+0x55>
lea    0xeac(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <mtherr@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11dd <fdtrc+0xbd>
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe4a(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xe3d(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
mov    $0x3,%al
call   1030 <incbet@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c"fdtrc\00"
define double @fdtrc(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 ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1)
store double 0.000000e+00, double* %4
br label %39
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* %9
%27 = load double, double* %9
%28 = load double, double* %8
%29 = load double, double* %7
%30 = call double @llvm.fmuladd.f64(double %28, double %29, double %27)
%31 = fdiv double %26, %30
store double %31, double* %10
%32 = load double, double* %9
%33 = fmul double 5.000000e-01, %32
%34 = load double, double* %8
%35 = fmul double 5.000000e-01, %34
%36 = load double, double* %10
%37 = call i32 (double, double, double, ...) bitcast (i32 (...)* @incbet to i32 (double, double, double, ...)*)(double %33, double %35, double %36)
%38 = sitofp i32 %37 to double
store double %38, double* %4
br label %39
39: ; preds = %21, %19
%40 = load double, double* %4
ret double %40
}

LLVM IR (-O2):
@.str = [6 x i8] c"fdtrc\00"
define double @fdtrc(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 ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1)
br label %20
11: ; preds = %3
%12 = sitofp i32 %0 to double
%13 = sitofp i32 %1 to double
%14 = tail call double @llvm.fmuladd.f64(double %12, double %2, double %13)
%15 = fdiv double %13, %14
%16 = fmul double %13, 5.000000e-01
%17 = fmul double %12, 5.000000e-01
%18 = tail call i32 (double, double, double, ...) bitcast (i32 (...)* @incbet to i32 (double, double, double, ...)*)(double %16, double %17, double %15)
%19 = sitofp i32 %18 to double
br label %20
20: ; preds = %11, %9
%21 = phi double [ 0.000000e+00, %9 ], [ %19, %11 ]
ret double %21
}