#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 pow(float, int);
float Rec709_EOTF(float value) {
  float linear_out;
  if (value > 0.081) {
    linear_out = pow((value + 0.099) / 1.099, (1 / 0.45));
  } else if (value > 0) {
    linear_out = (1.0 / 4.5) * value;
  } else {
    linear_out = 0;
  }
  return linear_out;
}


x86 assembly (clang, -O0):
<Rec709_EOTF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xed2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1171 <Rec709_EOTF+0x61>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xecf(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xebb(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movss  %xmm0,-0x8(%rbp)
jmp    11b2 <Rec709_EOTF+0xa2>
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    11a5 <Rec709_EOTF+0x95>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe75(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11ad <Rec709_EOTF+0x9d>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11b2 <Rec709_EOTF+0xa2>
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Rec709_EOTF>:
cvtss2sd %xmm0,%xmm2
ucomisd 0xee4(%rip),%xmm2
jbe    113f <Rec709_EOTF+0x2f>
addsd  0xeea(%rip),%xmm2
divsd  0xeea(%rip),%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
mov    $0x2,%edi
jmp    1030 <pow@plt>
movaps %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
jbe    1159 <Rec709_EOTF+0x49>
mulsd  0xeb6(%rip),%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @Rec709_EOTF(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = fpext float %4 to double
%6 = fcmp ogt double %5, 8.100000e-02
br i1 %6, label %7, label %14
7: ; preds = %1
%8 = load float, float* %2
%9 = fpext float %8 to double
%10 = fadd double %9, 9.900000e-02
%11 = fdiv double %10, 1.099000e+00
%12 = fptrunc double %11 to float
%13 = call float @pow(float %12, i32 2)
store float %13, float* %3
br label %24
14: ; preds = %1
%15 = load float, float* %2
%16 = fcmp ogt float %15, 0.000000e+00
br i1 %16, label %17, label %22
17: ; preds = %14
%18 = load float, float* %2
%19 = fpext float %18 to double
%20 = fmul double 0x3FCC71C71C71C71C, %19
%21 = fptrunc double %20 to float
store float %21, float* %3
br label %23
22: ; preds = %14
store float 0.000000e+00, float* %3
br label %23
23: ; preds = %22, %17
br label %24
24: ; preds = %23, %7
%25 = load float, float* %3
ret float %25
}

LLVM IR (-O2):
define float @Rec709_EOTF(float %0) {
%2 = fpext float %0 to double
%3 = fcmp ogt double %2, 8.100000e-02
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = fadd double %2, 9.900000e-02
%6 = fdiv double %5, 1.099000e+00
%7 = fptrunc double %6 to float
%8 = tail call float @pow(float %7, i32 2)
br label %14
9: ; preds = %1
%10 = fcmp ogt float %0, 0.000000e+00
br i1 %10, label %11, label %14
11: ; preds = %9
%12 = fmul double %2, 0x3FCC71C71C71C71C
%13 = fptrunc double %12 to float
br label %14
14: ; preds = %9, %11, %4
%15 = phi float [ %8, %4 ], [ %13, %11 ], [ 0.000000e+00, %9 ]
ret float %15
}