#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 Lab(float const);
void RGB2Lab(float *L, float *a, float *b, float R, float G, float B) {
  const float X = 0.4360747f * R + 0.3850649f * G + 0.1430804f * B;
  const float Y = 0.2225045f * R + 0.7168786f * G + 0.0606169f * B;
  const float Z = 0.0139322f * R + 0.0971045f * G + 0.7141733f * B;
  const float fx = Lab(X / 0.9642f);
  const float fy = Lab(Y);
  const float fz = Lab(Z / 0.8249f);
  *L = 116.f * fy - 16.f;
  *a = 500.f * (fx - fy);
  *b = 200.f * (fy - fz);
}


x86 assembly (clang, -O0):
<RGB2Lab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movss  %xmm0,-0x1c(%rbp)
movss  %xmm1,-0x20(%rbp)
movss  %xmm2,-0x24(%rbp)
movss  -0x1c(%rbp),%xmm1
movss  0xef8(%rip),%xmm0
mulss  -0x20(%rbp),%xmm0
movss  0xee7(%rip),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
movss  0xece(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm1
movss  0xeb0(%rip),%xmm0
mulss  -0x20(%rbp),%xmm0
movss  0xe9f(%rip),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
movss  0xe86(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x1c(%rbp),%xmm1
movss  0xe68(%rip),%xmm0
mulss  -0x20(%rbp),%xmm0
movss  0xe57(%rip),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
movss  0xe3e(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x28(%rbp),%xmm0
movss  0xe20(%rip),%xmm1
divss  %xmm1,%xmm0
call   1030 <Lab@plt>
movss  %xmm0,-0x34(%rbp)
movss  -0x2c(%rbp),%xmm0
call   1030 <Lab@plt>
movss  %xmm0,-0x38(%rbp)
movss  -0x30(%rbp),%xmm0
movss  0xdf2(%rip),%xmm1
divss  %xmm1,%xmm0
call   1030 <Lab@plt>
movss  %xmm0,-0x3c(%rbp)
movss  -0x38(%rbp),%xmm0
movss  0xdcf(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xdc7(%rip),%xmm1
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x34(%rbp),%xmm1
subss  -0x38(%rbp),%xmm1
movss  0xda1(%rip),%xmm0
mulss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x38(%rbp),%xmm1
subss  -0x3c(%rbp),%xmm1
movss  0xd7f(%rip),%xmm0
mulss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RGB2Lab>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movaps %xmm0,%xmm5
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movss  0xed3(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  0xecb(%rip),%xmm3
mulss  %xmm5,%xmm3
addss  %xmm0,%xmm3
movss  0xebf(%rip),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm3,%xmm0
movss  0xeb3(%rip),%xmm3
mulss  %xmm1,%xmm3
movss  0xeab(%rip),%xmm4
mulss  %xmm5,%xmm4
addss  %xmm3,%xmm4
movss  0xe9f(%rip),%xmm3
mulss  %xmm2,%xmm3
addss  %xmm4,%xmm3
movss  %xmm3,0x4(%rsp)
mulss  0xe8d(%rip),%xmm1
mulss  0xe89(%rip),%xmm5
mulss  0xe85(%rip),%xmm2
addss  %xmm1,%xmm5
addss  %xmm2,%xmm5
movss  %xmm5,0x8(%rsp)
divss  0xe73(%rip),%xmm0
call   1030 <Lab@plt>
movss  %xmm0,0xc(%rsp)
movss  0x4(%rsp),%xmm0
call   1030 <Lab@plt>
movss  %xmm0,0x4(%rsp)
movss  0x8(%rsp),%xmm0
divss  0xe4d(%rip),%xmm0
call   1030 <Lab@plt>
movss  0xe44(%rip),%xmm1
movss  0x4(%rsp),%xmm2
mulss  %xmm2,%xmm1
addss  0xe36(%rip),%xmm1
movss  %xmm1,(%rbx)
movss  0xc(%rsp),%xmm1
subss  %xmm2,%xmm1
mulss  0xe24(%rip),%xmm1
movss  %xmm1,(%r15)
subss  %xmm0,%xmm2
mulss  0xe17(%rip),%xmm2
movss  %xmm2,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @RGB2Lab(float* %0, float* %1, float* %2, float %3, float %4, float %5) {
%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
store float* %0, float** %7
store float* %1, float** %8
store float* %2, float** %9
store float %3, float* %10
store float %4, float* %11
store float %5, float* %12
%19 = load float, float* %10
%20 = load float, float* %11
%21 = fmul float 0x3FD8A4E740000000, %20
%22 = call float @llvm.fmuladd.f32(float 0x3FDBE8A5E0000000, float %19, float %21)
%23 = load float, float* %12
%24 = call float @llvm.fmuladd.f32(float 0x3FC2507560000000, float %23, float %22)
store float %24, float* %13
%25 = load float, float* %10
%26 = load float, float* %11
%27 = fmul float 0x3FE6F0AB60000000, %26
%28 = call float @llvm.fmuladd.f32(float 0x3FCC7B0700000000, float %25, float %27)
%29 = load float, float* %12
%30 = call float @llvm.fmuladd.f32(float 0x3FAF092DA0000000, float %29, float %28)
store float %30, float* %14
%31 = load float, float* %10
%32 = load float, float* %11
%33 = fmul float 0x3FB8DBD720000000, %32
%34 = call float @llvm.fmuladd.f32(float 0x3F8C887C40000000, float %31, float %33)
%35 = load float, float* %12
%36 = call float @llvm.fmuladd.f32(float 0x3FE6DA8200000000, float %35, float %34)
store float %36, float* %15
%37 = load float, float* %13
%38 = fdiv float %37, 0x3FEEDABA00000000
%39 = call float @Lab(float %38)
store float %39, float* %16
%40 = load float, float* %14
%41 = call float @Lab(float %40)
store float %41, float* %17
%42 = load float, float* %15
%43 = fdiv float %42, 0x3FEA6594A0000000
%44 = call float @Lab(float %43)
store float %44, float* %18
%45 = load float, float* %17
%46 = call float @llvm.fmuladd.f32(float 1.160000e+02, float %45, float -1.600000e+01)
%47 = load float*, float** %7
store float %46, float* %47
%48 = load float, float* %16
%49 = load float, float* %17
%50 = fsub float %48, %49
%51 = fmul float 5.000000e+02, %50
%52 = load float*, float** %8
store float %51, float* %52
%53 = load float, float* %17
%54 = load float, float* %18
%55 = fsub float %53, %54
%56 = fmul float 2.000000e+02, %55
%57 = load float*, float** %9
store float %56, float* %57
ret void
}

LLVM IR (-O2):
define void @RGB2Lab(float* nocapture writeonly %0, float* nocapture writeonly %1, float* nocapture writeonly %2, float %3, float %4, float %5) {
%7 = fmul float %4, 0x3FD8A4E740000000
%8 = tail call float @llvm.fmuladd.f32(float %3, float 0x3FDBE8A5E0000000, float %7)
%9 = tail call float @llvm.fmuladd.f32(float %5, float 0x3FC2507560000000, float %8)
%10 = fmul float %4, 0x3FE6F0AB60000000
%11 = tail call float @llvm.fmuladd.f32(float %3, float 0x3FCC7B0700000000, float %10)
%12 = tail call float @llvm.fmuladd.f32(float %5, float 0x3FAF092DA0000000, float %11)
%13 = fmul float %4, 0x3FB8DBD720000000
%14 = tail call float @llvm.fmuladd.f32(float %3, float 0x3F8C887C40000000, float %13)
%15 = tail call float @llvm.fmuladd.f32(float %5, float 0x3FE6DA8200000000, float %14)
%16 = fdiv float %9, 0x3FEEDABA00000000
%17 = tail call float @Lab(float %16)
%18 = tail call float @Lab(float %12)
%19 = fdiv float %15, 0x3FEA6594A0000000
%20 = tail call float @Lab(float %19)
%21 = tail call float @llvm.fmuladd.f32(float %18, float 1.160000e+02, float -1.600000e+01)
store float %21, float* %0
%22 = fsub float %17, %18
%23 = fmul float %22, 5.000000e+02
store float %23, float* %1
%24 = fsub float %18, %20
%25 = fmul float %24, 2.000000e+02
store float %25, float* %2
ret void
}