#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 *GammaCorrection(float *RGB) {
  float invgamma = 1.0 / 2.2f;
  RGB[0] = (powf(RGB[0] * 255.0f, invgamma) < 255.0f
                ? powf(RGB[0] * 255.0f, invgamma)
                : 255.0f);
  RGB[1] = (powf(RGB[1] * 255.0f, invgamma) < 255.0f
                ? powf(RGB[1] * 255.0f, invgamma)
                : 255.0f);
  RGB[2] = (powf(RGB[2] * 255.0f, invgamma) < 255.0f
                ? powf(RGB[2] * 255.0f, invgamma)
                : 255.0f);
  return RGB;
}


x86 assembly (clang, -O0):
<GammaCorrection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  0xee0(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movss  0xecb(%rip),%xmm0
mulss  (%rax),%xmm0
movss  -0xc(%rbp),%xmm1
call   1030 <powf@plt>
movaps %xmm0,%xmm1
movss  0xeb2(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    117b <GammaCorrection+0x6b>
mov    -0x8(%rbp),%rax
movss  0xe9d(%rip),%xmm0
mulss  (%rax),%xmm0
movss  -0xc(%rbp),%xmm1
call   1030 <powf@plt>
movss  %xmm0,-0x10(%rbp)
jmp    118d <GammaCorrection+0x7d>
movss  0xe7d(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    118d <GammaCorrection+0x7d>
movss  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0xe5a(%rip),%xmm0
mulss  0x4(%rax),%xmm0
movss  -0xc(%rbp),%xmm1
call   1030 <powf@plt>
movaps %xmm0,%xmm1
movss  0xe40(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    11ee <GammaCorrection+0xde>
mov    -0x8(%rbp),%rax
movss  0xe2b(%rip),%xmm0
mulss  0x4(%rax),%xmm0
movss  -0xc(%rbp),%xmm1
call   1030 <powf@plt>
movss  %xmm0,-0x14(%rbp)
jmp    1200 <GammaCorrection+0xf0>
movss  0xe0a(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    1200 <GammaCorrection+0xf0>
movss  -0x14(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  0xde6(%rip),%xmm0
mulss  0x8(%rax),%xmm0
movss  -0xc(%rbp),%xmm1
call   1030 <powf@plt>
movaps %xmm0,%xmm1
movss  0xdcc(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    1262 <GammaCorrection+0x152>
mov    -0x8(%rbp),%rax
movss  0xdb7(%rip),%xmm0
mulss  0x8(%rax),%xmm0
movss  -0xc(%rbp),%xmm1
call   1030 <powf@plt>
movss  %xmm0,-0x18(%rbp)
jmp    1274 <GammaCorrection+0x164>
movss  0xd96(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    1274 <GammaCorrection+0x164>
movss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GammaCorrection>:
push   %rbx
mov    %rdi,%rbx
movss  (%rdi),%xmm0
mulss  0xee0(%rip),%xmm0
movss  0xedc(%rip),%xmm1
call   1030 <powf@plt>
movss  0xecb(%rip),%xmm1
ucomiss %xmm0,%xmm1
movaps %xmm1,%xmm0
jbe    1156 <GammaCorrection+0x46>
movss  (%rbx),%xmm0
mulss  0xeb7(%rip),%xmm0
movss  0xeb3(%rip),%xmm1
call   1030 <powf@plt>
movss  %xmm0,(%rbx)
movss  0x4(%rbx),%xmm0
movss  0xe99(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe91(%rip),%xmm1
call   1030 <powf@plt>
movss  0xe80(%rip),%xmm1
ucomiss %xmm0,%xmm1
movaps %xmm1,%xmm0
jbe    11a2 <GammaCorrection+0x92>
movss  0x4(%rbx),%xmm0
mulss  0xe6b(%rip),%xmm0
movss  0xe67(%rip),%xmm1
call   1030 <powf@plt>
movss  %xmm0,0x4(%rbx)
movss  0x8(%rbx),%xmm0
movss  0xe4c(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe44(%rip),%xmm1
call   1030 <powf@plt>
movss  0xe33(%rip),%xmm1
ucomiss %xmm0,%xmm1
movaps %xmm1,%xmm0
jbe    11ef <GammaCorrection+0xdf>
movss  0x8(%rbx),%xmm0
mulss  0xe1e(%rip),%xmm0
movss  0xe1a(%rip),%xmm1
call   1030 <powf@plt>
movss  %xmm0,0x8(%rbx)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define float* @GammaCorrection(float* %0) {
%2 = alloca float*
%3 = alloca float
store float* %0, float** %2
store float 0x3FDD1745C0000000, float* %3
%4 = load float*, float** %2
%5 = getelementptr inbounds float, float* %4, i64 0
%6 = load float, float* %5
%7 = fmul float %6, 2.550000e+02
%8 = load float, float* %3
%9 = call float @powf(float %7, float %8)
%10 = fcmp olt float %9, 2.550000e+02
br i1 %10, label %11, label %18
11: ; preds = %1
%12 = load float*, float** %2
%13 = getelementptr inbounds float, float* %12, i64 0
%14 = load float, float* %13
%15 = fmul float %14, 2.550000e+02
%16 = load float, float* %3
%17 = call float @powf(float %15, float %16)
br label %19
18: ; preds = %1
br label %19
19: ; preds = %18, %11
%20 = phi float [ %17, %11 ], [ 2.550000e+02, %18 ]
%21 = load float*, float** %2
%22 = getelementptr inbounds float, float* %21, i64 0
store float %20, float* %22
%23 = load float*, float** %2
%24 = getelementptr inbounds float, float* %23, i64 1
%25 = load float, float* %24
%26 = fmul float %25, 2.550000e+02
%27 = load float, float* %3
%28 = call float @powf(float %26, float %27)
%29 = fcmp olt float %28, 2.550000e+02
br i1 %29, label %30, label %37
30: ; preds = %19
%31 = load float*, float** %2
%32 = getelementptr inbounds float, float* %31, i64 1
%33 = load float, float* %32
%34 = fmul float %33, 2.550000e+02
%35 = load float, float* %3
%36 = call float @powf(float %34, float %35)
br label %38
37: ; preds = %19
br label %38
38: ; preds = %37, %30
%39 = phi float [ %36, %30 ], [ 2.550000e+02, %37 ]
%40 = load float*, float** %2
%41 = getelementptr inbounds float, float* %40, i64 1
store float %39, float* %41
%42 = load float*, float** %2
%43 = getelementptr inbounds float, float* %42, i64 2
%44 = load float, float* %43
%45 = fmul float %44, 2.550000e+02
%46 = load float, float* %3
%47 = call float @powf(float %45, float %46)
%48 = fcmp olt float %47, 2.550000e+02
br i1 %48, label %49, label %56
49: ; preds = %38
%50 = load float*, float** %2
%51 = getelementptr inbounds float, float* %50, i64 2
%52 = load float, float* %51
%53 = fmul float %52, 2.550000e+02
%54 = load float, float* %3
%55 = call float @powf(float %53, float %54)
br label %57
56: ; preds = %38
br label %57
57: ; preds = %56, %49
%58 = phi float [ %55, %49 ], [ 2.550000e+02, %56 ]
%59 = load float*, float** %2
%60 = getelementptr inbounds float, float* %59, i64 2
store float %58, float* %60
%61 = load float*, float** %2
ret float* %61
}

LLVM IR (-O2):
define float* @GammaCorrection(float* returned %0) {
%2 = load float, float* %0
%3 = fmul float %2, 2.550000e+02
%4 = tail call float @powf(float %3, float 0x3FDD1745C0000000)
%5 = fcmp olt float %4, 2.550000e+02
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load float, float* %0
%8 = fmul float %7, 2.550000e+02
%9 = tail call float @powf(float %8, float 0x3FDD1745C0000000)
br label %10
10: ; preds = %1, %6
%11 = phi float [ %9, %6 ], [ 2.550000e+02, %1 ]
store float %11, float* %0
%12 = getelementptr inbounds float, float* %0, i64 1
%13 = load float, float* %12
%14 = fmul float %13, 2.550000e+02
%15 = tail call float @powf(float %14, float 0x3FDD1745C0000000)
%16 = fcmp olt float %15, 2.550000e+02
br i1 %16, label %17, label %21
17: ; preds = %10
%18 = load float, float* %12
%19 = fmul float %18, 2.550000e+02
%20 = tail call float @powf(float %19, float 0x3FDD1745C0000000)
br label %21
21: ; preds = %10, %17
%22 = phi float [ %20, %17 ], [ 2.550000e+02, %10 ]
store float %22, float* %12
%23 = getelementptr inbounds float, float* %0, i64 2
%24 = load float, float* %23
%25 = fmul float %24, 2.550000e+02
%26 = tail call float @powf(float %25, float 0x3FDD1745C0000000)
%27 = fcmp olt float %26, 2.550000e+02
br i1 %27, label %28, label %32
28: ; preds = %21
%29 = load float, float* %23
%30 = fmul float %29, 2.550000e+02
%31 = tail call float @powf(float %30, float 0x3FDD1745C0000000)
br label %32
32: ; preds = %21, %28
%33 = phi float [ %31, %28 ], [ 2.550000e+02, %21 ]
store float %33, float* %23
ret float* %0
}