void linear_to_yxz(float bgr[]) {
  const float R = bgr[2];
  const float G = bgr[1];
  const float B = bgr[0];
  bgr[0] = 0.212671f * R + 0.71516f * G + 0.072169f * B;
  bgr[1] = 0.412453f * R + 0.35758f * G + 0.180423f * B;
  bgr[2] = 0.019334f * R + 0.119193f * G + 0.950227f * B;
}


x86 assembly (clang, -O0):
<linear_to_yxz>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm1
movss  0xee2(%rip),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  0xed1(%rip),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
movss  0xeb8(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0xc(%rbp),%xmm1
movss  0xe97(%rip),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  0xe86(%rip),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
movss  0xe6d(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0xc(%rbp),%xmm1
movss  0xe4b(%rip),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  0xe3a(%rip),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
movss  0xe21(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<linear_to_yxz>:
movss  0x8(%rdi),%xmm0
movss  (%rdi),%xmm1
movss  0x4(%rdi),%xmm2
movss  0xeea(%rip),%xmm3
mulss  %xmm2,%xmm3
movss  0xee2(%rip),%xmm4
mulss  %xmm0,%xmm4
addss  %xmm3,%xmm4
movss  0xed6(%rip),%xmm3
mulss  %xmm1,%xmm3
addss  %xmm4,%xmm3
movss  %xmm3,(%rdi)
movss  0xec6(%rip),%xmm3
mulss  %xmm2,%xmm3
movss  0xebe(%rip),%xmm4
mulss  %xmm0,%xmm4
addss  %xmm3,%xmm4
movss  0xeb2(%rip),%xmm3
mulss  %xmm1,%xmm3
addss  %xmm4,%xmm3
mulss  0xea6(%rip),%xmm2
movss  %xmm3,0x4(%rdi)
mulss  0xe9d(%rip),%xmm0
addss  %xmm2,%xmm0
mulss  0xe95(%rip),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x8(%rdi)
ret

LLVM IR (-O0):
define void @linear_to_yxz(float* %0) {
%2 = alloca float*
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float* %0, float** %2
%6 = load float*, float** %2
%7 = getelementptr inbounds float, float* %6, i64 2
%8 = load float, float* %7
store float %8, float* %3
%9 = load float*, float** %2
%10 = getelementptr inbounds float, float* %9, i64 1
%11 = load float, float* %10
store float %11, float* %4
%12 = load float*, float** %2
%13 = getelementptr inbounds float, float* %12, i64 0
%14 = load float, float* %13
store float %14, float* %5
%15 = load float, float* %3
%16 = load float, float* %4
%17 = fmul float 0x3FE6E29740000000, %16
%18 = call float @llvm.fmuladd.f32(float 0x3FCB38CDA0000000, float %15, float %17)
%19 = load float, float* %5
%20 = call float @llvm.fmuladd.f32(float 0x3FB279AAE0000000, float %19, float %18)
%21 = load float*, float** %2
%22 = getelementptr inbounds float, float* %21, i64 0
store float %20, float* %22
%23 = load float, float* %3
%24 = load float, float* %4
%25 = fmul float 0x3FD6E29740000000, %24
%26 = call float @llvm.fmuladd.f32(float 0x3FDA65A140000000, float %23, float %25)
%27 = load float, float* %5
%28 = call float @llvm.fmuladd.f32(float 0x3FC71819E0000000, float %27, float %26)
%29 = load float*, float** %2
%30 = getelementptr inbounds float, float* %29, i64 1
store float %28, float* %30
%31 = load float, float* %3
%32 = load float, float* %4
%33 = fmul float 0x3FBE836EC0000000, %32
%34 = call float @llvm.fmuladd.f32(float 0x3F93CC4AC0000000, float %31, float %33)
%35 = load float, float* %5
%36 = call float @llvm.fmuladd.f32(float 0x3FEE684280000000, float %35, float %34)
%37 = load float*, float** %2
%38 = getelementptr inbounds float, float* %37, i64 2
store float %36, float* %38
ret void
}

LLVM IR (-O2):
define void @linear_to_yxz(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 = fmul float %5, 0x3FE6E29740000000
%8 = tail call float @llvm.fmuladd.f32(float %3, float 0x3FCB38CDA0000000, float %7)
%9 = tail call float @llvm.fmuladd.f32(float %6, float 0x3FB279AAE0000000, float %8)
store float %9, float* %0
%10 = fmul float %5, 0x3FD6E29740000000
%11 = tail call float @llvm.fmuladd.f32(float %3, float 0x3FDA65A140000000, float %10)
%12 = tail call float @llvm.fmuladd.f32(float %6, float 0x3FC71819E0000000, float %11)
store float %12, float* %4
%13 = fmul float %5, 0x3FBE836EC0000000
%14 = tail call float @llvm.fmuladd.f32(float %3, float 0x3F93CC4AC0000000, float %13)
%15 = tail call float @llvm.fmuladd.f32(float %6, float 0x3FEE684280000000, float %14)
store float %15, float* %2
ret void
}