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


x86 assembly (clang, -O0):
<rmv7>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x7,-0x1c(%rbp)
jge    119a <rmv7+0x9a>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x7,-0x20(%rbp)
jge    117a <rmv7+0x7a>
movsd  -0x28(%rbp),%xmm1
mov    -0x10(%rbp),%rax
imul   $0x7,-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 <rmv7+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 <rmv7+0x17>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rmv7>:
add    $0x30,%rsi
xor    %eax,%eax
xorpd  %xmm0,%xmm0
nopw   0x0(%rax,%rax,1)
movsd  -0x30(%rsi),%xmm1
movsd  -0x28(%rsi),%xmm2
mulsd  (%rdi),%xmm1
addsd  %xmm0,%xmm1
mulsd  0x8(%rdi),%xmm2
addsd  %xmm1,%xmm2
movsd  -0x20(%rsi),%xmm1
mulsd  0x10(%rdi),%xmm1
addsd  %xmm2,%xmm1
movsd  -0x18(%rsi),%xmm2
mulsd  0x18(%rdi),%xmm2
addsd  %xmm1,%xmm2
movsd  -0x10(%rsi),%xmm1
mulsd  0x20(%rdi),%xmm1
addsd  %xmm2,%xmm1
movsd  -0x8(%rsi),%xmm2
mulsd  0x28(%rdi),%xmm2
addsd  %xmm1,%xmm2
movsd  (%rsi),%xmm1
mulsd  0x30(%rdi),%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,(%rdx,%rax,8)
add    $0x1,%rax
add    $0x38,%rsi
cmp    $0x7,%rax
jne    1110 <rmv7+0x10>
ret

LLVM IR (-O0):
define void @rmv7(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, 7
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, 7
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 7, %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 @rmv7(double* nocapture %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = getelementptr inbounds double, double* %0, i64 2
%6 = getelementptr inbounds double, double* %0, i64 3
%7 = getelementptr inbounds double, double* %0, i64 4
%8 = getelementptr inbounds double, double* %0, i64 5
%9 = getelementptr inbounds double, double* %0, i64 6
br label %10
10: ; preds = %3, %10
%11 = phi i64 [ 0, %3 ], [ %48, %10 ]
%12 = mul nuw nsw i64 %11, 7
%13 = getelementptr inbounds double, double* %1, i64 %12
%14 = load double, double* %13
%15 = load double, double* %0
%16 = tail call double @llvm.fmuladd.f64(double %14, double %15, double 0.000000e+00)
%17 = add nuw nsw i64 %12, 1
%18 = getelementptr inbounds double, double* %1, i64 %17
%19 = load double, double* %18
%20 = load double, double* %4
%21 = tail call double @llvm.fmuladd.f64(double %19, double %20, double %16)
%22 = add nuw nsw i64 %12, 2
%23 = getelementptr inbounds double, double* %1, i64 %22
%24 = load double, double* %23
%25 = load double, double* %5
%26 = tail call double @llvm.fmuladd.f64(double %24, double %25, double %21)
%27 = add nuw nsw i64 %12, 3
%28 = getelementptr inbounds double, double* %1, i64 %27
%29 = load double, double* %28
%30 = load double, double* %6
%31 = tail call double @llvm.fmuladd.f64(double %29, double %30, double %26)
%32 = add nuw nsw i64 %12, 4
%33 = getelementptr inbounds double, double* %1, i64 %32
%34 = load double, double* %33
%35 = load double, double* %7
%36 = tail call double @llvm.fmuladd.f64(double %34, double %35, double %31)
%37 = add nuw nsw i64 %12, 5
%38 = getelementptr inbounds double, double* %1, i64 %37
%39 = load double, double* %38
%40 = load double, double* %8
%41 = tail call double @llvm.fmuladd.f64(double %39, double %40, double %36)
%42 = add nuw nsw i64 %12, 6
%43 = getelementptr inbounds double, double* %1, i64 %42
%44 = load double, double* %43
%45 = load double, double* %9
%46 = tail call double @llvm.fmuladd.f64(double %44, double %45, double %41)
%47 = getelementptr inbounds double, double* %2, i64 %11
store double %46, double* %47
%48 = add nuw nsw i64 %11, 1
%49 = icmp eq i64 %48, 7
br i1 %49, label %50, label %10
50: ; preds = %10
ret void
}