#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 */
int floor(double);
double pow(double, double);
int component_srgb_to_rgb(int c) {
  double cs = (double)c / 255.0;
  double cl;
  if (cs <= 0.04045)
    cl = cs / 12.92;
  else
    cl = pow((cs + 0.055) / 1.055, 2.4);
  return floor(255.0 * cl + 0.5);
}


x86 assembly (clang, -O0):
<component_srgb_to_rgb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xed0(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xeb7(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     116f <component_srgb_to_rgb+0x4f>
movsd  -0x10(%rbp),%xmm0
movsd  0xec7(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    119a <component_srgb_to_rgb+0x7a>
movsd  0xea9(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  0xe94(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe80(%rip),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe61(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe7d(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1040 <floor@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<component_srgb_to_rgb>:
push   %rax
cvtsi2sd %edi,%xmm0
divsd  0xed3(%rip),%xmm0
movsd  0xed3(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    115a <component_srgb_to_rgb+0x3a>
addsd  0xed5(%rip),%xmm0
divsd  0xed5(%rip),%xmm0
movsd  0xed5(%rip),%xmm1
call   1030 <pow@plt>
jmp    1162 <component_srgb_to_rgb+0x42>
divsd  0xeae(%rip),%xmm0
mulsd  0xe96(%rip),%xmm0
addsd  0xebe(%rip),%xmm0
pop    %rax
jmp    1040 <floor@plt>

LLVM IR (-O0):
define i32 @component_srgb_to_rgb(i32 %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca double
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = sitofp i32 %5 to double
%7 = fdiv double %6, 2.550000e+02
store double %7, double* %3
%8 = load double, double* %3
%9 = fcmp ole double %8, 4.045000e-02
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = load double, double* %3
%12 = fdiv double %11, 1.292000e+01
store double %12, double* %4
br label %18
13: ; preds = %1
%14 = load double, double* %3
%15 = fadd double %14, 5.500000e-02
%16 = fdiv double %15, 1.055000e+00
%17 = call double @pow(double %16, double 2.400000e+00)
store double %17, double* %4
br label %18
18: ; preds = %13, %10
%19 = load double, double* %4
%20 = call double @llvm.fmuladd.f64(double 2.550000e+02, double %19, double 5.000000e-01)
%21 = call i32 @floor(double %20)
ret i32 %21
}

LLVM IR (-O2):
define i32 @component_srgb_to_rgb(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = fdiv double %2, 2.550000e+02
%4 = fcmp ugt double %3, 4.045000e-02
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = fdiv double %3, 1.292000e+01
br label %11
7: ; preds = %1
%8 = fadd double %3, 5.500000e-02
%9 = fdiv double %8, 1.055000e+00
%10 = tail call double @pow(double %9, double 2.400000e+00)
br label %11
11: ; preds = %7, %5
%12 = phi double [ %6, %5 ], [ %10, %7 ]
%13 = tail call double @llvm.fmuladd.f64(double %12, double 2.550000e+02, double 5.000000e-01)
%14 = tail call i32 @floor(double %13)
ret i32 %14
}