#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
float incbif(double, double, float);
int /*<<< orphan*/ mtherrf(char *, int);
float fdtrif(int ia, int ib, float yy) {
  float y, a, b, w, x;
  y = yy;
  if ((ia < 1) || (ib < 1) || (y <= 0.0) || (y > 1.0)) {
    mtherrf("fdtrif", 1);
    return (0.0);
  }
  a = ia;
  b = ib;
  w = incbif(0.5 * b, 0.5 * a, y);
  x = (b - b * w) / (a * w);
  return (x);
}


x86 assembly (clang, -O0):
<fdtrif>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     1182 <fdtrif+0x62>
cmpl   $0x1,-0xc(%rbp)
jl     1182 <fdtrif+0x62>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jae    1182 <fdtrif+0x62>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe88(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11a0 <fdtrif+0x80>
lea    0xe87(%rip),%rdi
mov    $0x1,%esi
call   1040 <mtherrf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    122e <fdtrif+0x10e>
cvtsi2ssl -0x8(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe43(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xe2e(%rip),%xmm1
mulsd  %xmm2,%xmm1
movss  -0x14(%rbp),%xmm2
call   1030 <incbif@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm0
movss  -0x20(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  -0x18(%rbp),%xmm1
mulss  -0x20(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdtrif>:
push   %rax
ucomiss 0xed8(%rip),%xmm0
ja     118f <fdtrif+0x6f>
test   %edi,%edi
jle    118f <fdtrif+0x6f>
test   %esi,%esi
jle    118f <fdtrif+0x6f>
movaps %xmm0,%xmm2
xorps  %xmm0,%xmm0
ucomiss %xmm2,%xmm0
jae    118f <fdtrif+0x6f>
cvtsi2ss %edi,%xmm4
movss  %xmm4,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %esi,%xmm0
movss  %xmm0,(%rsp)
cvtss2sd %xmm0,%xmm0
movsd  0xea9(%rip),%xmm3
mulsd  %xmm3,%xmm0
cvtss2sd %xmm4,%xmm1
mulsd  %xmm3,%xmm1
call   1030 <incbif@plt>
movss  (%rsp),%xmm2
movaps %xmm2,%xmm1
mulss  %xmm0,%xmm1
subss  %xmm1,%xmm2
mulss  0x4(%rsp),%xmm0
divss  %xmm0,%xmm2
movaps %xmm2,%xmm0
pop    %rax
ret
lea    0xe7a(%rip),%rdi
mov    $0x1,%esi
call   1040 <mtherrf@plt>
xorps  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"fdtrif\00"
define float @fdtrif(i32 %0, i32 %1, float %2) {
%4 = alloca float
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
store i32 %0, i32* %5
store i32 %1, i32* %6
store float %2, float* %7
%13 = load float, float* %7
store float %13, float* %8
%14 = load i32, i32* %5
%15 = icmp slt i32 %14, 1
br i1 %15, label %27, label %16
16: ; preds = %3
%17 = load i32, i32* %6
%18 = icmp slt i32 %17, 1
br i1 %18, label %27, label %19
19: ; preds = %16
%20 = load float, float* %8
%21 = fpext float %20 to double
%22 = fcmp ole double %21, 0.000000e+00
br i1 %22, label %27, label %23
23: ; preds = %19
%24 = load float, float* %8
%25 = fpext float %24 to double
%26 = fcmp ogt double %25, 1.000000e+00
br i1 %26, label %27, label %29
27: ; preds = %23, %19, %16, %3
%28 = call i32 @mtherrf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 1)
store float 0.000000e+00, float* %4
br label %52
29: ; preds = %23
%30 = load i32, i32* %5
%31 = sitofp i32 %30 to float
store float %31, float* %9
%32 = load i32, i32* %6
%33 = sitofp i32 %32 to float
store float %33, float* %10
%34 = load float, float* %10
%35 = fpext float %34 to double
%36 = fmul double 5.000000e-01, %35
%37 = load float, float* %9
%38 = fpext float %37 to double
%39 = fmul double 5.000000e-01, %38
%40 = load float, float* %8
%41 = call float @incbif(double %36, double %39, float %40)
store float %41, float* %11
%42 = load float, float* %10
%43 = load float, float* %10
%44 = load float, float* %11
%45 = fneg float %43
%46 = call float @llvm.fmuladd.f32(float %45, float %44, float %42)
%47 = load float, float* %9
%48 = load float, float* %11
%49 = fmul float %47, %48
%50 = fdiv float %46, %49
store float %50, float* %12
%51 = load float, float* %12
store float %51, float* %4
br label %52
52: ; preds = %29, %27
%53 = load float, float* %4
ret float %53
}

LLVM IR (-O2):
@.str = [7 x i8] c"fdtrif\00"
define float @fdtrif(i32 %0, i32 %1, float %2) {
%4 = icmp sgt i32 %0, 0
%5 = icmp sgt i32 %1, 0
%6 = and i1 %4, %5
%7 = fcmp ugt float %2, 0.000000e+00
%8 = and i1 %6, %7
%9 = fcmp ule float %2, 1.000000e+00
%10 = and i1 %9, %8
br i1 %10, label %13, label %11
11: ; preds = %3
%12 = tail call i32 @mtherrf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 1)
br label %25
13: ; preds = %3
%14 = sitofp i32 %0 to float
%15 = sitofp i32 %1 to float
%16 = fpext float %15 to double
%17 = fmul double %16, 5.000000e-01
%18 = fpext float %14 to double
%19 = fmul double %18, 5.000000e-01
%20 = tail call float @incbif(double %17, double %19, float %2)
%21 = fneg float %15
%22 = tail call float @llvm.fmuladd.f32(float %21, float %20, float %15)
%23 = fmul float %20, %14
%24 = fdiv float %22, %23
br label %25
25: ; preds = %13, %11
%26 = phi float [ 0.000000e+00, %11 ], [ %24, %13 ]
ret float %26
}