void lower_g(double vcon[(4)], double gcov[(4)][(4)], double vcov[(4)]) {
  int i, j;
  for (i = 0; i < (4); i++) {
    vcov[i] = 0.;
    for (j = 0; j < (4); j++)
      vcov[i] += gcov[i][j] * vcon[j];
  }
  return;
}


x86 assembly (clang, -O0):
<lower_g>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    11a2 <lower_g+0xa2>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x20(%rbp)
cmpl   $0x4,-0x20(%rbp)
jge    118f <lower_g+0x8f>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1138 <lower_g+0x38>
jmp    1194 <lower_g+0x94>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <lower_g+0x17>
pop    %rbp
ret

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

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

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