#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 */
double fgamma_s(int, double);
double fgamma_steed(int, double);
int /*<<< orphan*/ printf(char *);
double fgamma(int m, double x) {
  if (x < 0.0) {
    printf("fgamma - Warning : quantitatively incorrect results for x<0\n");
  }
  if (x < (m + 0.5))
    return fgamma_s(m, x);
  else
    return fgamma_steed(m, x);
}


x86 assembly (clang, -O0):
<fgamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    115a <fgamma+0x2a>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm1
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xe94(%rip),%xmm2
addsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    1191 <fgamma+0x61>
mov    -0xc(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
call   1050 <fgamma_s@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11a3 <fgamma+0x73>
mov    -0xc(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
call   1040 <fgamma_steed@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgamma>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    1159 <fgamma+0x29>
lea    0xec0(%rip),%rdi
movsd  %xmm0,0x8(%rsp)
call   1030 <puts@plt>
movsd  0x8(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
addsd  0xe98(%rip),%xmm1
mov    %ebx,%edi
add    $0x10,%rsp
ucomisd %xmm0,%xmm1
jbe    117a <fgamma+0x4a>
pop    %rbx
jmp    1050 <fgamma_s@plt>
pop    %rbx
jmp    1040 <fgamma_steed@plt>

LLVM IR (-O0):
@.str = [61 x i8] c"fgamma - Warning : quantitatively incorrect results for x<0\0A\00"
define double @fgamma(i32 %0, double %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca double
store i32 %0, i32* %4
store double %1, double* %5
%6 = load double, double* %5
%7 = fcmp olt double %6, 0.000000e+00
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = load double, double* %5
%12 = load i32, i32* %4
%13 = sitofp i32 %12 to double
%14 = fadd double %13, 5.000000e-01
%15 = fcmp olt double %11, %14
br i1 %15, label %16, label %20
16: ; preds = %10
%17 = load i32, i32* %4
%18 = load double, double* %5
%19 = call double @fgamma_s(i32 %17, double %18)
store double %19, double* %3
br label %24
20: ; preds = %10
%21 = load i32, i32* %4
%22 = load double, double* %5
%23 = call double @fgamma_steed(i32 %21, double %22)
store double %23, double* %3
br label %24
24: ; preds = %20, %16
%25 = load double, double* %3
ret double %25
}

LLVM IR (-O2):
@str = [60 x i8] c"fgamma - Warning : quantitatively incorrect results for x<0\00"
define double @fgamma(i32 %0, double %1) {
%3 = fcmp olt double %1, 0.000000e+00
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = sitofp i32 %0 to double
%8 = fadd double %7, 5.000000e-01
%9 = fcmp ogt double %8, %1
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = tail call double @fgamma_s(i32 %0, double %1)
br label %14
12: ; preds = %6
%13 = tail call double @fgamma_steed(i32 %0, double %1)
br label %14
14: ; preds = %12, %10
%15 = phi double [ %11, %10 ], [ %13, %12 ]
ret double %15
}