#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, float);
float math_linearToGamma(float c) {
  if (c > 1.0f)
    return 1.0f;
  else if (c < 0.0f)
    return 0.0f;
  else if (c < 0.0031308f)
    return c * 12.92f;
  else
    return 1.055f * pow(c, 0.41666f) - 0.055f;
}


x86 assembly (clang, -O0):
<math_linearToGamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xed6(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1145 <math_linearToGamma+0x35>
movss  0xec5(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11b7 <math_linearToGamma+0xa7>
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    115f <math_linearToGamma+0x4f>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11b7 <math_linearToGamma+0xa7>
movss  0xe9d(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1188 <math_linearToGamma+0x78>
movss  0xe9b(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11b7 <math_linearToGamma+0xa7>
movss  -0x8(%rbp),%xmm0
movss  0xe7b(%rip),%xmm1
call   1030 <pow@plt>
movss  0xe66(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe5e(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_linearToGamma>:
push   %rax
movss  0xee7(%rip),%xmm1
ucomiss %xmm1,%xmm0
ja     113e <math_linearToGamma+0x2e>
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
ja     113e <math_linearToGamma+0x2e>
movss  0xed6(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1143 <math_linearToGamma+0x33>
mulss  0xed9(%rip),%xmm0
movaps %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret
movss  0xebd(%rip),%xmm1
call   1030 <pow@plt>
mulss  0xeb4(%rip),%xmm0
addss  0xeb0(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @math_linearToGamma(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fcmp ogt float %4, 1.000000e+00
br i1 %5, label %6, label %7
6: ; preds = %1
store float 1.000000e+00, float* %2
br label %21
7: ; preds = %1
%8 = load float, float* %3
%9 = fcmp olt float %8, 0.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %7
store float 0.000000e+00, float* %2
br label %21
11: ; preds = %7
%12 = load float, float* %3
%13 = fcmp olt float %12, 0x3F69A5C380000000
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load float, float* %3
%16 = fmul float %15, 0x4029D70A40000000
store float %16, float* %2
br label %21
17: ; preds = %11
%18 = load float, float* %3
%19 = call float @pow(float %18, float 0x3FDAAA8EC0000000)
%20 = call float @llvm.fmuladd.f32(float 0x3FF0E147A0000000, float %19, float 0xBFAC28F5C0000000)
store float %20, float* %2
br label %21
21: ; preds = %17, %14, %10, %6
%22 = load float, float* %2
ret float %22
}

LLVM IR (-O2):
define float @math_linearToGamma(float %0) {
%2 = fcmp ogt float %0, 1.000000e+00
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = fcmp olt float %0, 0.000000e+00
br i1 %4, label %12, label %5
5: ; preds = %3
%6 = fcmp olt float %0, 0x3F69A5C380000000
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = fmul float %0, 0x4029D70A40000000
br label %12
9: ; preds = %5
%10 = tail call float @pow(float %0, float 0x3FDAAA8EC0000000)
%11 = tail call float @llvm.fmuladd.f32(float %10, float 0x3FF0E147A0000000, float 0xBFAC28F5C0000000)
br label %12
12: ; preds = %3, %1, %9, %7
%13 = phi float [ %8, %7 ], [ %11, %9 ], [ 1.000000e+00, %1 ], [ 0.000000e+00, %3 ]
ret float %13
}