void multMatVec(const double m[16], const double v[4], double res[4]) {
  res[0] = m[0] * v[0] + m[4] * v[1] + m[8] * v[2] + m[12] * v[3];
  res[1] = m[1] * v[0] + m[5] * v[1] + m[9] * v[2] + m[13] * v[3];
  res[2] = m[2] * v[0] + m[6] * v[1] + m[10] * v[2] + m[14] * v[3];
  res[3] = m[3] * v[0] + m[7] * v[1] + m[11] * v[2] + m[15] * v[3];
}


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

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

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

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