void rgb2yuv(double *y, double *u, double *v, double r, double g, double b) {
  double trans[9] = {0.47285400000000,  1.42352700000000,  -0.04398100000000,
                     -0.60773500000000, -1.14177500000000, 0.75891000000000,
                     0.58584600000000,  -0.39329200000000, 0.04464600000000};
  *y = trans[0] * r + trans[1] * g + trans[2] * b;
  *u = trans[3] * r + trans[4] * g + trans[5] * b;
  *v = trans[6] * r + trans[7] * g + trans[8] * b;
}


x86 assembly (clang, -O0):
<rgb2yuv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xebf(%rip),%rsi
mov    $0x48,%edx
call   1030 <memcpy@plt>
movsd  -0x80(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x68(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x50(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rgb2yuv>:
movsd  0xef8(%rip),%xmm3
mulsd  %xmm1,%xmm3
movsd  0xef4(%rip),%xmm4
mulsd  %xmm0,%xmm4
addsd  %xmm3,%xmm4
movsd  0xeec(%rip),%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm4,%xmm3
movsd  %xmm3,(%rdi)
movsd  0xee0(%rip),%xmm3
mulsd  %xmm1,%xmm3
movsd  0xedc(%rip),%xmm4
mulsd  %xmm0,%xmm4
addsd  %xmm3,%xmm4
movsd  0xed4(%rip),%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm4,%xmm3
mulsd  0xecc(%rip),%xmm1
movsd  %xmm3,(%rsi)
mulsd  0xec8(%rip),%xmm0
addsd  %xmm1,%xmm0
mulsd  0xec4(%rip),%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,(%rdx)
ret

LLVM IR (-O0):
@__const.rgb2yuv.trans = [9 x double] [double 4.728540e-01, double 0x3FF6C6C43F5F9160, double -4.398100e-02, double -6.077350e-01, double 0xBFF244B5DCC63F14, double 0x3FE848FD9FD36F7E, double 5.858460e-01, double -3.932920e-01, double 4.464600e-02]
define void @rgb2yuv(double* %0, double* %1, double* %2, double %3, double %4, double %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca [9 x double]
store double* %0, double** %7
store double* %1, double** %8
store double* %2, double** %9
store double %3, double* %10
store double %4, double* %11
store double %5, double* %12
%14 = bitcast [9 x double]* %13 to i8*
%15 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 0
%16 = load double, double* %15
%17 = load double, double* %10
%18 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 1
%19 = load double, double* %18
%20 = load double, double* %11
%21 = fmul double %19, %20
%22 = call double @llvm.fmuladd.f64(double %16, double %17, double %21)
%23 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 2
%24 = load double, double* %23
%25 = load double, double* %12
%26 = call double @llvm.fmuladd.f64(double %24, double %25, double %22)
%27 = load double*, double** %7
store double %26, double* %27
%28 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 3
%29 = load double, double* %28
%30 = load double, double* %10
%31 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 4
%32 = load double, double* %31
%33 = load double, double* %11
%34 = fmul double %32, %33
%35 = call double @llvm.fmuladd.f64(double %29, double %30, double %34)
%36 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 5
%37 = load double, double* %36
%38 = load double, double* %12
%39 = call double @llvm.fmuladd.f64(double %37, double %38, double %35)
%40 = load double*, double** %8
store double %39, double* %40
%41 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 6
%42 = load double, double* %41
%43 = load double, double* %10
%44 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 7
%45 = load double, double* %44
%46 = load double, double* %11
%47 = fmul double %45, %46
%48 = call double @llvm.fmuladd.f64(double %42, double %43, double %47)
%49 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 8
%50 = load double, double* %49
%51 = load double, double* %12
%52 = call double @llvm.fmuladd.f64(double %50, double %51, double %48)
%53 = load double*, double** %9
store double %52, double* %53
ret void
}

LLVM IR (-O2):
define void @rgb2yuv(double* nocapture writeonly %0, double* nocapture writeonly %1, double* nocapture writeonly %2, double %3, double %4, double %5) {
%7 = fmul double %4, 0x3FF6C6C43F5F9160
%8 = tail call double @llvm.fmuladd.f64(double %3, double 4.728540e-01, double %7)
%9 = tail call double @llvm.fmuladd.f64(double %5, double -4.398100e-02, double %8)
store double %9, double* %0
%10 = fmul double %4, 0xBFF244B5DCC63F14
%11 = tail call double @llvm.fmuladd.f64(double %3, double -6.077350e-01, double %10)
%12 = tail call double @llvm.fmuladd.f64(double %5, double 0x3FE848FD9FD36F7E, double %11)
store double %12, double* %1
%13 = fmul double %4, -3.932920e-01
%14 = tail call double @llvm.fmuladd.f64(double %3, double 5.858460e-01, double %13)
%15 = tail call double @llvm.fmuladd.f64(double %5, double 4.464600e-02, double %14)
store double %15, double* %2
ret void
}