matrix_mult(vector, matrix, result) double vector[4], matrix[4][4], result[4];
{
  result[0] = matrix[0][0] * vector[0] + matrix[0][1] * vector[1] +
              matrix[0][2] * vector[2] + matrix[0][3] * vector[3];
  result[1] = matrix[1][0] * vector[0] + matrix[1][1] * vector[1] +
              matrix[1][2] * vector[2] + matrix[1][3] * vector[3];
  result[2] = matrix[2][0] * vector[0] + matrix[2][1] * vector[1] +
              matrix[2][2] * vector[2] + matrix[2][3] * vector[3];
  result[3] = matrix[3][0] * vector[0] + matrix[3][1] * vector[1] +
              matrix[3][2] * vector[2] + matrix[3][3] * vector[3];
}


x86 assembly (clang, -O0):
<matrix_mult>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x28(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  0x30(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0x38(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
movsd  0x40(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x48(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  0x50(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0x58(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x18(%rbp),%rax
movsd  0x60(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x68(%rax),%xmm1
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  0x70(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0x78(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrix_mult>:
movsd  (%rsi),%xmm0
movsd  0x8(%rsi),%xmm1
mulsd  0x8(%rdi),%xmm1
mulsd  (%rdi),%xmm0
addsd  %xmm1,%xmm0
movsd  0x10(%rsi),%xmm1
mulsd  0x10(%rdi),%xmm1
addsd  %xmm0,%xmm1
movsd  0x18(%rsi),%xmm0
mulsd  0x18(%rdi),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rdx)
movsd  0x20(%rsi),%xmm0
movsd  0x28(%rsi),%xmm1
mulsd  0x8(%rdi),%xmm1
mulsd  (%rdi),%xmm0
addsd  %xmm1,%xmm0
movsd  0x30(%rsi),%xmm1
mulsd  0x10(%rdi),%xmm1
addsd  %xmm0,%xmm1
movsd  0x38(%rsi),%xmm0
mulsd  0x18(%rdi),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rdx)
movsd  0x40(%rsi),%xmm0
movsd  0x48(%rsi),%xmm1
mulsd  0x8(%rdi),%xmm1
mulsd  (%rdi),%xmm0
addsd  %xmm1,%xmm0
movsd  0x50(%rsi),%xmm1
mulsd  0x10(%rdi),%xmm1
addsd  %xmm0,%xmm1
movsd  0x58(%rsi),%xmm0
mulsd  0x18(%rdi),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rdx)
movsd  0x60(%rsi),%xmm0
movsd  0x68(%rsi),%xmm1
mulsd  0x8(%rdi),%xmm1
mulsd  (%rdi),%xmm0
addsd  %xmm1,%xmm0
movsd  0x70(%rsi),%xmm1
mulsd  0x10(%rdi),%xmm1
addsd  %xmm0,%xmm1
movsd  0x78(%rsi),%xmm0
mulsd  0x18(%rdi),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rdx)
ret

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

LLVM IR (-O2):
define i32 @matrix_mult(double* nocapture %0, [4 x double]* nocapture %1, double* nocapture writeonly %2) {
%4 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 0
%5 = load double, double* %4
%6 = load double, double* %0
%7 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 1
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %0, i64 1
%10 = load double, double* %9
%11 = fmul double %8, %10
%12 = tail call double @llvm.fmuladd.f64(double %5, double %6, double %11)
%13 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 2
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %0, i64 2
%16 = load double, double* %15
%17 = tail call double @llvm.fmuladd.f64(double %14, double %16, double %12)
%18 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 3
%19 = load double, double* %18
%20 = getelementptr inbounds double, double* %0, i64 3
%21 = load double, double* %20
%22 = tail call double @llvm.fmuladd.f64(double %19, double %21, double %17)
store double %22, double* %2
%23 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 0
%24 = load double, double* %23
%25 = load double, double* %0
%26 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 1
%27 = load double, double* %26
%28 = load double, double* %9
%29 = fmul double %27, %28
%30 = tail call double @llvm.fmuladd.f64(double %24, double %25, double %29)
%31 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 2
%32 = load double, double* %31
%33 = load double, double* %15
%34 = tail call double @llvm.fmuladd.f64(double %32, double %33, double %30)
%35 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 3
%36 = load double, double* %35
%37 = load double, double* %20
%38 = tail call double @llvm.fmuladd.f64(double %36, double %37, double %34)
%39 = getelementptr inbounds double, double* %2, i64 1
store double %38, double* %39
%40 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 0
%41 = load double, double* %40
%42 = load double, double* %0
%43 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 1
%44 = load double, double* %43
%45 = load double, double* %9
%46 = fmul double %44, %45
%47 = tail call double @llvm.fmuladd.f64(double %41, double %42, double %46)
%48 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 2
%49 = load double, double* %48
%50 = load double, double* %15
%51 = tail call double @llvm.fmuladd.f64(double %49, double %50, double %47)
%52 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 3
%53 = load double, double* %52
%54 = load double, double* %20
%55 = tail call double @llvm.fmuladd.f64(double %53, double %54, double %51)
%56 = getelementptr inbounds double, double* %2, i64 2
store double %55, double* %56
%57 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 0
%58 = load double, double* %57
%59 = load double, double* %0
%60 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 1
%61 = load double, double* %60
%62 = load double, double* %9
%63 = fmul double %61, %62
%64 = tail call double @llvm.fmuladd.f64(double %58, double %59, double %63)
%65 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 2
%66 = load double, double* %65
%67 = load double, double* %15
%68 = tail call double @llvm.fmuladd.f64(double %66, double %67, double %64)
%69 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 3
%70 = load double, double* %69
%71 = load double, double* %20
%72 = tail call double @llvm.fmuladd.f64(double %70, double %71, double %68)
%73 = getelementptr inbounds double, double* %2, i64 3
store double %72, double* %73
ret i32 undef
}