#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 ieSRGBToLin(float sRGB) {
  float k0 = 0.04045;
  float phi = 12.92;
  float result;
  if (sRGB <= k0) {
    result = (sRGB / phi);
  } else {
    float alpha = 0.055;
    float exponent = 2.4;
    result = pow((sRGB + alpha) / (1.0 + alpha), exponent);
  }
  return result;
}


x86 assembly (clang, -O0):
<ieSRGBToLin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xedf(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xece(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     115e <ieSRGBToLin+0x4e>
movss  -0x4(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    11b2 <ieSRGBToLin+0xa2>
movss  0xea6(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xe95(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xe79(%rip),%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  -0x18(%rbp),%xmm1
call   1030 <pow@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ieSRGBToLin>:
movss  0xee8(%rip),%xmm1
ucomiss %xmm0,%xmm1
jae    1142 <ieSRGBToLin+0x32>
addss  0xee3(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0xedf(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  0xecf(%rip),%xmm1
jmp    1030 <pow@plt>
divss  0xeba(%rip),%xmm0
ret

LLVM IR (-O0):
define float @ieSRGBToLin(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %2
store float 0x3FA4B5DCC0000000, float* %3
store float 0x4029D70A40000000, float* %4
%8 = load float, float* %2
%9 = load float, float* %3
%10 = fcmp ole float %8, %9
br i1 %10, label %11, label %15
11: ; preds = %1
%12 = load float, float* %2
%13 = load float, float* %4
%14 = fdiv float %12, %13
store float %14, float* %5
br label %27
15: ; preds = %1
store float 0x3FAC28F5C0000000, float* %6
store float 0x4003333340000000, float* %7
%16 = load float, float* %2
%17 = load float, float* %6
%18 = fadd float %16, %17
%19 = fpext float %18 to double
%20 = load float, float* %6
%21 = fpext float %20 to double
%22 = fadd double 1.000000e+00, %21
%23 = fdiv double %19, %22
%24 = fptrunc double %23 to float
%25 = load float, float* %7
%26 = call float @pow(float %24, float %25)
store float %26, float* %5
br label %27
27: ; preds = %15, %11
%28 = load float, float* %5
ret float %28
}

LLVM IR (-O2):
define float @ieSRGBToLin(float %0) {
%2 = fcmp ugt float %0, 0x3FA4B5DCC0000000
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = fdiv float %0, 0x4029D70A40000000
br label %11
5: ; preds = %1
%6 = fadd float %0, 0x3FAC28F5C0000000
%7 = fpext float %6 to double
%8 = fdiv double %7, 0x3FF0E147AE000000
%9 = fptrunc double %8 to float
%10 = tail call float @pow(float %9, float 0x4003333340000000)
br label %11
11: ; preds = %5, %3
%12 = phi float [ %4, %3 ], [ %10, %5 ]
ret float %12
}