void kernel_dgemv_n_8_vs_lib4(int km, int kmax, double *A0, int sda, double *x,
                              double *y, double *z, int alg) {
  if (kmax <= 0)
    return;
  double *A1 = A0 + 4 * sda;
  const int lda = 4;
  int k;
  double x_0, x_1, x_2, x_3, y_0 = 0, y_1 = 0, y_2 = 0, y_3 = 0, y_4 = 0,
                             y_5 = 0, y_6 = 0, y_7 = 0;
  k = 0;
  for (; k < kmax - 3; k += 4) {
    x_0 = x[0];
    x_1 = x[1];
    x_2 = x[2];
    x_3 = x[3];
    y_0 += A0[0 + lda * 0] * x_0;
    y_1 += A0[1 + lda * 0] * x_0;
    y_2 += A0[2 + lda * 0] * x_0;
    y_3 += A0[3 + lda * 0] * x_0;
    y_4 += A1[0 + lda * 0] * x_0;
    y_5 += A1[1 + lda * 0] * x_0;
    y_6 += A1[2 + lda * 0] * x_0;
    y_7 += A1[3 + lda * 0] * x_0;
    y_0 += A0[0 + lda * 1] * x_1;
    y_1 += A0[1 + lda * 1] * x_1;
    y_2 += A0[2 + lda * 1] * x_1;
    y_3 += A0[3 + lda * 1] * x_1;
    y_4 += A1[0 + lda * 1] * x_1;
    y_5 += A1[1 + lda * 1] * x_1;
    y_6 += A1[2 + lda * 1] * x_1;
    y_7 += A1[3 + lda * 1] * x_1;
    y_0 += A0[0 + lda * 2] * x_2;
    y_1 += A0[1 + lda * 2] * x_2;
    y_2 += A0[2 + lda * 2] * x_2;
    y_3 += A0[3 + lda * 2] * x_2;
    y_4 += A1[0 + lda * 2] * x_2;
    y_5 += A1[1 + lda * 2] * x_2;
    y_6 += A1[2 + lda * 2] * x_2;
    y_7 += A1[3 + lda * 2] * x_2;
    y_0 += A0[0 + lda * 3] * x_3;
    y_1 += A0[1 + lda * 3] * x_3;
    y_2 += A0[2 + lda * 3] * x_3;
    y_3 += A0[3 + lda * 3] * x_3;
    y_4 += A1[0 + lda * 3] * x_3;
    y_5 += A1[1 + lda * 3] * x_3;
    y_6 += A1[2 + lda * 3] * x_3;
    y_7 += A1[3 + lda * 3] * x_3;
    A0 += 4 * lda;
    A1 += 4 * lda;
    x += 4;
  }
  for (; k < kmax; k++) {
    x_0 = x[0];
    y_0 += A0[0 + lda * 0] * x_0;
    y_1 += A0[1 + lda * 0] * x_0;
    y_2 += A0[2 + lda * 0] * x_0;
    y_3 += A0[3 + lda * 0] * x_0;
    y_4 += A1[0 + lda * 0] * x_0;
    y_5 += A1[1 + lda * 0] * x_0;
    y_6 += A1[2 + lda * 0] * x_0;
    y_7 += A1[3 + lda * 0] * x_0;
    A0 += 1 * lda;
    A1 += 1 * lda;
    x += 1;
  }
  if (alg == 0) {
    goto store;
  } else if (alg == 1) {
    y_0 += y[0];
    y_1 += y[1];
    y_2 += y[2];
    y_3 += y[3];
    y_4 += y[4];
    y_5 += y[5];
    y_6 += y[6];
    y_7 += y[7];
    goto store;
  } else {
    y_0 = y[0] - y_0;
    y_1 = y[1] - y_1;
    y_2 = y[2] - y_2;
    y_3 = y[3] - y_3;
    y_4 = y[4] - y_4;
    y_5 = y[5] - y_5;
    y_6 = y[6] - y_6;
    y_7 = y[7] - y_7;
    goto store;
  }
store:
  z[0] = y_0;
  z[1] = y_1;
  z[2] = y_2;
  z[3] = y_3;
  if (km >= 8) {
    z[4] = y_4;
    z[5] = y_5;
    z[6] = y_6;
    z[7] = y_7;
  } else {
    z[4] = y_4;
    if (km >= 6) {
      z[5] = y_5;
      if (km > 6) {
        z[6] = y_6;
      }
    }
  }
}


x86 assembly (clang, -O0):
<kernel_dgemv_n_8_vs_lib4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x18,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     1133 <kernel_dgemv_n_8_vs_lib4+0x33>
jmp    1a0b <kernel_dgemv_n_8_vs_lib4+0x90b>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-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)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x3,%ecx
cmp    %ecx,%eax
jge    1666 <kernel_dgemv_n_8_vs_lib4+0x566>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x30(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x88(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x30(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x90(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x30(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x98(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x30(%rax),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x38(%rax),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x30(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x30(%rbp),%rax
movsd  0x28(%rax),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x88(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x30(%rbp),%rax
movsd  0x30(%rax),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x90(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x30(%rbp),%rax
movsd  0x38(%rax),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x98(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x10(%rbp),%rax
movsd  0x40(%rax),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x48(%rax),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x50(%rax),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x58(%rax),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x30(%rbp),%rax
movsd  0x40(%rax),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x30(%rbp),%rax
movsd  0x48(%rax),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x88(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x30(%rbp),%rax
movsd  0x50(%rax),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x90(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x30(%rbp),%rax
movsd  0x58(%rax),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x98(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x10(%rbp),%rax
movsd  0x60(%rax),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x68(%rax),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x70(%rax),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x78(%rax),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x30(%rbp),%rax
movsd  0x60(%rax),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x30(%rbp),%rax
movsd  0x68(%rax),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x88(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x30(%rbp),%rax
movsd  0x70(%rax),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x90(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x30(%rbp),%rax
movsd  0x78(%rax),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x98(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x10(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x10(%rbp)
mov    -0x30(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x20(%rbp)
mov    -0x38(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x38(%rbp)
jmp    11a2 <kernel_dgemv_n_8_vs_lib4+0xa2>
jmp    166b <kernel_dgemv_n_8_vs_lib4+0x56b>
mov    -0x38(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    17c6 <kernel_dgemv_n_8_vs_lib4+0x6c6>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x30(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x88(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x30(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x90(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x30(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x98(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x10(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x10(%rbp)
mov    -0x30(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    166b <kernel_dgemv_n_8_vs_lib4+0x56b>
cmpl   $0x0,0x18(%rbp)
jne    17d5 <kernel_dgemv_n_8_vs_lib4+0x6d5>
jmp    1936 <kernel_dgemv_n_8_vs_lib4+0x836>
cmpl   $0x1,0x18(%rbp)
jne    188d <kernel_dgemv_n_8_vs_lib4+0x78d>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x10(%rax),%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x18(%rax),%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x20(%rax),%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x28(%rax),%xmm0
addsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x28(%rbp),%rax
movsd  0x30(%rax),%xmm0
addsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x28(%rbp),%rax
movsd  0x38(%rax),%xmm0
addsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
jmp    1936 <kernel_dgemv_n_8_vs_lib4+0x836>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x10(%rax),%xmm0
subsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x18(%rax),%xmm0
subsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x20(%rax),%xmm0
subsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x28(%rax),%xmm0
subsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x28(%rbp),%rax
movsd  0x30(%rax),%xmm0
subsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x28(%rbp),%rax
movsd  0x38(%rax),%xmm0
subsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x68(%rbp),%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x70(%rbp),%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x78(%rbp),%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
cmpl   $0x8,-0x4(%rbp)
jl     19bd <kernel_dgemv_n_8_vs_lib4+0x8bd>
movsd  -0x80(%rbp),%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,0x20(%rax)
movsd  -0x88(%rbp),%xmm0
ff
mov    0x10(%rbp),%rax
movsd  %xmm0,0x28(%rax)
movsd  -0x90(%rbp),%xmm0
ff
mov    0x10(%rbp),%rax
movsd  %xmm0,0x30(%rax)
movsd  -0x98(%rbp),%xmm0
ff
mov    0x10(%rbp),%rax
movsd  %xmm0,0x38(%rax)
jmp    1a0b <kernel_dgemv_n_8_vs_lib4+0x90b>
movsd  -0x80(%rbp),%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,0x20(%rax)
cmpl   $0x6,-0x4(%rbp)
jl     1a06 <kernel_dgemv_n_8_vs_lib4+0x906>
movsd  -0x88(%rbp),%xmm0
ff
mov    0x10(%rbp),%rax
movsd  %xmm0,0x28(%rax)
cmpl   $0x6,-0x4(%rbp)
jle    1a01 <kernel_dgemv_n_8_vs_lib4+0x901>
movsd  -0x90(%rbp),%xmm0
ff
mov    0x10(%rbp),%rax
movsd  %xmm0,0x30(%rax)
jmp    1a06 <kernel_dgemv_n_8_vs_lib4+0x906>
jmp    1a0b <kernel_dgemv_n_8_vs_lib4+0x90b>
add    $0x18,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_dgemv_n_8_vs_lib4>:
test   %esi,%esi
jle    1438 <kernel_dgemv_n_8_vs_lib4+0x338>
shl    $0x2,%ecx
movslq %ecx,%rax
cmp    $0x4,%esi
jb     129c <kernel_dgemv_n_8_vs_lib4+0x19c>
lea    -0x3(%rsi),%r10d
xorpd  %xmm12,%xmm12
xor    %ecx,%ecx
xorpd  %xmm1,%xmm1
xorpd  %xmm3,%xmm3
xorpd  %xmm2,%xmm2
xchg   %ax,%ax
movupd (%rdx),%xmm4
movupd 0x10(%rdx),%xmm6
movupd 0x20(%rdx),%xmm10
movupd 0x30(%rdx),%xmm9
movsd  (%r8),%xmm7
movsd  0x8(%r8),%xmm5
movsd  0x10(%r8),%xmm0
movsd  0x18(%r8),%xmm8
unpcklpd %xmm7,%xmm7
mulpd  %xmm7,%xmm4
addpd  %xmm1,%xmm4
mulpd  %xmm7,%xmm6
addpd  %xmm3,%xmm6
movupd 0x8(%rdx,%rax,8),%xmm1
mulpd  %xmm7,%xmm1
addpd  %xmm12,%xmm1
movsd  (%rdx,%rax,8),%xmm3
movhpd 0x18(%rdx,%rax,8),%xmm3
mulpd  %xmm7,%xmm3
addpd  %xmm2,%xmm3
unpcklpd %xmm5,%xmm5
mulpd  %xmm5,%xmm10
addpd  %xmm4,%xmm10
mulpd  %xmm5,%xmm9
addpd  %xmm6,%xmm9
movupd 0x28(%rdx,%rax,8),%xmm2
mulpd  %xmm5,%xmm2
addpd  %xmm1,%xmm2
movsd  0x20(%rdx,%rax,8),%xmm1
movhpd 0x38(%rdx,%rax,8),%xmm1
mulpd  %xmm5,%xmm1
addpd  %xmm3,%xmm1
movupd 0x40(%rdx),%xmm5
unpcklpd %xmm0,%xmm0
mulpd  %xmm0,%xmm5
addpd  %xmm10,%xmm5
movupd 0x50(%rdx),%xmm7
mulpd  %xmm0,%xmm7
addpd  %xmm9,%xmm7
movupd 0x48(%rdx,%rax,8),%xmm4
mulpd  %xmm0,%xmm4
addpd  %xmm2,%xmm4
movsd  0x40(%rdx,%rax,8),%xmm6
movhpd 0x58(%rdx,%rax,8),%xmm6
mulpd  %xmm0,%xmm6
addpd  %xmm1,%xmm6
movupd 0x60(%rdx),%xmm10
unpcklpd %xmm8,%xmm8
mulpd  %xmm8,%xmm10
movapd %xmm10,%xmm1
addpd  %xmm5,%xmm1
movupd 0x70(%rdx),%xmm11
mulpd  %xmm8,%xmm11
movapd %xmm11,%xmm3
addpd  %xmm7,%xmm3
movupd 0x68(%rdx,%rax,8),%xmm9
mulpd  %xmm8,%xmm9
movapd %xmm9,%xmm12
addpd  %xmm4,%xmm12
movsd  0x60(%rdx,%rax,8),%xmm0
movhpd 0x78(%rdx,%rax,8),%xmm0
mulpd  %xmm8,%xmm0
movapd %xmm0,%xmm2
addpd  %xmm6,%xmm2
sub    $0xffffffffffffff80,%rdx
add    $0x20,%r8
add    $0x4,%ecx
cmp    %r10d,%ecx
jl     1130 <kernel_dgemv_n_8_vs_lib4+0x30>
addpd  %xmm6,%xmm0
addpd  %xmm4,%xmm9
addpd  %xmm7,%xmm11
addpd  %xmm5,%xmm10
mov    %esi,%ecx
and    $0xfffffffc,%ecx
lea    (%rdx,%rax,8),%rax
jmp    12b5 <kernel_dgemv_n_8_vs_lib4+0x1b5>
lea    (%rdx,%rax,8),%rax
xorpd  %xmm9,%xmm9
xor    %ecx,%ecx
xorpd  %xmm10,%xmm10
xorpd  %xmm11,%xmm11
xorpd  %xmm0,%xmm0
mov    0x10(%rsp),%r10d
cmp    %esi,%ecx
jge    136c <kernel_dgemv_n_8_vs_lib4+0x26c>
sub    %ecx,%esi
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
movapd %xmm0,%xmm5
movapd %xmm11,%xmm1
movapd %xmm10,%xmm8
movapd %xmm9,%xmm6
movupd (%rdx,%rcx,4),%xmm4
movupd 0x10(%rdx,%rcx,4),%xmm3
movsd  (%r8,%rcx,1),%xmm0
unpcklpd %xmm0,%xmm0
mulpd  %xmm0,%xmm4
movapd %xmm4,%xmm10
addpd  %xmm8,%xmm10
mulpd  %xmm0,%xmm3
movapd %xmm3,%xmm11
addpd  %xmm1,%xmm11
movupd 0x8(%rax,%rcx,4),%xmm7
mulpd  %xmm0,%xmm7
movapd %xmm7,%xmm9
addpd  %xmm6,%xmm9
movsd  (%rax,%rcx,4),%xmm2
movhpd 0x18(%rax,%rcx,4),%xmm2
mulpd  %xmm0,%xmm2
movapd %xmm2,%xmm0
addpd  %xmm5,%xmm0
add    $0x8,%rcx
add    $0xffffffff,%esi
jne    12d0 <kernel_dgemv_n_8_vs_lib4+0x1d0>
addpd  %xmm5,%xmm2
addpd  %xmm6,%xmm7
addpd  %xmm1,%xmm3
addpd  %xmm8,%xmm4
movapd %xmm7,%xmm9
movapd %xmm4,%xmm10
movapd %xmm3,%xmm11
movapd %xmm2,%xmm0
mov    0x8(%rsp),%rax
test   %r10d,%r10d
je     13f1 <kernel_dgemv_n_8_vs_lib4+0x2f1>
cmp    $0x1,%r10d
jne    13ae <kernel_dgemv_n_8_vs_lib4+0x2ae>
movupd (%r9),%xmm1
movupd 0x10(%r9),%xmm2
addpd  %xmm1,%xmm10
addpd  %xmm2,%xmm11
movupd 0x28(%r9),%xmm1
addpd  %xmm1,%xmm9
movsd  0x20(%r9),%xmm1
movhpd 0x38(%r9),%xmm1
addpd  %xmm1,%xmm0
jmp    13f1 <kernel_dgemv_n_8_vs_lib4+0x2f1>
movupd (%r9),%xmm1
movupd 0x10(%r9),%xmm2
subpd  %xmm10,%xmm1
subpd  %xmm11,%xmm2
movupd 0x28(%r9),%xmm3
subpd  %xmm9,%xmm3
movsd  0x20(%r9),%xmm4
movhpd 0x38(%r9),%xmm4
subpd  %xmm0,%xmm4
movapd %xmm3,%xmm9
movapd %xmm1,%xmm10
movapd %xmm2,%xmm11
movapd %xmm4,%xmm0
movupd %xmm10,(%rax)
movupd %xmm11,0x10(%rax)
movlpd %xmm0,0x20(%rax)
cmp    $0x8,%edi
jl     1417 <kernel_dgemv_n_8_vs_lib4+0x317>
movupd %xmm9,0x28(%rax)
unpckhpd %xmm0,%xmm0
mov    $0x7,%ecx
jmp    1433 <kernel_dgemv_n_8_vs_lib4+0x333>
cmp    $0x6,%edi
jl     1438 <kernel_dgemv_n_8_vs_lib4+0x338>
movlpd %xmm9,0x28(%rax)
je     1438 <kernel_dgemv_n_8_vs_lib4+0x338>
unpckhpd %xmm9,%xmm9
mov    $0x6,%ecx
movapd %xmm9,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
ret

LLVM IR (-O0):
define void @kernel_dgemv_n_8_vs_lib4(i32 %0, i32 %1, double* %2, i32 %3, double* %4, double* %5, double* %6, i32 %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca double*
%12 = alloca i32
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca i32
%17 = alloca double*
%18 = alloca i32
%19 = alloca i32
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double
store i32 %0, i32* %9
store i32 %1, i32* %10
store double* %2, double** %11
store i32 %3, i32* %12
store double* %4, double** %13
store double* %5, double** %14
store double* %6, double** %15
store i32 %7, i32* %16
%32 = load i32, i32* %10
%33 = icmp sle i32 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %8
br label %461
35: ; preds = %8
%36 = load double*, double** %11
%37 = load i32, i32* %12
%38 = mul nsw i32 4, %37
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %36, i64 %39
store double* %40, double** %17
store i32 4, i32* %18
store double 0.000000e+00, double* %24
store double 0.000000e+00, double* %25
store double 0.000000e+00, double* %26
store double 0.000000e+00, double* %27
store double 0.000000e+00, double* %28
store double 0.000000e+00, double* %29
store double 0.000000e+00, double* %30
store double 0.000000e+00, double* %31
store i32 0, i32* %19
br label %41
41: ; preds = %257, %35
%42 = load i32, i32* %19
%43 = load i32, i32* %10
%44 = sub nsw i32 %43, 3
%45 = icmp slt i32 %42, %44
br i1 %45, label %46, label %260
46: ; preds = %41
%47 = load double*, double** %13
%48 = getelementptr inbounds double, double* %47, i64 0
%49 = load double, double* %48
store double %49, double* %20
%50 = load double*, double** %13
%51 = getelementptr inbounds double, double* %50, i64 1
%52 = load double, double* %51
store double %52, double* %21
%53 = load double*, double** %13
%54 = getelementptr inbounds double, double* %53, i64 2
%55 = load double, double* %54
store double %55, double* %22
%56 = load double*, double** %13
%57 = getelementptr inbounds double, double* %56, i64 3
%58 = load double, double* %57
store double %58, double* %23
%59 = load double*, double** %11
%60 = getelementptr inbounds double, double* %59, i64 0
%61 = load double, double* %60
%62 = load double, double* %20
%63 = load double, double* %24
%64 = call double @llvm.fmuladd.f64(double %61, double %62, double %63)
store double %64, double* %24
%65 = load double*, double** %11
%66 = getelementptr inbounds double, double* %65, i64 1
%67 = load double, double* %66
%68 = load double, double* %20
%69 = load double, double* %25
%70 = call double @llvm.fmuladd.f64(double %67, double %68, double %69)
store double %70, double* %25
%71 = load double*, double** %11
%72 = getelementptr inbounds double, double* %71, i64 2
%73 = load double, double* %72
%74 = load double, double* %20
%75 = load double, double* %26
%76 = call double @llvm.fmuladd.f64(double %73, double %74, double %75)
store double %76, double* %26
%77 = load double*, double** %11
%78 = getelementptr inbounds double, double* %77, i64 3
%79 = load double, double* %78
%80 = load double, double* %20
%81 = load double, double* %27
%82 = call double @llvm.fmuladd.f64(double %79, double %80, double %81)
store double %82, double* %27
%83 = load double*, double** %17
%84 = getelementptr inbounds double, double* %83, i64 0
%85 = load double, double* %84
%86 = load double, double* %20
%87 = load double, double* %28
%88 = call double @llvm.fmuladd.f64(double %85, double %86, double %87)
store double %88, double* %28
%89 = load double*, double** %17
%90 = getelementptr inbounds double, double* %89, i64 1
%91 = load double, double* %90
%92 = load double, double* %20
%93 = load double, double* %29
%94 = call double @llvm.fmuladd.f64(double %91, double %92, double %93)
store double %94, double* %29
%95 = load double*, double** %17
%96 = getelementptr inbounds double, double* %95, i64 2
%97 = load double, double* %96
%98 = load double, double* %20
%99 = load double, double* %30
%100 = call double @llvm.fmuladd.f64(double %97, double %98, double %99)
store double %100, double* %30
%101 = load double*, double** %17
%102 = getelementptr inbounds double, double* %101, i64 3
%103 = load double, double* %102
%104 = load double, double* %20
%105 = load double, double* %31
%106 = call double @llvm.fmuladd.f64(double %103, double %104, double %105)
store double %106, double* %31
%107 = load double*, double** %11
%108 = getelementptr inbounds double, double* %107, i64 4
%109 = load double, double* %108
%110 = load double, double* %21
%111 = load double, double* %24
%112 = call double @llvm.fmuladd.f64(double %109, double %110, double %111)
store double %112, double* %24
%113 = load double*, double** %11
%114 = getelementptr inbounds double, double* %113, i64 5
%115 = load double, double* %114
%116 = load double, double* %21
%117 = load double, double* %25
%118 = call double @llvm.fmuladd.f64(double %115, double %116, double %117)
store double %118, double* %25
%119 = load double*, double** %11
%120 = getelementptr inbounds double, double* %119, i64 6
%121 = load double, double* %120
%122 = load double, double* %21
%123 = load double, double* %26
%124 = call double @llvm.fmuladd.f64(double %121, double %122, double %123)
store double %124, double* %26
%125 = load double*, double** %11
%126 = getelementptr inbounds double, double* %125, i64 7
%127 = load double, double* %126
%128 = load double, double* %21
%129 = load double, double* %27
%130 = call double @llvm.fmuladd.f64(double %127, double %128, double %129)
store double %130, double* %27
%131 = load double*, double** %17
%132 = getelementptr inbounds double, double* %131, i64 4
%133 = load double, double* %132
%134 = load double, double* %21
%135 = load double, double* %28
%136 = call double @llvm.fmuladd.f64(double %133, double %134, double %135)
store double %136, double* %28
%137 = load double*, double** %17
%138 = getelementptr inbounds double, double* %137, i64 5
%139 = load double, double* %138
%140 = load double, double* %21
%141 = load double, double* %29
%142 = call double @llvm.fmuladd.f64(double %139, double %140, double %141)
store double %142, double* %29
%143 = load double*, double** %17
%144 = getelementptr inbounds double, double* %143, i64 6
%145 = load double, double* %144
%146 = load double, double* %21
%147 = load double, double* %30
%148 = call double @llvm.fmuladd.f64(double %145, double %146, double %147)
store double %148, double* %30
%149 = load double*, double** %17
%150 = getelementptr inbounds double, double* %149, i64 7
%151 = load double, double* %150
%152 = load double, double* %21
%153 = load double, double* %31
%154 = call double @llvm.fmuladd.f64(double %151, double %152, double %153)
store double %154, double* %31
%155 = load double*, double** %11
%156 = getelementptr inbounds double, double* %155, i64 8
%157 = load double, double* %156
%158 = load double, double* %22
%159 = load double, double* %24
%160 = call double @llvm.fmuladd.f64(double %157, double %158, double %159)
store double %160, double* %24
%161 = load double*, double** %11
%162 = getelementptr inbounds double, double* %161, i64 9
%163 = load double, double* %162
%164 = load double, double* %22
%165 = load double, double* %25
%166 = call double @llvm.fmuladd.f64(double %163, double %164, double %165)
store double %166, double* %25
%167 = load double*, double** %11
%168 = getelementptr inbounds double, double* %167, i64 10
%169 = load double, double* %168
%170 = load double, double* %22
%171 = load double, double* %26
%172 = call double @llvm.fmuladd.f64(double %169, double %170, double %171)
store double %172, double* %26
%173 = load double*, double** %11
%174 = getelementptr inbounds double, double* %173, i64 11
%175 = load double, double* %174
%176 = load double, double* %22
%177 = load double, double* %27
%178 = call double @llvm.fmuladd.f64(double %175, double %176, double %177)
store double %178, double* %27
%179 = load double*, double** %17
%180 = getelementptr inbounds double, double* %179, i64 8
%181 = load double, double* %180
%182 = load double, double* %22
%183 = load double, double* %28
%184 = call double @llvm.fmuladd.f64(double %181, double %182, double %183)
store double %184, double* %28
%185 = load double*, double** %17
%186 = getelementptr inbounds double, double* %185, i64 9
%187 = load double, double* %186
%188 = load double, double* %22
%189 = load double, double* %29
%190 = call double @llvm.fmuladd.f64(double %187, double %188, double %189)
store double %190, double* %29
%191 = load double*, double** %17
%192 = getelementptr inbounds double, double* %191, i64 10
%193 = load double, double* %192
%194 = load double, double* %22
%195 = load double, double* %30
%196 = call double @llvm.fmuladd.f64(double %193, double %194, double %195)
store double %196, double* %30
%197 = load double*, double** %17
%198 = getelementptr inbounds double, double* %197, i64 11
%199 = load double, double* %198
%200 = load double, double* %22
%201 = load double, double* %31
%202 = call double @llvm.fmuladd.f64(double %199, double %200, double %201)
store double %202, double* %31
%203 = load double*, double** %11
%204 = getelementptr inbounds double, double* %203, i64 12
%205 = load double, double* %204
%206 = load double, double* %23
%207 = load double, double* %24
%208 = call double @llvm.fmuladd.f64(double %205, double %206, double %207)
store double %208, double* %24
%209 = load double*, double** %11
%210 = getelementptr inbounds double, double* %209, i64 13
%211 = load double, double* %210
%212 = load double, double* %23
%213 = load double, double* %25
%214 = call double @llvm.fmuladd.f64(double %211, double %212, double %213)
store double %214, double* %25
%215 = load double*, double** %11
%216 = getelementptr inbounds double, double* %215, i64 14
%217 = load double, double* %216
%218 = load double, double* %23
%219 = load double, double* %26
%220 = call double @llvm.fmuladd.f64(double %217, double %218, double %219)
store double %220, double* %26
%221 = load double*, double** %11
%222 = getelementptr inbounds double, double* %221, i64 15
%223 = load double, double* %222
%224 = load double, double* %23
%225 = load double, double* %27
%226 = call double @llvm.fmuladd.f64(double %223, double %224, double %225)
store double %226, double* %27
%227 = load double*, double** %17
%228 = getelementptr inbounds double, double* %227, i64 12
%229 = load double, double* %228
%230 = load double, double* %23
%231 = load double, double* %28
%232 = call double @llvm.fmuladd.f64(double %229, double %230, double %231)
store double %232, double* %28
%233 = load double*, double** %17
%234 = getelementptr inbounds double, double* %233, i64 13
%235 = load double, double* %234
%236 = load double, double* %23
%237 = load double, double* %29
%238 = call double @llvm.fmuladd.f64(double %235, double %236, double %237)
store double %238, double* %29
%239 = load double*, double** %17
%240 = getelementptr inbounds double, double* %239, i64 14
%241 = load double, double* %240
%242 = load double, double* %23
%243 = load double, double* %30
%244 = call double @llvm.fmuladd.f64(double %241, double %242, double %243)
store double %244, double* %30
%245 = load double*, double** %17
%246 = getelementptr inbounds double, double* %245, i64 15
%247 = load double, double* %246
%248 = load double, double* %23
%249 = load double, double* %31
%250 = call double @llvm.fmuladd.f64(double %247, double %248, double %249)
store double %250, double* %31
%251 = load double*, double** %11
%252 = getelementptr inbounds double, double* %251, i64 16
store double* %252, double** %11
%253 = load double*, double** %17
%254 = getelementptr inbounds double, double* %253, i64 16
store double* %254, double** %17
%255 = load double*, double** %13
%256 = getelementptr inbounds double, double* %255, i64 4
store double* %256, double** %13
br label %257
257: ; preds = %46
%258 = load i32, i32* %19
%259 = add nsw i32 %258, 4
store i32 %259, i32* %19
br label %41
260: ; preds = %41
br label %261
261: ; preds = %323, %260
%262 = load i32, i32* %19
%263 = load i32, i32* %10
%264 = icmp slt i32 %262, %263
br i1 %264, label %265, label %326
265: ; preds = %261
%266 = load double*, double** %13
%267 = getelementptr inbounds double, double* %266, i64 0
%268 = load double, double* %267
store double %268, double* %20
%269 = load double*, double** %11
%270 = getelementptr inbounds double, double* %269, i64 0
%271 = load double, double* %270
%272 = load double, double* %20
%273 = load double, double* %24
%274 = call double @llvm.fmuladd.f64(double %271, double %272, double %273)
store double %274, double* %24
%275 = load double*, double** %11
%276 = getelementptr inbounds double, double* %275, i64 1
%277 = load double, double* %276
%278 = load double, double* %20
%279 = load double, double* %25
%280 = call double @llvm.fmuladd.f64(double %277, double %278, double %279)
store double %280, double* %25
%281 = load double*, double** %11
%282 = getelementptr inbounds double, double* %281, i64 2
%283 = load double, double* %282
%284 = load double, double* %20
%285 = load double, double* %26
%286 = call double @llvm.fmuladd.f64(double %283, double %284, double %285)
store double %286, double* %26
%287 = load double*, double** %11
%288 = getelementptr inbounds double, double* %287, i64 3
%289 = load double, double* %288
%290 = load double, double* %20
%291 = load double, double* %27
%292 = call double @llvm.fmuladd.f64(double %289, double %290, double %291)
store double %292, double* %27
%293 = load double*, double** %17
%294 = getelementptr inbounds double, double* %293, i64 0
%295 = load double, double* %294
%296 = load double, double* %20
%297 = load double, double* %28
%298 = call double @llvm.fmuladd.f64(double %295, double %296, double %297)
store double %298, double* %28
%299 = load double*, double** %17
%300 = getelementptr inbounds double, double* %299, i64 1
%301 = load double, double* %300
%302 = load double, double* %20
%303 = load double, double* %29
%304 = call double @llvm.fmuladd.f64(double %301, double %302, double %303)
store double %304, double* %29
%305 = load double*, double** %17
%306 = getelementptr inbounds double, double* %305, i64 2
%307 = load double, double* %306
%308 = load double, double* %20
%309 = load double, double* %30
%310 = call double @llvm.fmuladd.f64(double %307, double %308, double %309)
store double %310, double* %30
%311 = load double*, double** %17
%312 = getelementptr inbounds double, double* %311, i64 3
%313 = load double, double* %312
%314 = load double, double* %20
%315 = load double, double* %31
%316 = call double @llvm.fmuladd.f64(double %313, double %314, double %315)
store double %316, double* %31
%317 = load double*, double** %11
%318 = getelementptr inbounds double, double* %317, i64 4
store double* %318, double** %11
%319 = load double*, double** %17
%320 = getelementptr inbounds double, double* %319, i64 4
store double* %320, double** %17
%321 = load double*, double** %13
%322 = getelementptr inbounds double, double* %321, i64 1
store double* %322, double** %13
br label %323
323: ; preds = %265
%324 = load i32, i32* %19
%325 = add nsw i32 %324, 1
store i32 %325, i32* %19
br label %261
326: ; preds = %261
%327 = load i32, i32* %16
%328 = icmp eq i32 %327, 0
br i1 %328, label %329, label %330
329: ; preds = %326
br label %415
330: ; preds = %326
%331 = load i32, i32* %16
%332 = icmp eq i32 %331, 1
br i1 %332, label %333, label %374
333: ; preds = %330
%334 = load double*, double** %14
%335 = getelementptr inbounds double, double* %334, i64 0
%336 = load double, double* %335
%337 = load double, double* %24
%338 = fadd double %337, %336
store double %338, double* %24
%339 = load double*, double** %14
%340 = getelementptr inbounds double, double* %339, i64 1
%341 = load double, double* %340
%342 = load double, double* %25
%343 = fadd double %342, %341
store double %343, double* %25
%344 = load double*, double** %14
%345 = getelementptr inbounds double, double* %344, i64 2
%346 = load double, double* %345
%347 = load double, double* %26
%348 = fadd double %347, %346
store double %348, double* %26
%349 = load double*, double** %14
%350 = getelementptr inbounds double, double* %349, i64 3
%351 = load double, double* %350
%352 = load double, double* %27
%353 = fadd double %352, %351
store double %353, double* %27
%354 = load double*, double** %14
%355 = getelementptr inbounds double, double* %354, i64 4
%356 = load double, double* %355
%357 = load double, double* %28
%358 = fadd double %357, %356
store double %358, double* %28
%359 = load double*, double** %14
%360 = getelementptr inbounds double, double* %359, i64 5
%361 = load double, double* %360
%362 = load double, double* %29
%363 = fadd double %362, %361
store double %363, double* %29
%364 = load double*, double** %14
%365 = getelementptr inbounds double, double* %364, i64 6
%366 = load double, double* %365
%367 = load double, double* %30
%368 = fadd double %367, %366
store double %368, double* %30
%369 = load double*, double** %14
%370 = getelementptr inbounds double, double* %369, i64 7
%371 = load double, double* %370
%372 = load double, double* %31
%373 = fadd double %372, %371
store double %373, double* %31
br label %415
374: ; preds = %330
%375 = load double*, double** %14
%376 = getelementptr inbounds double, double* %375, i64 0
%377 = load double, double* %376
%378 = load double, double* %24
%379 = fsub double %377, %378
store double %379, double* %24
%380 = load double*, double** %14
%381 = getelementptr inbounds double, double* %380, i64 1
%382 = load double, double* %381
%383 = load double, double* %25
%384 = fsub double %382, %383
store double %384, double* %25
%385 = load double*, double** %14
%386 = getelementptr inbounds double, double* %385, i64 2
%387 = load double, double* %386
%388 = load double, double* %26
%389 = fsub double %387, %388
store double %389, double* %26
%390 = load double*, double** %14
%391 = getelementptr inbounds double, double* %390, i64 3
%392 = load double, double* %391
%393 = load double, double* %27
%394 = fsub double %392, %393
store double %394, double* %27
%395 = load double*, double** %14
%396 = getelementptr inbounds double, double* %395, i64 4
%397 = load double, double* %396
%398 = load double, double* %28
%399 = fsub double %397, %398
store double %399, double* %28
%400 = load double*, double** %14
%401 = getelementptr inbounds double, double* %400, i64 5
%402 = load double, double* %401
%403 = load double, double* %29
%404 = fsub double %402, %403
store double %404, double* %29
%405 = load double*, double** %14
%406 = getelementptr inbounds double, double* %405, i64 6
%407 = load double, double* %406
%408 = load double, double* %30
%409 = fsub double %407, %408
store double %409, double* %30
%410 = load double*, double** %14
%411 = getelementptr inbounds double, double* %410, i64 7
%412 = load double, double* %411
%413 = load double, double* %31
%414 = fsub double %412, %413
store double %414, double* %31
br label %415
415: ; preds = %374, %333, %329
%416 = load double, double* %24
%417 = load double*, double** %15
%418 = getelementptr inbounds double, double* %417, i64 0
store double %416, double* %418
%419 = load double, double* %25
%420 = load double*, double** %15
%421 = getelementptr inbounds double, double* %420, i64 1
store double %419, double* %421
%422 = load double, double* %26
%423 = load double*, double** %15
%424 = getelementptr inbounds double, double* %423, i64 2
store double %422, double* %424
%425 = load double, double* %27
%426 = load double*, double** %15
%427 = getelementptr inbounds double, double* %426, i64 3
store double %425, double* %427
%428 = load i32, i32* %9
%429 = icmp sge i32 %428, 8
br i1 %429, label %430, label %443
430: ; preds = %415
%431 = load double, double* %28
%432 = load double*, double** %15
%433 = getelementptr inbounds double, double* %432, i64 4
store double %431, double* %433
%434 = load double, double* %29
%435 = load double*, double** %15
%436 = getelementptr inbounds double, double* %435, i64 5
store double %434, double* %436
%437 = load double, double* %30
%438 = load double*, double** %15
%439 = getelementptr inbounds double, double* %438, i64 6
store double %437, double* %439
%440 = load double, double* %31
%441 = load double*, double** %15
%442 = getelementptr inbounds double, double* %441, i64 7
store double %440, double* %442
br label %461
443: ; preds = %415
%444 = load double, double* %28
%445 = load double*, double** %15
%446 = getelementptr inbounds double, double* %445, i64 4
store double %444, double* %446
%447 = load i32, i32* %9
%448 = icmp sge i32 %447, 6
br i1 %448, label %449, label %460
449: ; preds = %443
%450 = load double, double* %29
%451 = load double*, double** %15
%452 = getelementptr inbounds double, double* %451, i64 5
store double %450, double* %452
%453 = load i32, i32* %9
%454 = icmp sgt i32 %453, 6
br i1 %454, label %455, label %459
455: ; preds = %449
%456 = load double, double* %30
%457 = load double*, double** %15
%458 = getelementptr inbounds double, double* %457, i64 6
store double %456, double* %458
br label %459
459: ; preds = %455, %449
br label %460
460: ; preds = %459, %443
br label %461
461: ; preds = %34, %460, %430
ret void
}

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