#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 */
scalar_t__ pow(float const, float);
void linear_to_luv(float *bgr) {
  const float xn = 0.312713f;
  const float yn = 0.329016f;
  const float Yn = 1.0f;
  const float un = 4 * xn / (-2 * xn + 12 * yn + 3);
  const float vn = 9 * yn / (-2 * xn + 12 * yn + 3);
  const float y_split = 0.00885645f;
  const float y_adjust = 903.3f;
  const float R = bgr[2];
  const float G = bgr[1];
  const float B = bgr[0];
  if (R == 0 && G == 0 && B == 0) {
    bgr[0] = 0;
    bgr[1] = bgr[2] = 100;
    return;
  }
  const float X = 0.412453f * R + 0.35758f * G + 0.180423f * B;
  const float Y = 0.212671f * R + 0.71516f * G + 0.072169f * B;
  const float Z = 0.019334f * R + 0.119193f * G + 0.950227f * B;
  const float Yd = Y / Yn;
  const float u = 4 * X / (X + 15 * Y + 3 * Z);
  const float v = 9 * Y / (X + 15 * Y + 3 * Z);
  const float L = bgr[0] =
      Yd > y_split ? (116 * ((float)pow(Yd, (float)(1.0f / 3.0f))) - 16)
                   : y_adjust * Yd;
  bgr[1] = 13 * L * (u - un) + 100;
  bgr[2] = 13 * L * (v - vn) + 100;
}


x86 assembly (clang, -O0):
<linear_to_luv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movss  0xef4(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xee3(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xed2(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xec1(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xeb0(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xe9f(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  0xe8e(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1217 <linear_to_luv+0x107>
jp     1217 <linear_to_luv+0x107>
movss  -0x2c(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1217 <linear_to_luv+0x107>
jp     1217 <linear_to_luv+0x107>
movss  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1217 <linear_to_luv+0x107>
jp     1217 <linear_to_luv+0x107>
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0xe60(%rip),%xmm0
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movss  0xe4f(%rip),%xmm0
movss  %xmm0,0x4(%rax)
jmp    144c <linear_to_luv+0x33c>
movss  -0x28(%rbp),%xmm1
movss  0xe28(%rip),%xmm0
mulss  -0x2c(%rbp),%xmm0
movss  0xe17(%rip),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x30(%rbp),%xmm0
movss  0xdfe(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x28(%rbp),%xmm1
movss  0xde0(%rip),%xmm0
mulss  -0x2c(%rbp),%xmm0
movss  0xdcf(%rip),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x30(%rbp),%xmm0
movss  0xdb6(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x28(%rbp),%xmm1
movss  0xd98(%rip),%xmm0
mulss  -0x2c(%rbp),%xmm0
movss  0xd87(%rip),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x30(%rbp),%xmm0
movss  0xd6e(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x38(%rbp),%xmm0
movss  0xd38(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x40(%rbp)
movss  0xd3f(%rip),%xmm0
mulss  -0x34(%rbp),%xmm0
movss  -0x34(%rbp),%xmm1
movss  -0x38(%rbp),%xmm2
movss  0xd20(%rip),%xmm3
mulss  %xmm3,%xmm2
addss  %xmm1,%xmm2
movss  -0x3c(%rbp),%xmm1
movss  0xd07(%rip),%xmm3
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x44(%rbp)
movss  0xcf6(%rip),%xmm0
mulss  -0x38(%rbp),%xmm0
movss  -0x34(%rbp),%xmm1
movss  -0x38(%rbp),%xmm2
movss  0xcdb(%rip),%xmm3
mulss  %xmm3,%xmm2
addss  %xmm1,%xmm2
movss  -0x3c(%rbp),%xmm1
movss  0xcc2(%rip),%xmm3
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x40(%rbp),%xmm0
movss  0xc8c(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    13ba <linear_to_luv+0x2aa>
movss  -0x40(%rbp),%xmm0
movss  0xcca(%rip),%xmm1
call   1030 <pow@plt>
cvtsi2ss %rax,%xmm0
movss  0xcb0(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xca8(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x50(%rbp)
jmp    13cc <linear_to_luv+0x2bc>
movss  0xc3e(%rip),%xmm0
mulss  -0x40(%rbp),%xmm0
movss  %xmm0,-0x50(%rbp)
movss  -0x50(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  %xmm0,-0x4c(%rbp)
movss  0xc7a(%rip),%xmm0
mulss  -0x4c(%rbp),%xmm0
movss  -0x44(%rbp),%xmm1
movss  0xc14(%rip),%xmm2
subss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  0xc54(%rip),%xmm1
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  0xc43(%rip),%xmm0
mulss  -0x4c(%rbp),%xmm0
movss  -0x48(%rbp),%xmm1
movss  0xbd9(%rip),%xmm2
subss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  0xc1d(%rip),%xmm1
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linear_to_luv>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movss  0x8(%rdi),%xmm2
movss  (%rdi),%xmm1
movss  0x4(%rdi),%xmm3
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm2
jne    115a <linear_to_luv+0x4a>
jp     115a <linear_to_luv+0x4a>
ucomiss %xmm0,%xmm3
jne    115a <linear_to_luv+0x4a>
jp     115a <linear_to_luv+0x4a>
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
jne    115a <linear_to_luv+0x4a>
jp     115a <linear_to_luv+0x4a>
movabs $0x42c8000000000000,%rax
mov    %rax,(%rbx)
movl   $0x42c80000,0x8(%rbx)
jmp    129c <linear_to_luv+0x18c>
movss  0xe9e(%rip),%xmm0
mulss  %xmm3,%xmm0
movss  0xe96(%rip),%xmm5
mulss  %xmm2,%xmm5
addss  %xmm0,%xmm5
movss  0xe8a(%rip),%xmm4
mulss  %xmm1,%xmm4
addss  %xmm5,%xmm4
movss  0xe7e(%rip),%xmm0
mulss  %xmm3,%xmm0
movss  0xe76(%rip),%xmm5
mulss  %xmm2,%xmm5
addss  %xmm0,%xmm5
movss  0xe6a(%rip),%xmm0
mulss  %xmm1,%xmm0
mulss  0xe62(%rip),%xmm3
mulss  0xe5e(%rip),%xmm2
addss  %xmm5,%xmm0
addss  %xmm3,%xmm2
mulss  0xe52(%rip),%xmm1
addss  %xmm2,%xmm1
movss  0xe4a(%rip),%xmm3
mulss  %xmm4,%xmm3
movss  0xe42(%rip),%xmm2
mulss  %xmm0,%xmm2
addss  %xmm4,%xmm2
mulss  0xe36(%rip),%xmm1
addss  %xmm2,%xmm1
divss  %xmm1,%xmm3
movss  0xe2a(%rip),%xmm2
mulss  %xmm0,%xmm2
divss  %xmm1,%xmm2
ucomiss 0xe1f(%rip),%xmm0
jbe    1256 <linear_to_luv+0x146>
movss  0xe1d(%rip),%xmm1
movss  %xmm3,0xc(%rsp)
movss  %xmm2,0x8(%rsp)
call   1030 <pow@plt>
movss  0x8(%rsp),%xmm2
movss  0xc(%rsp),%xmm3
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
mulss  0xdf4(%rip),%xmm0
addss  0xdf0(%rip),%xmm0
jmp    125e <linear_to_luv+0x14e>
mulss  0xdda(%rip),%xmm0
movss  %xmm0,(%rbx)
mulss  0xdde(%rip),%xmm0
addss  0xdda(%rip),%xmm3
mulss  %xmm0,%xmm3
movss  0xdd2(%rip),%xmm1
addss  %xmm1,%xmm3
addss  0xdca(%rip),%xmm2
movss  %xmm3,0x4(%rbx)
mulss  %xmm0,%xmm2
addss  %xmm1,%xmm2
movss  %xmm2,0x8(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @linear_to_luv(float* %0) {
%2 = alloca float*
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca float
store float* %0, float** %2
store float 0x3FD4037D60000000, float* %3
store float 0x3FD50E9920000000, float* %4
store float 1.000000e+00, float* %5
store float 0x3FC95297C0000000, float* %6
store float 0x3FDDF92040000000, float* %7
store float 0x3F822354A0000000, float* %8
store float 0x408C3A6660000000, float* %9
%20 = load float*, float** %2
%21 = getelementptr inbounds float, float* %20, i64 2
%22 = load float, float* %21
store float %22, float* %10
%23 = load float*, float** %2
%24 = getelementptr inbounds float, float* %23, i64 1
%25 = load float, float* %24
store float %25, float* %11
%26 = load float*, float** %2
%27 = getelementptr inbounds float, float* %26, i64 0
%28 = load float, float* %27
store float %28, float* %12
%29 = load float, float* %10
%30 = fcmp oeq float %29, 0.000000e+00
br i1 %30, label %31, label %44
31: ; preds = %1
%32 = load float, float* %11
%33 = fcmp oeq float %32, 0.000000e+00
br i1 %33, label %34, label %44
34: ; preds = %31
%35 = load float, float* %12
%36 = fcmp oeq float %35, 0.000000e+00
br i1 %36, label %37, label %44
37: ; preds = %34
%38 = load float*, float** %2
%39 = getelementptr inbounds float, float* %38, i64 0
store float 0.000000e+00, float* %39
%40 = load float*, float** %2
%41 = getelementptr inbounds float, float* %40, i64 2
store float 1.000000e+02, float* %41
%42 = load float*, float** %2
%43 = getelementptr inbounds float, float* %42, i64 1
store float 1.000000e+02, float* %43
br label %109
44: ; preds = %34, %31, %1
%45 = load float, float* %10
%46 = load float, float* %11
%47 = fmul float 0x3FD6E29740000000, %46
%48 = call float @llvm.fmuladd.f32(float 0x3FDA65A140000000, float %45, float %47)
%49 = load float, float* %12
%50 = call float @llvm.fmuladd.f32(float 0x3FC71819E0000000, float %49, float %48)
store float %50, float* %13
%51 = load float, float* %10
%52 = load float, float* %11
%53 = fmul float 0x3FE6E29740000000, %52
%54 = call float @llvm.fmuladd.f32(float 0x3FCB38CDA0000000, float %51, float %53)
%55 = load float, float* %12
%56 = call float @llvm.fmuladd.f32(float 0x3FB279AAE0000000, float %55, float %54)
store float %56, float* %14
%57 = load float, float* %10
%58 = load float, float* %11
%59 = fmul float 0x3FBE836EC0000000, %58
%60 = call float @llvm.fmuladd.f32(float 0x3F93CC4AC0000000, float %57, float %59)
%61 = load float, float* %12
%62 = call float @llvm.fmuladd.f32(float 0x3FEE684280000000, float %61, float %60)
store float %62, float* %15
%63 = load float, float* %14
%64 = fdiv float %63, 1.000000e+00
store float %64, float* %16
%65 = load float, float* %13
%66 = fmul float 4.000000e+00, %65
%67 = load float, float* %13
%68 = load float, float* %14
%69 = call float @llvm.fmuladd.f32(float 1.500000e+01, float %68, float %67)
%70 = load float, float* %15
%71 = call float @llvm.fmuladd.f32(float 3.000000e+00, float %70, float %69)
%72 = fdiv float %66, %71
store float %72, float* %17
%73 = load float, float* %14
%74 = fmul float 9.000000e+00, %73
%75 = load float, float* %13
%76 = load float, float* %14
%77 = call float @llvm.fmuladd.f32(float 1.500000e+01, float %76, float %75)
%78 = load float, float* %15
%79 = call float @llvm.fmuladd.f32(float 3.000000e+00, float %78, float %77)
%80 = fdiv float %74, %79
store float %80, float* %18
%81 = load float, float* %16
%82 = fcmp ogt float %81, 0x3F822354A0000000
br i1 %82, label %83, label %88
83: ; preds = %44
%84 = load float, float* %16
%85 = call i64 @pow(float %84, float 0x3FD5555560000000)
%86 = sitofp i64 %85 to float
%87 = call float @llvm.fmuladd.f32(float 1.160000e+02, float %86, float -1.600000e+01)
br label %91
88: ; preds = %44
%89 = load float, float* %16
%90 = fmul float 0x408C3A6660000000, %89
br label %91
91: ; preds = %88, %83
%92 = phi float [ %87, %83 ], [ %90, %88 ]
%93 = load float*, float** %2
%94 = getelementptr inbounds float, float* %93, i64 0
store float %92, float* %94
store float %92, float* %19
%95 = load float, float* %19
%96 = fmul float 1.300000e+01, %95
%97 = load float, float* %17
%98 = fsub float %97, 0x3FC95297C0000000
%99 = call float @llvm.fmuladd.f32(float %96, float %98, float 1.000000e+02)
%100 = load float*, float** %2
%101 = getelementptr inbounds float, float* %100, i64 1
store float %99, float* %101
%102 = load float, float* %19
%103 = fmul float 1.300000e+01, %102
%104 = load float, float* %18
%105 = fsub float %104, 0x3FDDF92040000000
%106 = call float @llvm.fmuladd.f32(float %103, float %105, float 1.000000e+02)
%107 = load float*, float** %2
%108 = getelementptr inbounds float, float* %107, i64 2
store float %106, float* %108
br label %109
109: ; preds = %91, %37
ret void
}

LLVM IR (-O2):
define void @linear_to_luv(float* nocapture %0) {
%2 = getelementptr inbounds float, float* %0, i64 2
%3 = load float, float* %2
%4 = getelementptr inbounds float, float* %0, i64 1
%5 = load float, float* %4
%6 = load float, float* %0
%7 = fcmp oeq float %3, 0.000000e+00
%8 = fcmp oeq float %5, 0.000000e+00
%9 = select i1 %7, i1 %8, i1 false
%10 = fcmp oeq float %6, 0.000000e+00
%11 = select i1 %9, i1 %10, i1 false
br i1 %11, label %12, label %13
12: ; preds = %1
store float 0.000000e+00, float* %0
store float 1.000000e+02, float* %2
store float 1.000000e+02, float* %4
br label %43
13: ; preds = %1
%14 = fmul float %5, 0x3FD6E29740000000
%15 = tail call float @llvm.fmuladd.f32(float %3, float 0x3FDA65A140000000, float %14)
%16 = tail call float @llvm.fmuladd.f32(float %6, float 0x3FC71819E0000000, float %15)
%17 = fmul float %5, 0x3FE6E29740000000
%18 = tail call float @llvm.fmuladd.f32(float %3, float 0x3FCB38CDA0000000, float %17)
%19 = tail call float @llvm.fmuladd.f32(float %6, float 0x3FB279AAE0000000, float %18)
%20 = fmul float %5, 0x3FBE836EC0000000
%21 = tail call float @llvm.fmuladd.f32(float %3, float 0x3F93CC4AC0000000, float %20)
%22 = tail call float @llvm.fmuladd.f32(float %6, float 0x3FEE684280000000, float %21)
%23 = fmul float %16, 4.000000e+00
%24 = tail call float @llvm.fmuladd.f32(float %19, float 1.500000e+01, float %16)
%25 = tail call float @llvm.fmuladd.f32(float %22, float 3.000000e+00, float %24)
%26 = fdiv float %23, %25
%27 = fmul float %19, 9.000000e+00
%28 = fdiv float %27, %25
%29 = fcmp ogt float %19, 0x3F822354A0000000
br i1 %29, label %30, label %34
30: ; preds = %13
%31 = tail call i64 @pow(float %19, float 0x3FD5555560000000)
%32 = sitofp i64 %31 to float
%33 = tail call float @llvm.fmuladd.f32(float %32, float 1.160000e+02, float -1.600000e+01)
br label %36
34: ; preds = %13
%35 = fmul float %19, 0x408C3A6660000000
br label %36
36: ; preds = %34, %30
%37 = phi float [ %33, %30 ], [ %35, %34 ]
store float %37, float* %0
%38 = fmul float %37, 1.300000e+01
%39 = fadd float %26, 0xBFC95297C0000000
%40 = tail call float @llvm.fmuladd.f32(float %38, float %39, float 1.000000e+02)
store float %40, float* %4
%41 = fadd float %28, 0xBFDDF92040000000
%42 = tail call float @llvm.fmuladd.f32(float %38, float %41, float 1.000000e+02)
store float %42, float* %2
br label %43
43: ; preds = %36, %12
ret void
}