void rmv6(double v1[6], double m[36], double v2[6]) {
  int i, j;
  double sum;
  for (i = 0; i < 6; i++) {
    sum = 0.0;
    for (j = 0; j < 6; j++) {
      sum = sum + m[6 * i + j] * v1[j];
    }
    v2[i] = sum;
  }
}


x86 assembly (clang, -O0):
<rmv6>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x6,-0x1c(%rbp)
jge    119a <rmv6+0x9a>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x6,-0x20(%rbp)
jge    117a <rmv6+0x7a>
movsd  -0x28(%rbp),%xmm1
mov    -0x10(%rbp),%rax
imul   $0x6,-0x1c(%rbp),%ecx
add    -0x20(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1130 <rmv6+0x30>
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <rmv6+0x17>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rmv6>:
movsd  (%rsi),%xmm1
mulsd  (%rdi),%xmm1
movsd  0x8(%rsi),%xmm2
xorpd  %xmm0,%xmm0
mulsd  0x8(%rdi),%xmm2
addsd  %xmm0,%xmm1
movsd  0x10(%rsi),%xmm3
mulsd  0x10(%rdi),%xmm3
addsd  %xmm1,%xmm2
movsd  0x18(%rsi),%xmm1
mulsd  0x18(%rdi),%xmm1
addsd  %xmm2,%xmm3
movsd  0x20(%rsi),%xmm2
mulsd  0x20(%rdi),%xmm2
addsd  %xmm3,%xmm1
movsd  0x28(%rsi),%xmm3
mulsd  0x28(%rdi),%xmm3
addsd  %xmm1,%xmm2
addsd  %xmm2,%xmm3
movsd  %xmm3,(%rdx)
movsd  0x30(%rsi),%xmm1
movsd  0x38(%rsi),%xmm2
mulsd  (%rdi),%xmm1
addsd  %xmm0,%xmm1
mulsd  0x8(%rdi),%xmm2
addsd  %xmm1,%xmm2
movsd  0x40(%rsi),%xmm1
mulsd  0x10(%rdi),%xmm1
addsd  %xmm2,%xmm1
movsd  0x48(%rsi),%xmm2
mulsd  0x18(%rdi),%xmm2
addsd  %xmm1,%xmm2
movsd  0x50(%rsi),%xmm1
mulsd  0x20(%rdi),%xmm1
addsd  %xmm2,%xmm1
movsd  0x58(%rsi),%xmm2
mulsd  0x28(%rdi),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rdx)
movsd  0x60(%rsi),%xmm1
movsd  0x68(%rsi),%xmm2
mulsd  (%rdi),%xmm1
addsd  %xmm0,%xmm1
mulsd  0x8(%rdi),%xmm2
addsd  %xmm1,%xmm2
movsd  0x70(%rsi),%xmm1
mulsd  0x10(%rdi),%xmm1
addsd  %xmm2,%xmm1
movsd  0x78(%rsi),%xmm2
mulsd  0x18(%rdi),%xmm2
addsd  %xmm1,%xmm2
movsd  0x80(%rsi),%xmm1
mulsd  0x20(%rdi),%xmm1
addsd  %xmm2,%xmm1
movsd  0x88(%rsi),%xmm2
mulsd  0x28(%rdi),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x10(%rdx)
movsd  0x90(%rsi),%xmm1
mulsd  (%rdi),%xmm1
movsd  0x98(%rsi),%xmm2
addsd  %xmm0,%xmm1
mulsd  0x8(%rdi),%xmm2
addsd  %xmm1,%xmm2
movsd  0xa0(%rsi),%xmm1
mulsd  0x10(%rdi),%xmm1
addsd  %xmm2,%xmm1
movsd  0xa8(%rsi),%xmm2
mulsd  0x18(%rdi),%xmm2
addsd  %xmm1,%xmm2
movsd  0xb0(%rsi),%xmm1
mulsd  0x20(%rdi),%xmm1
addsd  %xmm2,%xmm1
movsd  0xb8(%rsi),%xmm2
mulsd  0x28(%rdi),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x18(%rdx)
movsd  0xc0(%rsi),%xmm1
movsd  0xc8(%rsi),%xmm2
mulsd  (%rdi),%xmm1
mulsd  0x8(%rdi),%xmm2
addsd  %xmm0,%xmm1
movsd  0xd0(%rsi),%xmm3
mulsd  0x10(%rdi),%xmm3
addsd  %xmm1,%xmm2
movsd  0xd8(%rsi),%xmm1
mulsd  0x18(%rdi),%xmm1
addsd  %xmm2,%xmm3
movsd  0xe0(%rsi),%xmm2
mulsd  0x20(%rdi),%xmm2
addsd  %xmm3,%xmm1
movsd  0xe8(%rsi),%xmm3
mulsd  0x28(%rdi),%xmm3
addsd  %xmm1,%xmm2
addsd  %xmm2,%xmm3
movsd  %xmm3,0x20(%rdx)
movsd  0xf0(%rsi),%xmm1
movsd  0xf8(%rsi),%xmm2
mulsd  (%rdi),%xmm1
addsd  %xmm0,%xmm1
mulsd  0x8(%rdi),%xmm2
addsd  %xmm1,%xmm2
movsd  0x100(%rsi),%xmm0
mulsd  0x10(%rdi),%xmm0
addsd  %xmm2,%xmm0
movsd  0x108(%rsi),%xmm1
mulsd  0x18(%rdi),%xmm1
addsd  %xmm0,%xmm1
movsd  0x110(%rsi),%xmm0
mulsd  0x20(%rdi),%xmm0
addsd  %xmm1,%xmm0
movsd  0x118(%rsi),%xmm1
mulsd  0x28(%rdi),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x28(%rdx)
ret

LLVM IR (-O0):
define void @rmv6(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
store i32 0, i32* %7
br label %10
10: ; preds = %42, %3
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 6
br i1 %12, label %13, label %45
13: ; preds = %10
store double 0.000000e+00, double* %9
store i32 0, i32* %8
br label %14
14: ; preds = %33, %13
%15 = load i32, i32* %8
%16 = icmp slt i32 %15, 6
br i1 %16, label %17, label %36
17: ; preds = %14
%18 = load double, double* %9
%19 = load double*, double** %5
%20 = load i32, i32* %7
%21 = mul nsw i32 6, %20
%22 = load i32, i32* %8
%23 = add nsw i32 %21, %22
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double, double* %19, i64 %24
%26 = load double, double* %25
%27 = load double*, double** %4
%28 = load i32, i32* %8
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %27, i64 %29
%31 = load double, double* %30
%32 = call double @llvm.fmuladd.f64(double %26, double %31, double %18)
store double %32, double* %9
br label %33
33: ; preds = %17
%34 = load i32, i32* %8
%35 = add nsw i32 %34, 1
store i32 %35, i32* %8
br label %14
36: ; preds = %14
%37 = load double, double* %9
%38 = load double*, double** %6
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
store double %37, double* %41
br label %42
42: ; preds = %36
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 1
store i32 %44, i32* %7
br label %10
45: ; preds = %10
ret void
}

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