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


x86 assembly (clang, -O0):
<util_format_linear_to_srgb_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1137 <util_format_linear_to_srgb_float+0x27>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11b3 <util_format_linear_to_srgb_float+0xa3>
movss  0xec1(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1160 <util_format_linear_to_srgb_float+0x50>
movss  0xec3(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11b3 <util_format_linear_to_srgb_float+0xa3>
movss  0xe9c(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    11a6 <util_format_linear_to_srgb_float+0x96>
movss  -0x8(%rbp),%xmm0
movss  0xe91(%rip),%xmm1
call   1030 <powf@plt>
movss  0xe7c(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe74(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11b3 <util_format_linear_to_srgb_float+0xa3>
movss  0xe56(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_format_linear_to_srgb_float>:
push   %rax
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
ja     115f <util_format_linear_to_srgb_float+0x4f>
movss  0xedf(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1133 <util_format_linear_to_srgb_float+0x23>
mulss  0xee6(%rip),%xmm0
movaps %xmm0,%xmm1
jmp    115f <util_format_linear_to_srgb_float+0x4f>
movss  0xec9(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    115f <util_format_linear_to_srgb_float+0x4f>
movss  0xec0(%rip),%xmm1
call   1030 <powf@plt>
mulss  0xeb7(%rip),%xmm0
addss  0xeb3(%rip),%xmm0
pop    %rax
ret
movaps %xmm1,%xmm0
pop    %rax
ret

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

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