#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 pow(float, double);
float Rec709_OETF(float value) {
  float prime_out;
  if (value > 0.081) {
    prime_out = 1.099 * pow(value, 0.45) - 0.099;
  } else if (value > 0) {
    prime_out = value * 4.5;
  } else {
    prime_out = 0;
  }
  return prime_out;
}


x86 assembly (clang, -O0):
<Rec709_OETF>:
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    1170 <Rec709_OETF+0x60>
movss  -0x4(%rbp),%xmm0
movsd  0xedb(%rip),%xmm1
call   1030 <pow@plt>
movsd  0xebe(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeba(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11b1 <Rec709_OETF+0xa1>
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    11a4 <Rec709_OETF+0x94>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe76(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11ac <Rec709_OETF+0x9c>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11b1 <Rec709_OETF+0xa1>
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Rec709_OETF>:
push   %rax
cvtss2sd %xmm0,%xmm1
ucomisd 0xee3(%rip),%xmm1
jbe    1145 <Rec709_OETF+0x35>
movsd  0xee1(%rip),%xmm1
call   1030 <pow@plt>
mulsd  0xedc(%rip),%xmm0
addsd  0xedc(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
jmp    1158 <Rec709_OETF+0x48>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1158 <Rec709_OETF+0x48>
mulss  0xecb(%rip),%xmm0
movaps %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @Rec709_OETF(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 %12
7: ; preds = %1
%8 = load float, float* %2
%9 = call double @pow(float %8, double 4.500000e-01)
%10 = call double @llvm.fmuladd.f64(double 1.099000e+00, double %9, double -9.900000e-02)
%11 = fptrunc double %10 to float
store float %11, float* %3
br label %22
12: ; preds = %1
%13 = load float, float* %2
%14 = fcmp ogt float %13, 0.000000e+00
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load float, float* %2
%17 = fpext float %16 to double
%18 = fmul double %17, 4.500000e+00
%19 = fptrunc double %18 to float
store float %19, float* %3
br label %21
20: ; preds = %12
store float 0.000000e+00, float* %3
br label %21
21: ; preds = %20, %15
br label %22
22: ; preds = %21, %7
%23 = load float, float* %3
ret float %23
}

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