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


x86 assembly (clang, -O0):
<fdtrl>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
fldt   0x10(%rbp)
mov    %edi,-0x14(%rbp)
mov    %esi,-0x18(%rbp)
fstpt  -0x30(%rbp)
cmpl   $0x1,-0x14(%rbp)
jl     115f <fdtrl+0x3f>
cmpl   $0x1,-0x18(%rbp)
jl     115f <fdtrl+0x3f>
fldt   -0x30(%rbp)
fldz
fucomip %st(1),%st
fstp   %st(0)
jbe    117c <fdtrl+0x5c>
jmp    115f <fdtrl+0x3f>
lea    0xe9e(%rip),%rdi
xor    %eax,%eax
mov    $0x1,%esi
call   1040 <mtherr@plt>
fldz
fstpt  -0x10(%rbp)
jmp    11da <fdtrl+0xba>
mov    -0x14(%rbp),%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   -0x40(%rbp)
fldt   -0x30(%rbp)
fmulp  %st,%st(1)
fstpt  -0x60(%rbp)
fldt   -0x60(%rbp)
fldt   -0x50(%rbp)
fadd   %st(1),%st
fdivrp %st,%st(1)
fstpt  -0x60(%rbp)
fldt   -0x40(%rbp)
flds   0xe4b(%rip)
fmul   %st,%st(1)
fldt   -0x50(%rbp)
fmulp  %st,%st(1)
fldt   -0x60(%rbp)
mov    %rsp,%rax
fstpt  0x20(%rax)
fstpt  0x10(%rax)
fstpt  (%rax)
xor    %eax,%eax
call   1030 <incbetl@plt>
mov    %eax,-0x64(%rbp)
fildl  -0x64(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdtrl>:
sub    $0x48,%rsp
fldt   0x50(%rsp)
test   %edi,%edi
jle    117b <fdtrl+0x5b>
test   %esi,%esi
jle    117b <fdtrl+0x5b>
fldz
fucomip %st(1),%st
ja     117b <fdtrl+0x5b>
mov    %edi,0x3c(%rsp)
fildl  0x3c(%rsp)
mov    %esi,0x40(%rsp)
fildl  0x40(%rsp)
fxch   %st(2)
fmul   %st(1),%st
fld    %st(0)
fadd   %st(3),%st
fdivrp %st,%st(1)
flds   0xeaa(%rip)
fmul   %st,%st(2)
fmulp  %st,%st(3)
fxch   %st(2)
fstpt  0x10(%rsp)
fstpt  (%rsp)
fstpt  0x20(%rsp)
xor    %eax,%eax
call   1030 <incbetl@plt>
mov    %eax,0x44(%rsp)
fildl  0x44(%rsp)
add    $0x48,%rsp
ret
fstp   %st(0)
lea    0xe80(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <mtherr@plt>
fldz
add    $0x48,%rsp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"fdtrl\00"
define x86_fp80 @fdtrl(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 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 x86_fp80, x86_fp80* %7
%18 = fcmp olt x86_fp80 %17, 0xK00000000000000000000
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 x86_fp80 0xK00000000000000000000, x86_fp80* %4
br label %41
21: ; preds = %16
%22 = load i32, i32* %5
%23 = sitofp i32 %22 to x86_fp80
store x86_fp80 %23, x86_fp80* %8
%24 = load i32, i32* %6
%25 = sitofp i32 %24 to x86_fp80
store x86_fp80 %25, x86_fp80* %9
%26 = load x86_fp80, x86_fp80* %8
%27 = load x86_fp80, x86_fp80* %7
%28 = fmul x86_fp80 %26, %27
store x86_fp80 %28, x86_fp80* %10
%29 = load x86_fp80, x86_fp80* %10
%30 = load x86_fp80, x86_fp80* %9
%31 = load x86_fp80, x86_fp80* %10
%32 = fadd x86_fp80 %30, %31
%33 = fdiv x86_fp80 %29, %32
store x86_fp80 %33, x86_fp80* %10
%34 = load x86_fp80, x86_fp80* %8
%35 = fmul x86_fp80 0xK3FFE8000000000000000, %34
%36 = load x86_fp80, x86_fp80* %9
%37 = fmul x86_fp80 0xK3FFE8000000000000000, %36
%38 = load x86_fp80, x86_fp80* %10
%39 = call i32 (x86_fp80, x86_fp80, x86_fp80, ...) bitcast (i32 (...)* @incbetl to i32 (x86_fp80, x86_fp80, x86_fp80, ...)*)(x86_fp80 %35, x86_fp80 %37, x86_fp80 %38)
%40 = sitofp i32 %39 to x86_fp80
store x86_fp80 %40, x86_fp80* %4
br label %41
41: ; preds = %21, %19
%42 = load x86_fp80, x86_fp80* %4
ret x86_fp80 %42
}

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