void kernel_dsyrk_nn_2x2_lib4(int kmax, double *A, double *B, int sdb,
                              double *C, double *D, int alg) {
  const int bs = 4;
  int k;
  double a_0, a_1, b_0, b_1, c_00 = 0, c_10 = 0, c_11 = 0;
  for (k = 0; k < kmax - 3; k += 4) {
    a_0 = A[0 + bs * 0];
    a_1 = A[1 + bs * 0];
    b_0 = B[0 + bs * 0];
    b_1 = B[0 + bs * 1];
    c_00 += a_0 * b_0;
    c_10 += a_1 * b_0;
    c_11 += a_1 * b_1;
    a_0 = A[0 + bs * 1];
    a_1 = A[1 + bs * 1];
    b_0 = B[1 + bs * 0];
    b_1 = B[1 + bs * 1];
    c_00 += a_0 * b_0;
    c_10 += a_1 * b_0;
    c_11 += a_1 * b_1;
    a_0 = A[0 + bs * 2];
    a_1 = A[1 + bs * 2];
    b_0 = B[2 + bs * 0];
    b_1 = B[2 + bs * 1];
    c_00 += a_0 * b_0;
    c_10 += a_1 * b_0;
    c_11 += a_1 * b_1;
    a_0 = A[0 + bs * 3];
    a_1 = A[1 + bs * 3];
    b_0 = B[3 + bs * 0];
    b_1 = B[3 + bs * 1];
    c_00 += a_0 * b_0;
    c_10 += a_1 * b_0;
    c_11 += a_1 * b_1;
    A += 16;
    B += 4 * sdb;
  }
  for (; k < kmax; k++) {
    a_0 = A[0 + bs * 0];
    a_1 = A[1 + bs * 0];
    b_0 = B[0 + bs * 0];
    b_1 = B[0 + bs * 1];
    c_00 += a_0 * b_0;
    c_10 += a_1 * b_0;
    c_11 += a_1 * b_1;
    A += 4;
    B += 1;
  }
  double d_00, d_10, d_11;
  if (alg == 0) {
    D[0 + bs * 0] = c_00;
    D[1 + bs * 0] = c_10;
    D[1 + bs * 1] = c_11;
  } else {
    d_00 = C[0 + bs * 0];
    d_10 = C[1 + bs * 0];
    d_11 = C[1 + bs * 1];
    if (alg == 1) {
      d_00 += c_00;
      d_10 += c_10;
      d_11 += c_11;
    } else {
      d_00 -= c_00;
      d_10 -= c_10;
      d_11 -= c_11;
    }
    D[0 + bs * 0] = d_00;
    D[1 + bs * 0] = d_10;
    D[1 + bs * 1] = d_11;
  }
}


x86 assembly (clang, -O0):
<kernel_dsyrk_nn_2x2_lib4>:
push   %rbp
mov    %rsp,%rbp
push   %rax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x4,-0x34(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x3,%ecx
cmp    %ecx,%eax
jge    13b7 <kernel_dsyrk_nn_2x2_lib4+0x2b7>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x28(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x40(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x48(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x30(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x60(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x68(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x38(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x10(%rbp)
mov    -0x1c(%rbp),%ecx
shl    $0x2,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x38(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x38(%rbp)
jmp    1144 <kernel_dsyrk_nn_2x2_lib4+0x44>
jmp    13bc <kernel_dsyrk_nn_2x2_lib4+0x2bc>
mov    -0x38(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1478 <kernel_dsyrk_nn_2x2_lib4+0x378>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    13bc <kernel_dsyrk_nn_2x2_lib4+0x2bc>
cmpl   $0x0,0x10(%rbp)
jne    14b0 <kernel_dsyrk_nn_2x2_lib4+0x3b0>
movsd  -0x60(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x68(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x70(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x28(%rax)
jmp    1589 <kernel_dsyrk_nn_2x2_lib4+0x489>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x28(%rax),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
cmpl   $0x1,0x10(%rbp)
jne    151e <kernel_dsyrk_nn_2x2_lib4+0x41e>
movsd  -0x60(%rbp),%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x68(%rbp),%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x70(%rbp),%xmm0
addsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
jmp    155d <kernel_dsyrk_nn_2x2_lib4+0x45d>
movsd  -0x60(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x68(%rbp),%xmm1
movsd  -0x80(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x70(%rbp),%xmm1
movsd  -0x88(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x80(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x88(%rbp),%xmm0
ff
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x28(%rax)
add    $0x8,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_dsyrk_nn_2x2_lib4>:
cmp    $0x4,%edi
jl     11e1 <kernel_dsyrk_nn_2x2_lib4+0xe1>
lea    -0x3(%rdi),%r10d
shl    $0x2,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
xorpd  %xmm2,%xmm2
xor    %eax,%eax
xorpd  %xmm0,%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movupd (%rsi),%xmm6
movupd 0x20(%rsi),%xmm4
movsd  (%rdx),%xmm7
unpcklpd %xmm7,%xmm7
mulpd  %xmm6,%xmm7
unpckhpd %xmm6,%xmm6
mulsd  0x20(%rdx),%xmm6
movupd 0x40(%rsi),%xmm5
addsd  %xmm0,%xmm6
movupd 0x60(%rsi),%xmm0
movsd  0x8(%rdx),%xmm1
movsd  0x10(%rdx),%xmm3
movsd  0x18(%rdx),%xmm8
addpd  %xmm2,%xmm7
unpcklpd %xmm1,%xmm1
mulpd  %xmm4,%xmm1
unpckhpd %xmm4,%xmm4
mulsd  0x28(%rdx),%xmm4
addpd  %xmm7,%xmm1
addsd  %xmm6,%xmm4
unpcklpd %xmm3,%xmm3
mulpd  %xmm5,%xmm3
addpd  %xmm1,%xmm3
unpckhpd %xmm5,%xmm5
mulsd  0x30(%rdx),%xmm5
addsd  %xmm4,%xmm5
unpcklpd %xmm8,%xmm8
mulpd  %xmm0,%xmm8
movapd %xmm8,%xmm2
addpd  %xmm3,%xmm2
unpckhpd %xmm0,%xmm0
mulsd  0x38(%rdx),%xmm0
addsd  %xmm5,%xmm0
sub    $0xffffffffffffff80,%rsi
add    $0x4,%eax
add    %rcx,%rdx
cmp    %r10d,%eax
jl     1130 <kernel_dsyrk_nn_2x2_lib4+0x30>
addpd  %xmm3,%xmm8
mov    %edi,%ecx
and    $0xfffffffc,%ecx
jmp    11ec <kernel_dsyrk_nn_2x2_lib4+0xec>
xorpd  %xmm8,%xmm8
xorpd  %xmm0,%xmm0
xor    %ecx,%ecx
mov    0x8(%rsp),%r10d
cmp    %edi,%ecx
jge    1208 <kernel_dsyrk_nn_2x2_lib4+0x108>
mov    %ecx,%eax
not    %eax
test   $0x1,%dil
jne    1216 <kernel_dsyrk_nn_2x2_lib4+0x116>
add    %edi,%eax
jne    1250 <kernel_dsyrk_nn_2x2_lib4+0x150>
jmp    12c3 <kernel_dsyrk_nn_2x2_lib4+0x1c3>
movapd %xmm0,%xmm3
movapd %xmm8,%xmm2
jmp    12c3 <kernel_dsyrk_nn_2x2_lib4+0x1c3>
movupd (%rsi),%xmm3
movsd  (%rdx),%xmm2
unpcklpd %xmm2,%xmm2
mulpd  %xmm3,%xmm2
addpd  %xmm8,%xmm2
unpckhpd %xmm3,%xmm3
mulsd  0x20(%rdx),%xmm3
addsd  %xmm0,%xmm3
add    $0x20,%rsi
add    $0x8,%rdx
or     $0x1,%ecx
movapd %xmm3,%xmm0
movapd %xmm2,%xmm8
add    %edi,%eax
je     12c3 <kernel_dsyrk_nn_2x2_lib4+0x1c3>
sub    %ecx,%edi
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%rdx,%rcx,8),%xmm3
movsd  0x8(%rdx,%rcx,8),%xmm2
unpcklpd %xmm3,%xmm3
movupd (%rsi),%xmm1
mulpd  %xmm1,%xmm3
unpckhpd %xmm1,%xmm1
mulsd  0x20(%rdx,%rcx,8),%xmm1
addsd  %xmm0,%xmm1
movupd 0x20(%rsi),%xmm0
addpd  %xmm8,%xmm3
unpcklpd %xmm2,%xmm2
mulpd  %xmm0,%xmm2
movapd %xmm2,%xmm8
addpd  %xmm3,%xmm8
unpckhpd %xmm0,%xmm0
mulsd  0x28(%rdx,%rcx,8),%xmm0
addsd  %xmm1,%xmm0
add    $0x2,%rcx
add    $0x40,%rsi
cmp    %ecx,%edi
jne    1260 <kernel_dsyrk_nn_2x2_lib4+0x160>
addpd  %xmm3,%xmm2
movapd %xmm0,%xmm3
test   %r10d,%r10d
je     12f3 <kernel_dsyrk_nn_2x2_lib4+0x1f3>
movupd (%r8),%xmm0
movsd  0x28(%r8),%xmm1
cmp    $0x1,%r10d
jne    12e3 <kernel_dsyrk_nn_2x2_lib4+0x1e3>
addpd  %xmm0,%xmm2
addsd  %xmm1,%xmm3
jmp    12f3 <kernel_dsyrk_nn_2x2_lib4+0x1f3>
subpd  %xmm2,%xmm0
subsd  %xmm3,%xmm1
movapd %xmm1,%xmm3
movapd %xmm0,%xmm2
movupd %xmm2,(%r9)
movsd  %xmm3,0x28(%r9)
ret

LLVM IR (-O0):
define void @kernel_dsyrk_nn_2x2_lib4(i32 %0, double* %1, double* %2, i32 %3, double* %4, double* %5, i32 %6) {
%8 = alloca i32
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca double*
%13 = alloca double*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
store i32 %0, i32* %8
store double* %1, double** %9
store double* %2, double** %10
store i32 %3, i32* %11
store double* %4, double** %12
store double* %5, double** %13
store i32 %6, i32* %14
store i32 4, i32* %15
store double 0.000000e+00, double* %21
store double 0.000000e+00, double* %22
store double 0.000000e+00, double* %23
store i32 0, i32* %16
br label %27
27: ; preds = %136, %7
%28 = load i32, i32* %16
%29 = load i32, i32* %8
%30 = sub nsw i32 %29, 3
%31 = icmp slt i32 %28, %30
br i1 %31, label %32, label %139
32: ; preds = %27
%33 = load double*, double** %9
%34 = getelementptr inbounds double, double* %33, i64 0
%35 = load double, double* %34
store double %35, double* %17
%36 = load double*, double** %9
%37 = getelementptr inbounds double, double* %36, i64 1
%38 = load double, double* %37
store double %38, double* %18
%39 = load double*, double** %10
%40 = getelementptr inbounds double, double* %39, i64 0
%41 = load double, double* %40
store double %41, double* %19
%42 = load double*, double** %10
%43 = getelementptr inbounds double, double* %42, i64 4
%44 = load double, double* %43
store double %44, double* %20
%45 = load double, double* %17
%46 = load double, double* %19
%47 = load double, double* %21
%48 = call double @llvm.fmuladd.f64(double %45, double %46, double %47)
store double %48, double* %21
%49 = load double, double* %18
%50 = load double, double* %19
%51 = load double, double* %22
%52 = call double @llvm.fmuladd.f64(double %49, double %50, double %51)
store double %52, double* %22
%53 = load double, double* %18
%54 = load double, double* %20
%55 = load double, double* %23
%56 = call double @llvm.fmuladd.f64(double %53, double %54, double %55)
store double %56, double* %23
%57 = load double*, double** %9
%58 = getelementptr inbounds double, double* %57, i64 4
%59 = load double, double* %58
store double %59, double* %17
%60 = load double*, double** %9
%61 = getelementptr inbounds double, double* %60, i64 5
%62 = load double, double* %61
store double %62, double* %18
%63 = load double*, double** %10
%64 = getelementptr inbounds double, double* %63, i64 1
%65 = load double, double* %64
store double %65, double* %19
%66 = load double*, double** %10
%67 = getelementptr inbounds double, double* %66, i64 5
%68 = load double, double* %67
store double %68, double* %20
%69 = load double, double* %17
%70 = load double, double* %19
%71 = load double, double* %21
%72 = call double @llvm.fmuladd.f64(double %69, double %70, double %71)
store double %72, double* %21
%73 = load double, double* %18
%74 = load double, double* %19
%75 = load double, double* %22
%76 = call double @llvm.fmuladd.f64(double %73, double %74, double %75)
store double %76, double* %22
%77 = load double, double* %18
%78 = load double, double* %20
%79 = load double, double* %23
%80 = call double @llvm.fmuladd.f64(double %77, double %78, double %79)
store double %80, double* %23
%81 = load double*, double** %9
%82 = getelementptr inbounds double, double* %81, i64 8
%83 = load double, double* %82
store double %83, double* %17
%84 = load double*, double** %9
%85 = getelementptr inbounds double, double* %84, i64 9
%86 = load double, double* %85
store double %86, double* %18
%87 = load double*, double** %10
%88 = getelementptr inbounds double, double* %87, i64 2
%89 = load double, double* %88
store double %89, double* %19
%90 = load double*, double** %10
%91 = getelementptr inbounds double, double* %90, i64 6
%92 = load double, double* %91
store double %92, double* %20
%93 = load double, double* %17
%94 = load double, double* %19
%95 = load double, double* %21
%96 = call double @llvm.fmuladd.f64(double %93, double %94, double %95)
store double %96, double* %21
%97 = load double, double* %18
%98 = load double, double* %19
%99 = load double, double* %22
%100 = call double @llvm.fmuladd.f64(double %97, double %98, double %99)
store double %100, double* %22
%101 = load double, double* %18
%102 = load double, double* %20
%103 = load double, double* %23
%104 = call double @llvm.fmuladd.f64(double %101, double %102, double %103)
store double %104, double* %23
%105 = load double*, double** %9
%106 = getelementptr inbounds double, double* %105, i64 12
%107 = load double, double* %106
store double %107, double* %17
%108 = load double*, double** %9
%109 = getelementptr inbounds double, double* %108, i64 13
%110 = load double, double* %109
store double %110, double* %18
%111 = load double*, double** %10
%112 = getelementptr inbounds double, double* %111, i64 3
%113 = load double, double* %112
store double %113, double* %19
%114 = load double*, double** %10
%115 = getelementptr inbounds double, double* %114, i64 7
%116 = load double, double* %115
store double %116, double* %20
%117 = load double, double* %17
%118 = load double, double* %19
%119 = load double, double* %21
%120 = call double @llvm.fmuladd.f64(double %117, double %118, double %119)
store double %120, double* %21
%121 = load double, double* %18
%122 = load double, double* %19
%123 = load double, double* %22
%124 = call double @llvm.fmuladd.f64(double %121, double %122, double %123)
store double %124, double* %22
%125 = load double, double* %18
%126 = load double, double* %20
%127 = load double, double* %23
%128 = call double @llvm.fmuladd.f64(double %125, double %126, double %127)
store double %128, double* %23
%129 = load double*, double** %9
%130 = getelementptr inbounds double, double* %129, i64 16
store double* %130, double** %9
%131 = load i32, i32* %11
%132 = mul nsw i32 4, %131
%133 = load double*, double** %10
%134 = sext i32 %132 to i64
%135 = getelementptr inbounds double, double* %133, i64 %134
store double* %135, double** %10
br label %136
136: ; preds = %32
%137 = load i32, i32* %16
%138 = add nsw i32 %137, 4
store i32 %138, i32* %16
br label %27
139: ; preds = %27
br label %140
140: ; preds = %173, %139
%141 = load i32, i32* %16
%142 = load i32, i32* %8
%143 = icmp slt i32 %141, %142
br i1 %143, label %144, label %176
144: ; preds = %140
%145 = load double*, double** %9
%146 = getelementptr inbounds double, double* %145, i64 0
%147 = load double, double* %146
store double %147, double* %17
%148 = load double*, double** %9
%149 = getelementptr inbounds double, double* %148, i64 1
%150 = load double, double* %149
store double %150, double* %18
%151 = load double*, double** %10
%152 = getelementptr inbounds double, double* %151, i64 0
%153 = load double, double* %152
store double %153, double* %19
%154 = load double*, double** %10
%155 = getelementptr inbounds double, double* %154, i64 4
%156 = load double, double* %155
store double %156, double* %20
%157 = load double, double* %17
%158 = load double, double* %19
%159 = load double, double* %21
%160 = call double @llvm.fmuladd.f64(double %157, double %158, double %159)
store double %160, double* %21
%161 = load double, double* %18
%162 = load double, double* %19
%163 = load double, double* %22
%164 = call double @llvm.fmuladd.f64(double %161, double %162, double %163)
store double %164, double* %22
%165 = load double, double* %18
%166 = load double, double* %20
%167 = load double, double* %23
%168 = call double @llvm.fmuladd.f64(double %165, double %166, double %167)
store double %168, double* %23
%169 = load double*, double** %9
%170 = getelementptr inbounds double, double* %169, i64 4
store double* %170, double** %9
%171 = load double*, double** %10
%172 = getelementptr inbounds double, double* %171, i64 1
store double* %172, double** %10
br label %173
173: ; preds = %144
%174 = load i32, i32* %16
%175 = add nsw i32 %174, 1
store i32 %175, i32* %16
br label %140
176: ; preds = %140
%177 = load i32, i32* %14
%178 = icmp eq i32 %177, 0
br i1 %178, label %179, label %189
179: ; preds = %176
%180 = load double, double* %21
%181 = load double*, double** %13
%182 = getelementptr inbounds double, double* %181, i64 0
store double %180, double* %182
%183 = load double, double* %22
%184 = load double*, double** %13
%185 = getelementptr inbounds double, double* %184, i64 1
store double %183, double* %185
%186 = load double, double* %23
%187 = load double*, double** %13
%188 = getelementptr inbounds double, double* %187, i64 5
store double %186, double* %188
br label %231
189: ; preds = %176
%190 = load double*, double** %12
%191 = getelementptr inbounds double, double* %190, i64 0
%192 = load double, double* %191
store double %192, double* %24
%193 = load double*, double** %12
%194 = getelementptr inbounds double, double* %193, i64 1
%195 = load double, double* %194
store double %195, double* %25
%196 = load double*, double** %12
%197 = getelementptr inbounds double, double* %196, i64 5
%198 = load double, double* %197
store double %198, double* %26
%199 = load i32, i32* %14
%200 = icmp eq i32 %199, 1
br i1 %200, label %201, label %211
201: ; preds = %189
%202 = load double, double* %21
%203 = load double, double* %24
%204 = fadd double %203, %202
store double %204, double* %24
%205 = load double, double* %22
%206 = load double, double* %25
%207 = fadd double %206, %205
store double %207, double* %25
%208 = load double, double* %23
%209 = load double, double* %26
%210 = fadd double %209, %208
store double %210, double* %26
br label %221
211: ; preds = %189
%212 = load double, double* %21
%213 = load double, double* %24
%214 = fsub double %213, %212
store double %214, double* %24
%215 = load double, double* %22
%216 = load double, double* %25
%217 = fsub double %216, %215
store double %217, double* %25
%218 = load double, double* %23
%219 = load double, double* %26
%220 = fsub double %219, %218
store double %220, double* %26
br label %221
221: ; preds = %211, %201
%222 = load double, double* %24
%223 = load double*, double** %13
%224 = getelementptr inbounds double, double* %223, i64 0
store double %222, double* %224
%225 = load double, double* %25
%226 = load double*, double** %13
%227 = getelementptr inbounds double, double* %226, i64 1
store double %225, double* %227
%228 = load double, double* %26
%229 = load double*, double** %13
%230 = getelementptr inbounds double, double* %229, i64 5
store double %228, double* %230
br label %231
231: ; preds = %221, %179
ret void
}

LLVM IR (-O2):
define void @kernel_dsyrk_nn_2x2_lib4(i32 %0, double* nocapture %1, double* nocapture %2, i32 %3, double* nocapture %4, double* nocapture writeonly %5, i32 %6) {
%8 = add nsw i32 %0, -3
%9 = icmp sgt i32 %0, 3
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = shl nsw i32 %3, 2
%12 = sext i32 %11 to i64
br label %55
13: ; preds = %55
%14 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %62, <2 x double> %67, <2 x double> %60)
%15 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %73, <2 x double> %79, <2 x double> %14)
%16 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %85, <2 x double> %91, <2 x double> %15)
%17 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %97, <2 x double> %103, <2 x double> %16)
%18 = and i32 %0, -4
br label %19
19: ; preds = %13, %7
%20 = phi double* [ %2, %7 ], [ %108, %13 ]
%21 = phi double* [ %1, %7 ], [ %107, %13 ]
%22 = phi i32 [ 0, %7 ], [ %18, %13 ]
%23 = phi double [ 0.000000e+00, %7 ], [ %106, %13 ]
%24 = phi <2 x double> [ zeroinitializer, %7 ], [ %17, %13 ]
%25 = icmp slt i32 %22, %0
br i1 %25, label %26, label %145
26: ; preds = %19
%27 = xor i32 %22, -1
%28 = and i32 %0, 1
%29 = icmp eq i32 %28, 0
br i1 %29, label %45, label %30
30: ; preds = %26
%31 = bitcast double* %21 to <2 x double>*
%32 = load <2 x double>, <2 x double>* %31
%33 = load double, double* %20
%34 = getelementptr inbounds double, double* %20, i64 4
%35 = load double, double* %34
%36 = insertelement <2 x double> poison, double %33, i64 0
%37 = shufflevector <2 x double> %36, <2 x double> poison, <2 x i32> zeroinitializer
%38 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %32, <2 x double> %37, <2 x double> %24)
%39 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %32, <2 x double> %37, <2 x double> %24)
%40 = extractelement <2 x double> %32, i64 1
%41 = tail call double @llvm.fmuladd.f64(double %40, double %35, double %23)
%42 = getelementptr inbounds double, double* %21, i64 4
%43 = getelementptr inbounds double, double* %20, i64 1
%44 = or i32 %22, 1
br label %45
45: ; preds = %30, %26
%46 = phi <2 x double> [ undef, %26 ], [ %39, %30 ]
%47 = phi double [ undef, %26 ], [ %41, %30 ]
%48 = phi double [ %23, %26 ], [ %41, %30 ]
%49 = phi i32 [ %22, %26 ], [ %44, %30 ]
%50 = phi double* [ %21, %26 ], [ %42, %30 ]
%51 = phi double* [ %20, %26 ], [ %43, %30 ]
%52 = phi <2 x double> [ %24, %26 ], [ %38, %30 ]
%53 = sub i32 0, %0
%54 = icmp eq i32 %27, %53
br i1 %54, label %145, label %111
55: ; preds = %10, %55
%56 = phi double [ 0.000000e+00, %10 ], [ %106, %55 ]
%57 = phi i32 [ 0, %10 ], [ %109, %55 ]
%58 = phi double* [ %1, %10 ], [ %107, %55 ]
%59 = phi double* [ %2, %10 ], [ %108, %55 ]
%60 = phi <2 x double> [ zeroinitializer, %10 ], [ %104, %55 ]
%61 = bitcast double* %58 to <2 x double>*
%62 = load <2 x double>, <2 x double>* %61
%63 = load double, double* %59
%64 = getelementptr inbounds double, double* %59, i64 4
%65 = load double, double* %64
%66 = insertelement <2 x double> poison, double %63, i64 0
%67 = shufflevector <2 x double> %66, <2 x double> poison, <2 x i32> zeroinitializer
%68 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %62, <2 x double> %67, <2 x double> %60)
%69 = extractelement <2 x double> %62, i64 1
%70 = tail call double @llvm.fmuladd.f64(double %69, double %65, double %56)
%71 = getelementptr inbounds double, double* %58, i64 4
%72 = bitcast double* %71 to <2 x double>*
%73 = load <2 x double>, <2 x double>* %72
%74 = getelementptr inbounds double, double* %59, i64 1
%75 = load double, double* %74
%76 = getelementptr inbounds double, double* %59, i64 5
%77 = load double, double* %76
%78 = insertelement <2 x double> poison, double %75, i64 0
%79 = shufflevector <2 x double> %78, <2 x double> poison, <2 x i32> zeroinitializer
%80 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %73, <2 x double> %79, <2 x double> %68)
%81 = extractelement <2 x double> %73, i64 1
%82 = tail call double @llvm.fmuladd.f64(double %81, double %77, double %70)
%83 = getelementptr inbounds double, double* %58, i64 8
%84 = bitcast double* %83 to <2 x double>*
%85 = load <2 x double>, <2 x double>* %84
%86 = getelementptr inbounds double, double* %59, i64 2
%87 = load double, double* %86
%88 = getelementptr inbounds double, double* %59, i64 6
%89 = load double, double* %88
%90 = insertelement <2 x double> poison, double %87, i64 0
%91 = shufflevector <2 x double> %90, <2 x double> poison, <2 x i32> zeroinitializer
%92 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %85, <2 x double> %91, <2 x double> %80)
%93 = extractelement <2 x double> %85, i64 1
%94 = tail call double @llvm.fmuladd.f64(double %93, double %89, double %82)
%95 = getelementptr inbounds double, double* %58, i64 12
%96 = bitcast double* %95 to <2 x double>*
%97 = load <2 x double>, <2 x double>* %96
%98 = getelementptr inbounds double, double* %59, i64 3
%99 = load double, double* %98
%100 = getelementptr inbounds double, double* %59, i64 7
%101 = load double, double* %100
%102 = insertelement <2 x double> poison, double %99, i64 0
%103 = shufflevector <2 x double> %102, <2 x double> poison, <2 x i32> zeroinitializer
%104 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %97, <2 x double> %103, <2 x double> %92)
%105 = extractelement <2 x double> %97, i64 1
%106 = tail call double @llvm.fmuladd.f64(double %105, double %101, double %94)
%107 = getelementptr inbounds double, double* %58, i64 16
%108 = getelementptr inbounds double, double* %59, i64 %12
%109 = add nuw nsw i32 %57, 4
%110 = icmp slt i32 %109, %8
br i1 %110, label %55, label %13
111: ; preds = %45, %111
%112 = phi double [ %138, %111 ], [ %48, %45 ]
%113 = phi i32 [ %141, %111 ], [ %49, %45 ]
%114 = phi double* [ %139, %111 ], [ %50, %45 ]
%115 = phi double* [ %140, %111 ], [ %51, %45 ]
%116 = phi <2 x double> [ %136, %111 ], [ %52, %45 ]
%117 = bitcast double* %114 to <2 x double>*
%118 = load <2 x double>, <2 x double>* %117
%119 = load double, double* %115
%120 = getelementptr inbounds double, double* %115, i64 4
%121 = load double, double* %120
%122 = insertelement <2 x double> poison, double %119, i64 0
%123 = shufflevector <2 x double> %122, <2 x double> poison, <2 x i32> zeroinitializer
%124 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %118, <2 x double> %123, <2 x double> %116)
%125 = extractelement <2 x double> %118, i64 1
%126 = tail call double @llvm.fmuladd.f64(double %125, double %121, double %112)
%127 = getelementptr inbounds double, double* %114, i64 4
%128 = getelementptr inbounds double, double* %115, i64 1
%129 = bitcast double* %127 to <2 x double>*
%130 = load <2 x double>, <2 x double>* %129
%131 = load double, double* %128
%132 = getelementptr inbounds double, double* %115, i64 5
%133 = load double, double* %132
%134 = insertelement <2 x double> poison, double %131, i64 0
%135 = shufflevector <2 x double> %134, <2 x double> poison, <2 x i32> zeroinitializer
%136 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %130, <2 x double> %135, <2 x double> %124)
%137 = extractelement <2 x double> %130, i64 1
%138 = tail call double @llvm.fmuladd.f64(double %137, double %133, double %126)
%139 = getelementptr inbounds double, double* %114, i64 8
%140 = getelementptr inbounds double, double* %115, i64 2
%141 = add nuw nsw i32 %113, 2
%142 = icmp eq i32 %141, %0
br i1 %142, label %143, label %111
143: ; preds = %111
%144 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %130, <2 x double> %135, <2 x double> %124)
br label %145
145: ; preds = %143, %45, %19
%146 = phi double [ %23, %19 ], [ %47, %45 ], [ %138, %143 ]
%147 = phi <2 x double> [ %24, %19 ], [ %46, %45 ], [ %144, %143 ]
%148 = icmp eq i32 %6, 0
br i1 %148, label %161, label %149
149: ; preds = %145
%150 = bitcast double* %4 to <2 x double>*
%151 = load <2 x double>, <2 x double>* %150
%152 = getelementptr inbounds double, double* %4, i64 5
%153 = load double, double* %152
%154 = icmp eq i32 %6, 1
br i1 %154, label %155, label %158
155: ; preds = %149
%156 = fadd <2 x double> %147, %151
%157 = fadd double %146, %153
br label %161
158: ; preds = %149
%159 = fsub <2 x double> %151, %147
%160 = fsub double %153, %146
br label %161
161: ; preds = %155, %158, %145
%162 = phi double [ %146, %145 ], [ %157, %155 ], [ %160, %158 ]
%163 = phi <2 x double> [ %147, %145 ], [ %156, %155 ], [ %159, %158 ]
%164 = bitcast double* %5 to <2 x double>*
store <2 x double> %163, <2 x double>* %164
%165 = getelementptr inbounds double, double* %5, i64 5
store double %162, double* %165
ret void
}