#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, int);
float sRGB_OETF(float value) {
  float prime_out;
  if (value > 0.0031308) {
    prime_out = 1.055 * pow(value, 1 / 2.4) - 0.055;
  } else if (value > 0) {
    prime_out = value * 12.92;
  } else {
    prime_out = 0;
  }
  return prime_out;
}


x86 assembly (clang, -O0):
<sRGB_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    116a <sRGB_OETF+0x5a>
movss  -0x4(%rbp),%xmm0
xor    %edi,%edi
call   1030 <pow@plt>
movsd  0xec4(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xec0(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11ab <sRGB_OETF+0x9b>
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    119e <sRGB_OETF+0x8e>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe7c(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11a6 <sRGB_OETF+0x96>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11ab <sRGB_OETF+0x9b>
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sRGB_OETF>:
push   %rax
movaps %xmm0,%xmm1
cvtss2sd %xmm0,%xmm2
ucomisd 0xee0(%rip),%xmm2
jbe    1142 <sRGB_OETF+0x32>
movaps %xmm1,%xmm0
xor    %edi,%edi
call   1030 <pow@plt>
mulsd  0xedc(%rip),%xmm0
addsd  0xedc(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
jbe    1159 <sRGB_OETF+0x49>
mulsd  0xeb6(%rip),%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @sRGB_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, 3.130800e-03
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load float, float* %2
%9 = call double @pow(float %8, i32 0)
%10 = call double @llvm.fmuladd.f64(double 1.055000e+00, double %9, double -5.500000e-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, 1.292000e+01
%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 @sRGB_OETF(float %0) {
%2 = fpext float %0 to double
%3 = fcmp ogt double %2, 3.130800e-03
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call double @pow(float %0, i32 0)
%6 = tail call double @llvm.fmuladd.f64(double %5, double 1.055000e+00, double -5.500000e-02)
%7 = fptrunc double %6 to float
br label %13
8: ; preds = %1
%9 = fcmp ogt float %0, 0.000000e+00
br i1 %9, label %10, label %13
10: ; preds = %8
%11 = fmul double %2, 1.292000e+01
%12 = fptrunc double %11 to float
br label %13
13: ; preds = %8, %10, %4
%14 = phi float [ %7, %4 ], [ %12, %10 ], [ 0.000000e+00, %8 ]
ret float %14
}