void gemm(const double *__restrict__ A, const double *__restrict__ B,
          double *__restrict__ C) {
  unsigned int l_m = 0;
  unsigned int l_n = 0;
  unsigned int l_k = 0;
  for (l_n = 0; l_n < 9; l_n++) {
    for (l_m = 0; l_m < 10; l_m++) {
      C[(l_n * 10) + l_m] = 0.0;
    }
    for (l_k = 0; l_k < 17; l_k++) {
      for (l_m = 0; l_m < 10; l_m++) {
        C[(l_n * 10) + l_m] += A[(l_k * 20) + l_m] * B[(l_n * 20) + l_k];
      }
    }
  }
}


x86 assembly (clang, -O0):
<gemm>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x9,-0x20(%rbp)
jae    1203 <gemm+0x103>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jae    116a <gemm+0x6a>
mov    -0x18(%rbp),%rax
imul   $0xa,-0x20(%rbp),%ecx
add    -0x1c(%rbp),%ecx
mov    %ecx,%ecx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113d <gemm+0x3d>
movl   $0x0,-0x24(%rbp)
cmpl   $0x11,-0x24(%rbp)
jae    11f0 <gemm+0xf0>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jae    11dd <gemm+0xdd>
mov    -0x8(%rbp),%rax
imul   $0x14,-0x24(%rbp),%ecx
add    -0x1c(%rbp),%ecx
mov    %ecx,%ecx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
imul   $0x14,-0x20(%rbp),%ecx
add    -0x24(%rbp),%ecx
mov    %ecx,%ecx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
imul   $0xa,-0x20(%rbp),%ecx
add    -0x1c(%rbp),%ecx
mov    %ecx,%ecx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1182 <gemm+0x82>
jmp    11e2 <gemm+0xe2>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1171 <gemm+0x71>
jmp    11f5 <gemm+0xf5>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    112c <gemm+0x2c>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gemm>:
add    $0x40,%rdi
xor    %r8d,%r8d
xorps  %xmm8,%xmm8
nopl   0x0(%rax,%rax,1)
lea    (%r8,%r8,1),%rax
lea    (%rax,%rax,4),%r9
movups %xmm8,0x10(%rdx,%r9,8)
movups %xmm8,0x20(%rdx,%r9,8)
movups %xmm8,0x30(%rdx,%r9,8)
movups %xmm8,0x40(%rdx,%r9,8)
movups %xmm8,(%rdx,%r9,8)
movupd 0x10(%rdx,%r9,8),%xmm6
movupd 0x20(%rdx,%r9,8),%xmm5
movupd 0x30(%rdx,%r9,8),%xmm4
movupd 0x40(%rdx,%r9,8),%xmm0
xorpd  %xmm7,%xmm7
movhpd 0x8(%rdx,%r9,8),%xmm7
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movapd %xmm0,%xmm13
movapd %xmm4,%xmm12
movapd %xmm5,%xmm11
movapd %xmm6,%xmm10
movapd %xmm7,%xmm9
movupd -0x40(%rax),%xmm2
movupd -0x30(%rax),%xmm3
movupd -0x20(%rax),%xmm14
movupd -0x10(%rax),%xmm15
movsd  (%rsi,%rcx,8),%xmm0
unpcklpd %xmm0,%xmm0
mulpd  %xmm0,%xmm2
movapd %xmm2,%xmm7
addpd  %xmm9,%xmm7
mulpd  %xmm0,%xmm3
movapd %xmm3,%xmm6
addpd  %xmm10,%xmm6
mulpd  %xmm0,%xmm14
movapd %xmm14,%xmm5
addpd  %xmm11,%xmm5
mulpd  %xmm0,%xmm15
movapd %xmm15,%xmm4
addpd  %xmm12,%xmm4
movupd (%rax),%xmm1
mulpd  %xmm0,%xmm1
movapd %xmm1,%xmm0
addpd  %xmm13,%xmm0
add    $0x1,%rcx
add    $0xa0,%rax
cmp    $0x11,%rcx
jne    1170 <gemm+0x70>
addpd  %xmm13,%xmm1
addpd  %xmm12,%xmm15
addpd  %xmm11,%xmm14
addpd  %xmm10,%xmm3
addpd  %xmm9,%xmm2
movupd %xmm2,(%rdx,%r9,8)
movupd %xmm3,0x10(%rdx,%r9,8)
movupd %xmm14,0x20(%rdx,%r9,8)
movupd %xmm15,0x30(%rdx,%r9,8)
movupd %xmm1,0x40(%rdx,%r9,8)
add    $0x1,%r8
add    $0xa0,%rsi
cmp    $0x9,%r8
jne    1110 <gemm+0x10>
ret

LLVM IR (-O0):
define void @gemm(double* noalias %0, double* noalias %1, double* noalias %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %8
br label %10
10: ; preds = %70, %3
%11 = load i32, i32* %8
%12 = icmp ult i32 %11, 9
br i1 %12, label %13, label %73
13: ; preds = %10
store i32 0, i32* %7
br label %14
14: ; preds = %25, %13
%15 = load i32, i32* %7
%16 = icmp ult i32 %15, 10
br i1 %16, label %17, label %28
17: ; preds = %14
%18 = load double*, double** %6
%19 = load i32, i32* %8
%20 = mul i32 %19, 10
%21 = load i32, i32* %7
%22 = add i32 %20, %21
%23 = zext i32 %22 to i64
%24 = getelementptr inbounds double, double* %18, i64 %23
store double 0.000000e+00, double* %24
br label %25
25: ; preds = %17
%26 = load i32, i32* %7
%27 = add i32 %26, 1
store i32 %27, i32* %7
br label %14
28: ; preds = %14
store i32 0, i32* %9
br label %29
29: ; preds = %66, %28
%30 = load i32, i32* %9
%31 = icmp ult i32 %30, 17
br i1 %31, label %32, label %69
32: ; preds = %29
store i32 0, i32* %7
br label %33
33: ; preds = %62, %32
%34 = load i32, i32* %7
%35 = icmp ult i32 %34, 10
br i1 %35, label %36, label %65
36: ; preds = %33
%37 = load double*, double** %4
%38 = load i32, i32* %9
%39 = mul i32 %38, 20
%40 = load i32, i32* %7
%41 = add i32 %39, %40
%42 = zext i32 %41 to i64
%43 = getelementptr inbounds double, double* %37, i64 %42
%44 = load double, double* %43
%45 = load double*, double** %5
%46 = load i32, i32* %8
%47 = mul i32 %46, 20
%48 = load i32, i32* %9
%49 = add i32 %47, %48
%50 = zext i32 %49 to i64
%51 = getelementptr inbounds double, double* %45, i64 %50
%52 = load double, double* %51
%53 = load double*, double** %6
%54 = load i32, i32* %8
%55 = mul i32 %54, 10
%56 = load i32, i32* %7
%57 = add i32 %55, %56
%58 = zext i32 %57 to i64
%59 = getelementptr inbounds double, double* %53, i64 %58
%60 = load double, double* %59
%61 = call double @llvm.fmuladd.f64(double %44, double %52, double %60)
store double %61, double* %59
br label %62
62: ; preds = %36
%63 = load i32, i32* %7
%64 = add i32 %63, 1
store i32 %64, i32* %7
br label %33
65: ; preds = %33
br label %66
66: ; preds = %65
%67 = load i32, i32* %9
%68 = add i32 %67, 1
store i32 %68, i32* %9
br label %29
69: ; preds = %29
br label %70
70: ; preds = %69
%71 = load i32, i32* %8
%72 = add i32 %71, 1
store i32 %72, i32* %8
br label %10
73: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @gemm(double* noalias nocapture %0, double* noalias nocapture %1, double* noalias nocapture %2) {
br label %4
4: ; preds = %3, %69
%5 = phi i64 [ 0, %3 ], [ %80, %69 ]
%6 = mul nuw nsw i64 %5, 10
%7 = getelementptr double, double* %2, i64 %6
%8 = bitcast double* %7 to i8*
%9 = mul nuw nsw i64 %5, 20
%10 = or i64 %6, 1
%11 = getelementptr inbounds double, double* %2, i64 %10
%12 = add nuw nsw i64 %6, 2
%13 = getelementptr inbounds double, double* %2, i64 %12
%14 = add nuw nsw i64 %6, 4
%15 = getelementptr inbounds double, double* %2, i64 %14
%16 = add nuw nsw i64 %6, 6
%17 = getelementptr inbounds double, double* %2, i64 %16
%18 = add nuw nsw i64 %6, 8
%19 = getelementptr inbounds double, double* %2, i64 %18
%20 = load double, double* %11
%21 = bitcast double* %13 to <2 x double>*
%22 = load <2 x double>, <2 x double>* %21
%23 = bitcast double* %15 to <2 x double>*
%24 = load <2 x double>, <2 x double>* %23
%25 = bitcast double* %17 to <2 x double>*
%26 = load <2 x double>, <2 x double>* %25
%27 = bitcast double* %19 to <2 x double>*
%28 = load <2 x double>, <2 x double>* %27
%29 = insertelement <2 x double> <double 0.000000e+00, double poison>, double %20, i64 1
br label %30
30: ; preds = %30, %4
%31 = phi i64 [ 0, %4 ], [ %67, %30 ]
%32 = phi <2 x double> [ %29, %4 ], [ %46, %30 ]
%33 = phi <2 x double> [ %22, %4 ], [ %51, %30 ]
%34 = phi <2 x double> [ %24, %4 ], [ %56, %30 ]
%35 = phi <2 x double> [ %26, %4 ], [ %61, %30 ]
%36 = phi <2 x double> [ %28, %4 ], [ %66, %30 ]
%37 = mul nuw nsw i64 %31, 20
%38 = add nuw nsw i64 %31, %9
%39 = getelementptr inbounds double, double* %1, i64 %38
%40 = load double, double* %39
%41 = getelementptr inbounds double, double* %0, i64 %37
%42 = bitcast double* %41 to <2 x double>*
%43 = load <2 x double>, <2 x double>* %42
%44 = insertelement <2 x double> poison, double %40, i64 0
%45 = shufflevector <2 x double> %44, <2 x double> poison, <2 x i32> zeroinitializer
%46 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %43, <2 x double> %45, <2 x double> %32)
%47 = or i64 %37, 2
%48 = getelementptr inbounds double, double* %0, i64 %47
%49 = bitcast double* %48 to <2 x double>*
%50 = load <2 x double>, <2 x double>* %49
%51 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %50, <2 x double> %45, <2 x double> %33)
%52 = add nuw nsw i64 %37, 4
%53 = getelementptr inbounds double, double* %0, i64 %52
%54 = bitcast double* %53 to <2 x double>*
%55 = load <2 x double>, <2 x double>* %54
%56 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %55, <2 x double> %45, <2 x double> %34)
%57 = add nuw nsw i64 %37, 6
%58 = getelementptr inbounds double, double* %0, i64 %57
%59 = bitcast double* %58 to <2 x double>*
%60 = load <2 x double>, <2 x double>* %59
%61 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %60, <2 x double> %45, <2 x double> %35)
%62 = add nuw nsw i64 %37, 8
%63 = getelementptr inbounds double, double* %0, i64 %62
%64 = bitcast double* %63 to <2 x double>*
%65 = load <2 x double>, <2 x double>* %64
%66 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %65, <2 x double> %45, <2 x double> %36)
%67 = add nuw nsw i64 %31, 1
%68 = icmp eq i64 %67, 17
br i1 %68, label %69, label %30
69: ; preds = %30
%70 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %65, <2 x double> %45, <2 x double> %36)
%71 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %60, <2 x double> %45, <2 x double> %35)
%72 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %55, <2 x double> %45, <2 x double> %34)
%73 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %50, <2 x double> %45, <2 x double> %33)
%74 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %43, <2 x double> %45, <2 x double> %32)
%75 = bitcast double* %7 to <2 x double>*
store <2 x double> %74, <2 x double>* %75
%76 = bitcast double* %13 to <2 x double>*
store <2 x double> %73, <2 x double>* %76
%77 = bitcast double* %15 to <2 x double>*
store <2 x double> %72, <2 x double>* %77
%78 = bitcast double* %17 to <2 x double>*
store <2 x double> %71, <2 x double>* %78
%79 = bitcast double* %19 to <2 x double>*
store <2 x double> %70, <2 x double>* %79
%80 = add nuw nsw i64 %5, 1
%81 = icmp eq i64 %80, 9
br i1 %81, label %82, label %4
82: ; preds = %69
ret void
}