#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, double);
float sRGB_EOTF(float value) {
  float linear_out;
  if (value > 0.04045) {
    linear_out = pow((value + 0.055) / 1.055, 2.4);
  } else if (value > 0) {
    linear_out = value / 12.92;
  } else {
    linear_out = 0;
  }
  return linear_out;
}


x86 assembly (clang, -O0):
<sRGB_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    1174 <sRGB_EOTF+0x64>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xed7(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xec3(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  0xeab(%rip),%xmm1
call   1030 <pow@plt>
movss  %xmm0,-0x8(%rbp)
jmp    11b5 <sRGB_EOTF+0xa5>
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    11a8 <sRGB_EOTF+0x98>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe72(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11b0 <sRGB_EOTF+0xa0>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11b5 <sRGB_EOTF+0xa5>
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sRGB_EOTF>:
cvtss2sd %xmm0,%xmm2
ucomisd 0xee4(%rip),%xmm2
jbe    1142 <sRGB_EOTF+0x32>
addsd  0xeea(%rip),%xmm2
divsd  0xeea(%rip),%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
movsd  0xee3(%rip),%xmm1
jmp    1030 <pow@plt>
movaps %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
jbe    115c <sRGB_EOTF+0x4c>
divsd  0xeb3(%rip),%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @sRGB_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, 4.045000e-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, 5.500000e-02
%11 = fdiv double %10, 1.055000e+00
%12 = fptrunc double %11 to float
%13 = call float @pow(float %12, double 2.400000e+00)
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 = fdiv double %19, 1.292000e+01
%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 @sRGB_EOTF(float %0) {
%2 = fpext float %0 to double
%3 = fcmp ogt double %2, 4.045000e-02
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = fadd double %2, 5.500000e-02
%6 = fdiv double %5, 1.055000e+00
%7 = fptrunc double %6 to float
%8 = tail call float @pow(float %7, double 2.400000e+00)
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 = fdiv double %2, 1.292000e+01
%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
}