void rgb(double R, double G, double B, double c1, double c2, double c3,
         double c4, double c5, double c8, double c9, double *Y, double *Cb,
         double *Cr) {
  *Y = c1 * R + c2 * G + c3 * B;
  *Cb = c4 * R + c5 * G + B * 0.5;
  *Cr = 0.5 * R + c8 * G + c9 * B;
}


x86 assembly (clang, -O0):
<rgb>:
push   %rbp
mov    %rsp,%rbp
movsd  0x18(%rbp),%xmm8
movsd  0x10(%rbp),%xmm8
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  %xmm6,-0x38(%rbp)
movsd  %xmm7,-0x40(%rbp)
mov    %rdi,-0x48(%rbp)
mov    %rsi,-0x50(%rbp)
mov    %rdx,-0x58(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  0xe5d(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x50(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm1
movsd  0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xe36(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x58(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rgb>:
mulsd  %xmm1,%xmm4
mulsd  %xmm0,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm2,%xmm5
addsd  %xmm3,%xmm5
movsd  %xmm5,(%rdi)
mulsd  %xmm1,%xmm7
mulsd  %xmm0,%xmm6
addsd  %xmm7,%xmm6
movsd  0xed4(%rip),%xmm3
movapd %xmm2,%xmm4
mulsd  %xmm3,%xmm4
addsd  %xmm6,%xmm4
movsd  %xmm4,(%rsi)
mulsd  0x8(%rsp),%xmm1
mulsd  %xmm3,%xmm0
addsd  %xmm1,%xmm0
mulsd  0x10(%rsp),%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,(%rdx)
ret

LLVM IR (-O0):
define void @rgb(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double* %10, double* %11, double* %12) {
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double*
%25 = alloca double*
%26 = alloca double*
store double %0, double* %14
store double %1, double* %15
store double %2, double* %16
store double %3, double* %17
store double %4, double* %18
store double %5, double* %19
store double %6, double* %20
store double %7, double* %21
store double %8, double* %22
store double %9, double* %23
store double* %10, double** %24
store double* %11, double** %25
store double* %12, double** %26
%27 = load double, double* %17
%28 = load double, double* %14
%29 = load double, double* %18
%30 = load double, double* %15
%31 = fmul double %29, %30
%32 = call double @llvm.fmuladd.f64(double %27, double %28, double %31)
%33 = load double, double* %19
%34 = load double, double* %16
%35 = call double @llvm.fmuladd.f64(double %33, double %34, double %32)
%36 = load double*, double** %24
store double %35, double* %36
%37 = load double, double* %20
%38 = load double, double* %14
%39 = load double, double* %21
%40 = load double, double* %15
%41 = fmul double %39, %40
%42 = call double @llvm.fmuladd.f64(double %37, double %38, double %41)
%43 = load double, double* %16
%44 = call double @llvm.fmuladd.f64(double %43, double 5.000000e-01, double %42)
%45 = load double*, double** %25
store double %44, double* %45
%46 = load double, double* %14
%47 = load double, double* %22
%48 = load double, double* %15
%49 = fmul double %47, %48
%50 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %46, double %49)
%51 = load double, double* %23
%52 = load double, double* %16
%53 = call double @llvm.fmuladd.f64(double %51, double %52, double %50)
%54 = load double*, double** %26
store double %53, double* %54
ret void
}

LLVM IR (-O2):
define void @rgb(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double* nocapture writeonly %10, double* nocapture writeonly %11, double* nocapture writeonly %12) {
%14 = fmul double %1, %4
%15 = tail call double @llvm.fmuladd.f64(double %3, double %0, double %14)
%16 = tail call double @llvm.fmuladd.f64(double %5, double %2, double %15)
store double %16, double* %10
%17 = fmul double %1, %7
%18 = tail call double @llvm.fmuladd.f64(double %6, double %0, double %17)
%19 = tail call double @llvm.fmuladd.f64(double %2, double 5.000000e-01, double %18)
store double %19, double* %11
%20 = fmul double %1, %8
%21 = tail call double @llvm.fmuladd.f64(double %0, double 5.000000e-01, double %20)
%22 = tail call double @llvm.fmuladd.f64(double %9, double %2, double %21)
store double %22, double* %12
ret void
}