#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 gamma(float v, float gamma_value) {
  float g = 0.0;
  if (gamma_value >= 0.0) {
    g = 1.0 / (1.0 + gamma_value);
  } else {
    g = (1.0 - gamma_value);
  }
  return pow(v, g * g * g * g);
}


x86 assembly (clang, -O0):
<gamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     116f <gamma+0x5f>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeaf(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xea3(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    118d <gamma+0x7d>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe80(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
call   1030 <pow@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gamma>:
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm1
jae    1126 <gamma+0x16>
movss  0xee8(%rip),%xmm2
subss  %xmm1,%xmm2
jmp    113e <gamma+0x2e>
cvtss2sd %xmm1,%xmm1
movsd  0xece(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm2
cvtsd2ss %xmm2,%xmm2
movaps %xmm2,%xmm1
mulss  %xmm2,%xmm1
mulss  %xmm2,%xmm1
mulss  %xmm2,%xmm1
jmp    1030 <pow@plt>

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

LLVM IR (-O2):
define float @gamma(float %0, float %1) {
%3 = fcmp ult float %1, 0.000000e+00
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = fpext float %1 to double
%6 = fadd double %5, 1.000000e+00
%7 = fdiv double 1.000000e+00, %6
%8 = fptrunc double %7 to float
br label %11
9: ; preds = %2
%10 = fsub float 1.000000e+00, %1
br label %11
11: ; preds = %9, %4
%12 = phi float [ %8, %4 ], [ %10, %9 ]
%13 = fmul float %12, %12
%14 = fmul float %12, %13
%15 = fmul float %12, %14
%16 = tail call float @pow(float %0, float %15)
ret float %16
}