void affine_multiply(double dst[6], const double src1[6],
                     const double src2[6]) {
  double d0, d1, d2, d3, d4, d5;
  d0 = src1[0] * src2[0] + src1[1] * src2[2];
  d1 = src1[0] * src2[1] + src1[1] * src2[3];
  d2 = src1[2] * src2[0] + src1[3] * src2[2];
  d3 = src1[2] * src2[1] + src1[3] * src2[3];
  d4 = src1[4] * src2[0] + src1[5] * src2[2] + src2[4];
  d5 = src1[4] * src2[1] + src1[5] * src2[3] + src2[5];
  dst[0] = d0;
  dst[1] = d1;
  dst[2] = d2;
  dst[3] = d3;
  dst[4] = d4;
  dst[5] = d5;
}


x86 assembly (clang, -O0):
<affine_multiply>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x10(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x18(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x10(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x18(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x10(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
addsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm1
mov    -0x18(%rbp),%rax
mulsd  0x18(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
addsd  0x28(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x18(%rax)
movsd  -0x40(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x20(%rax)
movsd  -0x48(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x28(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<affine_multiply>:
movsd  (%rsi),%xmm0
movsd  0x8(%rsi),%xmm2
movsd  0x10(%rsi),%xmm1
movsd  0x18(%rsi),%xmm3
unpcklpd %xmm2,%xmm2
movupd (%rdx),%xmm4
movupd 0x10(%rdx),%xmm5
movupd 0x20(%rdx),%xmm6
mulpd  %xmm5,%xmm2
unpcklpd %xmm0,%xmm0
mulpd  %xmm4,%xmm0
addpd  %xmm2,%xmm0
unpcklpd %xmm3,%xmm3
mulpd  %xmm5,%xmm3
unpcklpd %xmm1,%xmm1
mulpd  %xmm4,%xmm1
addpd  %xmm3,%xmm1
movsd  0x28(%rsi),%xmm2
unpcklpd %xmm2,%xmm2
mulpd  %xmm5,%xmm2
movsd  0x20(%rsi),%xmm3
unpcklpd %xmm3,%xmm3
mulpd  %xmm4,%xmm3
addpd  %xmm2,%xmm3
addpd  %xmm6,%xmm3
movupd %xmm0,(%rdi)
movupd %xmm1,0x10(%rdi)
movupd %xmm3,0x20(%rdi)
ret

LLVM IR (-O0):
define void @affine_multiply(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%13 = load double*, double** %5
%14 = getelementptr inbounds double, double* %13, i64 0
%15 = load double, double* %14
%16 = load double*, double** %6
%17 = getelementptr inbounds double, double* %16, i64 0
%18 = load double, double* %17
%19 = load double*, double** %5
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = load double*, double** %6
%23 = getelementptr inbounds double, double* %22, i64 2
%24 = load double, double* %23
%25 = fmul double %21, %24
%26 = call double @llvm.fmuladd.f64(double %15, double %18, double %25)
store double %26, double* %7
%27 = load double*, double** %5
%28 = getelementptr inbounds double, double* %27, i64 0
%29 = load double, double* %28
%30 = load double*, double** %6
%31 = getelementptr inbounds double, double* %30, i64 1
%32 = load double, double* %31
%33 = load double*, double** %5
%34 = getelementptr inbounds double, double* %33, i64 1
%35 = load double, double* %34
%36 = load double*, double** %6
%37 = getelementptr inbounds double, double* %36, i64 3
%38 = load double, double* %37
%39 = fmul double %35, %38
%40 = call double @llvm.fmuladd.f64(double %29, double %32, double %39)
store double %40, double* %8
%41 = load double*, double** %5
%42 = getelementptr inbounds double, double* %41, i64 2
%43 = load double, double* %42
%44 = load double*, double** %6
%45 = getelementptr inbounds double, double* %44, i64 0
%46 = load double, double* %45
%47 = load double*, double** %5
%48 = getelementptr inbounds double, double* %47, i64 3
%49 = load double, double* %48
%50 = load double*, double** %6
%51 = getelementptr inbounds double, double* %50, i64 2
%52 = load double, double* %51
%53 = fmul double %49, %52
%54 = call double @llvm.fmuladd.f64(double %43, double %46, double %53)
store double %54, double* %9
%55 = load double*, double** %5
%56 = getelementptr inbounds double, double* %55, i64 2
%57 = load double, double* %56
%58 = load double*, double** %6
%59 = getelementptr inbounds double, double* %58, i64 1
%60 = load double, double* %59
%61 = load double*, double** %5
%62 = getelementptr inbounds double, double* %61, i64 3
%63 = load double, double* %62
%64 = load double*, double** %6
%65 = getelementptr inbounds double, double* %64, i64 3
%66 = load double, double* %65
%67 = fmul double %63, %66
%68 = call double @llvm.fmuladd.f64(double %57, double %60, double %67)
store double %68, double* %10
%69 = load double*, double** %5
%70 = getelementptr inbounds double, double* %69, i64 4
%71 = load double, double* %70
%72 = load double*, double** %6
%73 = getelementptr inbounds double, double* %72, i64 0
%74 = load double, double* %73
%75 = load double*, double** %5
%76 = getelementptr inbounds double, double* %75, i64 5
%77 = load double, double* %76
%78 = load double*, double** %6
%79 = getelementptr inbounds double, double* %78, i64 2
%80 = load double, double* %79
%81 = fmul double %77, %80
%82 = call double @llvm.fmuladd.f64(double %71, double %74, double %81)
%83 = load double*, double** %6
%84 = getelementptr inbounds double, double* %83, i64 4
%85 = load double, double* %84
%86 = fadd double %82, %85
store double %86, double* %11
%87 = load double*, double** %5
%88 = getelementptr inbounds double, double* %87, i64 4
%89 = load double, double* %88
%90 = load double*, double** %6
%91 = getelementptr inbounds double, double* %90, i64 1
%92 = load double, double* %91
%93 = load double*, double** %5
%94 = getelementptr inbounds double, double* %93, i64 5
%95 = load double, double* %94
%96 = load double*, double** %6
%97 = getelementptr inbounds double, double* %96, i64 3
%98 = load double, double* %97
%99 = fmul double %95, %98
%100 = call double @llvm.fmuladd.f64(double %89, double %92, double %99)
%101 = load double*, double** %6
%102 = getelementptr inbounds double, double* %101, i64 5
%103 = load double, double* %102
%104 = fadd double %100, %103
store double %104, double* %12
%105 = load double, double* %7
%106 = load double*, double** %4
%107 = getelementptr inbounds double, double* %106, i64 0
store double %105, double* %107
%108 = load double, double* %8
%109 = load double*, double** %4
%110 = getelementptr inbounds double, double* %109, i64 1
store double %108, double* %110
%111 = load double, double* %9
%112 = load double*, double** %4
%113 = getelementptr inbounds double, double* %112, i64 2
store double %111, double* %113
%114 = load double, double* %10
%115 = load double*, double** %4
%116 = getelementptr inbounds double, double* %115, i64 3
store double %114, double* %116
%117 = load double, double* %11
%118 = load double*, double** %4
%119 = getelementptr inbounds double, double* %118, i64 4
store double %117, double* %119
%120 = load double, double* %12
%121 = load double*, double** %4
%122 = getelementptr inbounds double, double* %121, i64 5
store double %120, double* %122
ret void
}

LLVM IR (-O2):
define void @affine_multiply(double* nocapture writeonly %0, double* nocapture %1, double* nocapture %2) {
%4 = load double, double* %1
%5 = getelementptr inbounds double, double* %1, i64 1
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %2, i64 2
%8 = bitcast double* %7 to <2 x double>*
%9 = load <2 x double>, <2 x double>* %8
%10 = bitcast double* %2 to <2 x double>*
%11 = load <2 x double>, <2 x double>* %10
%12 = insertelement <2 x double> poison, double %6, i64 0
%13 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
%14 = fmul <2 x double> %13, %9
%15 = insertelement <2 x double> poison, double %4, i64 0
%16 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> zeroinitializer
%17 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %16, <2 x double> %11, <2 x double> %14)
%18 = getelementptr inbounds double, double* %1, i64 2
%19 = load double, double* %18
%20 = getelementptr inbounds double, double* %1, i64 3
%21 = load double, double* %20
%22 = insertelement <2 x double> poison, double %21, i64 0
%23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
%24 = fmul <2 x double> %9, %23
%25 = insertelement <2 x double> poison, double %19, i64 0
%26 = shufflevector <2 x double> %25, <2 x double> poison, <2 x i32> zeroinitializer
%27 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %26, <2 x double> %11, <2 x double> %24)
%28 = getelementptr inbounds double, double* %1, i64 4
%29 = load double, double* %28
%30 = getelementptr inbounds double, double* %1, i64 5
%31 = load double, double* %30
%32 = getelementptr inbounds double, double* %2, i64 4
%33 = insertelement <2 x double> poison, double %31, i64 0
%34 = shufflevector <2 x double> %33, <2 x double> poison, <2 x i32> zeroinitializer
%35 = fmul <2 x double> %9, %34
%36 = insertelement <2 x double> poison, double %29, i64 0
%37 = shufflevector <2 x double> %36, <2 x double> poison, <2 x i32> zeroinitializer
%38 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %37, <2 x double> %11, <2 x double> %35)
%39 = bitcast double* %32 to <2 x double>*
%40 = load <2 x double>, <2 x double>* %39
%41 = fadd <2 x double> %40, %38
%42 = bitcast double* %0 to <2 x double>*
store <2 x double> %17, <2 x double>* %42
%43 = getelementptr inbounds double, double* %0, i64 2
%44 = bitcast double* %43 to <2 x double>*
store <2 x double> %27, <2 x double>* %44
%45 = getelementptr inbounds double, double* %0, i64 4
%46 = bitcast double* %45 to <2 x double>*
store <2 x double> %41, <2 x double>* %46
ret void
}