void kernel_sgemv_t_4_lib4(int kmax, int kna, float *A, int sda, float *x,
                           float *y, int alg) {
  if (kmax <= 0)
    return;
  const int lda = 4;
  const int bs = 4;
  int k, ka = kmax - kna;
  float x_0, x_1, x_2, x_3, y_0 = 0, y_1 = 0, y_2 = 0, y_3 = 0;
  if (kna > 0) {
    k = 0;
    for (; k < kna; k++) {
      x_0 = x[0];
      y_0 += A[0 + lda * 0] * x_0;
      y_1 += A[0 + lda * 1] * x_0;
      y_2 += A[0 + lda * 2] * x_0;
      y_3 += A[0 + lda * 3] * x_0;
      A += 1;
      x += 1;
    }
    A += (sda - 1) * lda;
  }
  k = 0;
  for (; k < ka - bs + 1; k += bs) {
    x_0 = x[0];
    x_1 = x[1];
    x_2 = x[2];
    x_3 = x[3];
    y_0 += A[0 + lda * 0] * x_0;
    y_1 += A[0 + lda * 1] * x_0;
    y_2 += A[0 + lda * 2] * x_0;
    y_3 += A[0 + lda * 3] * x_0;
    y_0 += A[1 + lda * 0] * x_1;
    y_1 += A[1 + lda * 1] * x_1;
    y_2 += A[1 + lda * 2] * x_1;
    y_3 += A[1 + lda * 3] * x_1;
    y_0 += A[2 + lda * 0] * x_2;
    y_1 += A[2 + lda * 1] * x_2;
    y_2 += A[2 + lda * 2] * x_2;
    y_3 += A[2 + lda * 3] * x_2;
    y_0 += A[3 + lda * 0] * x_3;
    y_1 += A[3 + lda * 1] * x_3;
    y_2 += A[3 + lda * 2] * x_3;
    y_3 += A[3 + lda * 3] * x_3;
    A += sda * bs;
    x += 4;
  }
  for (; k < ka; k++) {
    x_0 = x[0];
    y_0 += A[0 + lda * 0] * x_0;
    y_1 += A[0 + lda * 1] * x_0;
    y_2 += A[0 + lda * 2] * x_0;
    y_3 += A[0 + lda * 3] * x_0;
    A += 1;
    x += 1;
  }
  if (alg == 0) {
    y[0] = y_0;
    y[1] = y_1;
    y[2] = y_2;
    y[3] = y_3;
  } else if (alg == 1) {
    y[0] += y_0;
    y[1] += y_1;
    y[2] += y_2;
    y[3] += y_3;
  } else {
    y[0] -= y_0;
    y[1] -= y_1;
    y[2] -= y_2;
    y[3] -= y_3;
  }
}


x86 assembly (clang, -O0):
<kernel_sgemv_t_4_lib4>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%eax
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,-0x4(%rbp)
jg     112b <kernel_sgemv_t_4_lib4+0x2b>
jmp    1690 <kernel_sgemv_t_4_lib4+0x590>
movl   $0x4,-0x2c(%rbp)
movl   $0x4,-0x30(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x38(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x54(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x58(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    124c <kernel_sgemv_t_4_lib4+0x14c>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1231 <kernel_sgemv_t_4_lib4+0x131>
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  -0x3c(%rbp),%xmm2
movss  -0x4c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x10(%rax),%xmm0
movss  -0x3c(%rbp),%xmm2
movss  -0x50(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movss  0x20(%rax),%xmm0
movss  -0x3c(%rbp),%xmm2
movss  -0x54(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x54(%rbp)
mov    -0x10(%rbp),%rax
movss  0x30(%rax),%xmm0
movss  -0x3c(%rbp),%xmm2
movss  -0x58(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1173 <kernel_sgemv_t_4_lib4+0x73>
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
shl    $0x2,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x38(%rbp),%ecx
sub    $0x4,%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    14cf <kernel_sgemv_t_4_lib4+0x3cf>
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x3c(%rbp)
mov    -0x20(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movss  0x8(%rax),%xmm0
movss  %xmm0,-0x44(%rbp)
mov    -0x20(%rbp),%rax
movss  0xc(%rax),%xmm0
movss  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  -0x3c(%rbp),%xmm2
movss  -0x4c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x10(%rax),%xmm0
movss  -0x3c(%rbp),%xmm2
movss  -0x50(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movss  0x20(%rax),%xmm0
movss  -0x3c(%rbp),%xmm2
movss  -0x54(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x54(%rbp)
mov    -0x10(%rbp),%rax
movss  0x30(%rax),%xmm0
movss  -0x3c(%rbp),%xmm2
movss  -0x58(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  -0x40(%rbp),%xmm2
movss  -0x4c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x14(%rax),%xmm0
movss  -0x40(%rbp),%xmm2
movss  -0x50(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movss  0x24(%rax),%xmm0
movss  -0x40(%rbp),%xmm2
movss  -0x54(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x54(%rbp)
mov    -0x10(%rbp),%rax
movss  0x34(%rax),%xmm0
movss  -0x40(%rbp),%xmm2
movss  -0x58(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
movss  -0x44(%rbp),%xmm2
movss  -0x4c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x18(%rax),%xmm0
movss  -0x44(%rbp),%xmm2
movss  -0x50(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movss  0x28(%rax),%xmm0
movss  -0x44(%rbp),%xmm2
movss  -0x54(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x54(%rbp)
mov    -0x10(%rbp),%rax
movss  0x38(%rax),%xmm0
movss  -0x44(%rbp),%xmm2
movss  -0x58(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
movss  0xc(%rax),%xmm0
movss  -0x48(%rbp),%xmm2
movss  -0x4c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x1c(%rax),%xmm0
movss  -0x48(%rbp),%xmm2
movss  -0x50(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movss  0x2c(%rax),%xmm0
movss  -0x48(%rbp),%xmm2
movss  -0x54(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x54(%rbp)
mov    -0x10(%rbp),%rax
movss  0x3c(%rax),%xmm0
movss  -0x48(%rbp),%xmm2
movss  -0x58(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x58(%rbp)
mov    -0x14(%rbp),%ecx
shl    $0x2,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x20(%rbp)
mov    -0x34(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x34(%rbp)
jmp    1253 <kernel_sgemv_t_4_lib4+0x153>
jmp    14d4 <kernel_sgemv_t_4_lib4+0x3d4>
mov    -0x34(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    1592 <kernel_sgemv_t_4_lib4+0x492>
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  -0x3c(%rbp),%xmm2
movss  -0x4c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x10(%rax),%xmm0
movss  -0x3c(%rbp),%xmm2
movss  -0x50(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movss  0x20(%rax),%xmm0
movss  -0x3c(%rbp),%xmm2
movss  -0x54(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x54(%rbp)
mov    -0x10(%rbp),%rax
movss  0x30(%rax),%xmm0
movss  -0x3c(%rbp),%xmm2
movss  -0x58(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    14d4 <kernel_sgemv_t_4_lib4+0x3d4>
cmpl   $0x0,0x10(%rbp)
jne    15d8 <kernel_sgemv_t_4_lib4+0x4d8>
movss  -0x4c(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x50(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x54(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movss  %xmm0,0x8(%rax)
movss  -0x58(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movss  %xmm0,0xc(%rax)
jmp    1690 <kernel_sgemv_t_4_lib4+0x590>
cmpl   $0x1,0x10(%rbp)
jne    1631 <kernel_sgemv_t_4_lib4+0x531>
movss  -0x4c(%rbp),%xmm0
mov    -0x28(%rbp),%rax
addss  (%rax),%xmm0
movss  %xmm0,(%rax)
movss  -0x50(%rbp),%xmm0
mov    -0x28(%rbp),%rax
addss  0x4(%rax),%xmm0
movss  %xmm0,0x4(%rax)
movss  -0x54(%rbp),%xmm0
mov    -0x28(%rbp),%rax
addss  0x8(%rax),%xmm0
movss  %xmm0,0x8(%rax)
movss  -0x58(%rbp),%xmm0
mov    -0x28(%rbp),%rax
addss  0xc(%rax),%xmm0
movss  %xmm0,0xc(%rax)
jmp    168b <kernel_sgemv_t_4_lib4+0x58b>
movss  -0x4c(%rbp),%xmm1
mov    -0x28(%rbp),%rax
movss  (%rax),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,(%rax)
movss  -0x50(%rbp),%xmm1
mov    -0x28(%rbp),%rax
movss  0x4(%rax),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,0x4(%rax)
movss  -0x54(%rbp),%xmm1
mov    -0x28(%rbp),%rax
movss  0x8(%rax),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,0x8(%rax)
movss  -0x58(%rbp),%xmm1
mov    -0x28(%rbp),%rax
movss  0xc(%rax),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,0xc(%rax)
jmp    1690 <kernel_sgemv_t_4_lib4+0x590>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_sgemv_t_4_lib4>:
test   %edi,%edi
jle    12ee <kernel_sgemv_t_4_lib4+0x1ee>
sub    %esi,%edi
test   %esi,%esi
jle    117c <kernel_sgemv_t_4_lib4+0x7c>
mov    %esi,%r10d
xorps  %xmm2,%xmm2
xor    %esi,%esi
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movaps %xmm2,%xmm1
movss  (%rdx,%rsi,4),%xmm2
movss  0x10(%rdx,%rsi,4),%xmm0
unpcklps %xmm0,%xmm2
movss  0x20(%rdx,%rsi,4),%xmm0
movss  0x30(%rdx,%rsi,4),%xmm3
unpcklps %xmm3,%xmm0
movlhps %xmm0,%xmm2
movss  (%r8,%rsi,4),%xmm0
shufps $0x0,%xmm0,%xmm0
mulps  %xmm2,%xmm0
movaps %xmm0,%xmm2
addps  %xmm1,%xmm2
add    $0xfffffffffffffffc,%rax
add    $0x1,%rsi
cmp    %esi,%r10d
jne    1120 <kernel_sgemv_t_4_lib4+0x20>
addps  %xmm1,%xmm0
lea    -0x4(,%rcx,4),%esi
movslq %esi,%rsi
lea    (%rdx,%rsi,4),%rdx
sub    %rax,%rdx
sub    %rax,%r8
jmp    117f <kernel_sgemv_t_4_lib4+0x7f>
xorps  %xmm0,%xmm0
xor    %eax,%eax
cmp    $0x4,%edi
jl     1271 <kernel_sgemv_t_4_lib4+0x171>
lea    -0x3(%rdi),%esi
shl    $0x2,%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
xor    %eax,%eax
nopl   0x0(%rax)
movss  0x30(%rdx),%xmm1
movss  0x20(%rdx),%xmm2
unpcklps %xmm1,%xmm2
movss  0x10(%rdx),%xmm1
movss  (%rdx),%xmm6
unpcklps %xmm1,%xmm6
movlhps %xmm2,%xmm6
movss  0x4(%rdx),%xmm7
movss  0x8(%rdx),%xmm4
movss  0xc(%rdx),%xmm8
movss  (%r8),%xmm3
movss  0x4(%r8),%xmm5
movss  0x8(%r8),%xmm2
movss  0xc(%r8),%xmm1
shufps $0x0,%xmm3,%xmm3
mulps  %xmm6,%xmm3
addps  %xmm0,%xmm3
movss  0x34(%rdx),%xmm0
movss  0x24(%rdx),%xmm6
unpcklps %xmm0,%xmm6
movss  0x14(%rdx),%xmm0
unpcklps %xmm0,%xmm7
movlhps %xmm6,%xmm7
shufps $0x0,%xmm5,%xmm5
mulps  %xmm7,%xmm5
addps  %xmm3,%xmm5
movss  0x38(%rdx),%xmm0
movss  0x28(%rdx),%xmm3
unpcklps %xmm0,%xmm3
movss  0x18(%rdx),%xmm0
unpcklps %xmm0,%xmm4
movlhps %xmm3,%xmm4
shufps $0x0,%xmm2,%xmm2
mulps  %xmm4,%xmm2
addps  %xmm5,%xmm2
movss  0x3c(%rdx),%xmm0
movss  0x2c(%rdx),%xmm3
unpcklps %xmm0,%xmm3
movss  0x1c(%rdx),%xmm0
unpcklps %xmm0,%xmm8
movlhps %xmm3,%xmm8
shufps $0x0,%xmm1,%xmm1
mulps  %xmm8,%xmm1
movaps %xmm1,%xmm0
addps  %xmm2,%xmm0
add    $0x10,%r8
add    $0x4,%eax
add    %rcx,%rdx
cmp    %esi,%eax
jl     11a0 <kernel_sgemv_t_4_lib4+0xa0>
addps  %xmm2,%xmm1
movaps %xmm1,%xmm0
mov    0x8(%rsp),%r10d
cmp    %edi,%eax
jge    12c7 <kernel_sgemv_t_4_lib4+0x1c7>
mov    %eax,%eax
xor    %esi,%esi
xchg   %ax,%ax
movaps %xmm0,%xmm1
movss  (%rdx,%rsi,4),%xmm0
movss  0x10(%rdx,%rsi,4),%xmm2
unpcklps %xmm2,%xmm0
movss  0x20(%rdx,%rsi,4),%xmm2
movss  0x30(%rdx,%rsi,4),%xmm3
unpcklps %xmm3,%xmm2
movlhps %xmm2,%xmm0
movss  (%r8,%rsi,4),%xmm2
shufps $0x0,%xmm2,%xmm2
mulps  %xmm0,%xmm2
movaps %xmm2,%xmm0
addps  %xmm1,%xmm0
add    $0x1,%rsi
lea    (%rax,%rsi,1),%ecx
cmp    %edi,%ecx
jl     1280 <kernel_sgemv_t_4_lib4+0x180>
addps  %xmm1,%xmm2
movaps %xmm2,%xmm0
cmp    $0x1,%r10d
je     12d7 <kernel_sgemv_t_4_lib4+0x1d7>
test   %r10d,%r10d
jne    12e3 <kernel_sgemv_t_4_lib4+0x1e3>
movups %xmm0,(%r9)
ret
movups (%r9),%xmm1
addps  %xmm1,%xmm0
movups %xmm0,(%r9)
ret
movups (%r9),%xmm1
subps  %xmm0,%xmm1
movups %xmm1,(%r9)
ret

LLVM IR (-O0):
define void @kernel_sgemv_t_4_lib4(i32 %0, i32 %1, float* %2, i32 %3, float* %4, float* %5, i32 %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca float*
%11 = alloca i32
%12 = alloca float*
%13 = alloca float*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca float
%20 = alloca float
%21 = alloca float
%22 = alloca float
%23 = alloca float
%24 = alloca float
%25 = alloca float
%26 = alloca float
store i32 %0, i32* %8
store i32 %1, i32* %9
store float* %2, float** %10
store i32 %3, i32* %11
store float* %4, float** %12
store float* %5, float** %13
store i32 %6, i32* %14
%27 = load i32, i32* %8
%28 = icmp sle i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %7
br label %311
30: ; preds = %7
store i32 4, i32* %15
store i32 4, i32* %16
%31 = load i32, i32* %8
%32 = load i32, i32* %9
%33 = sub nsw i32 %31, %32
store i32 %33, i32* %18
store float 0.000000e+00, float* %23
store float 0.000000e+00, float* %24
store float 0.000000e+00, float* %25
store float 0.000000e+00, float* %26
%34 = load i32, i32* %9
%35 = icmp sgt i32 %34, 0
br i1 %35, label %36, label %83
36: ; preds = %30
store i32 0, i32* %17
br label %37
37: ; preds = %73, %36
%38 = load i32, i32* %17
%39 = load i32, i32* %9
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %76
41: ; preds = %37
%42 = load float*, float** %12
%43 = getelementptr inbounds float, float* %42, i64 0
%44 = load float, float* %43
store float %44, float* %19
%45 = load float*, float** %10
%46 = getelementptr inbounds float, float* %45, i64 0
%47 = load float, float* %46
%48 = load float, float* %19
%49 = load float, float* %23
%50 = call float @llvm.fmuladd.f32(float %47, float %48, float %49)
store float %50, float* %23
%51 = load float*, float** %10
%52 = getelementptr inbounds float, float* %51, i64 4
%53 = load float, float* %52
%54 = load float, float* %19
%55 = load float, float* %24
%56 = call float @llvm.fmuladd.f32(float %53, float %54, float %55)
store float %56, float* %24
%57 = load float*, float** %10
%58 = getelementptr inbounds float, float* %57, i64 8
%59 = load float, float* %58
%60 = load float, float* %19
%61 = load float, float* %25
%62 = call float @llvm.fmuladd.f32(float %59, float %60, float %61)
store float %62, float* %25
%63 = load float*, float** %10
%64 = getelementptr inbounds float, float* %63, i64 12
%65 = load float, float* %64
%66 = load float, float* %19
%67 = load float, float* %26
%68 = call float @llvm.fmuladd.f32(float %65, float %66, float %67)
store float %68, float* %26
%69 = load float*, float** %10
%70 = getelementptr inbounds float, float* %69, i64 1
store float* %70, float** %10
%71 = load float*, float** %12
%72 = getelementptr inbounds float, float* %71, i64 1
store float* %72, float** %12
br label %73
73: ; preds = %41
%74 = load i32, i32* %17
%75 = add nsw i32 %74, 1
store i32 %75, i32* %17
br label %37
76: ; preds = %37
%77 = load i32, i32* %11
%78 = sub nsw i32 %77, 1
%79 = mul nsw i32 %78, 4
%80 = load float*, float** %10
%81 = sext i32 %79 to i64
%82 = getelementptr inbounds float, float* %80, i64 %81
store float* %82, float** %10
br label %83
83: ; preds = %76, %30
store i32 0, i32* %17
br label %84
84: ; preds = %206, %83
%85 = load i32, i32* %17
%86 = load i32, i32* %18
%87 = sub nsw i32 %86, 4
%88 = add nsw i32 %87, 1
%89 = icmp slt i32 %85, %88
br i1 %89, label %90, label %209
90: ; preds = %84
%91 = load float*, float** %12
%92 = getelementptr inbounds float, float* %91, i64 0
%93 = load float, float* %92
store float %93, float* %19
%94 = load float*, float** %12
%95 = getelementptr inbounds float, float* %94, i64 1
%96 = load float, float* %95
store float %96, float* %20
%97 = load float*, float** %12
%98 = getelementptr inbounds float, float* %97, i64 2
%99 = load float, float* %98
store float %99, float* %21
%100 = load float*, float** %12
%101 = getelementptr inbounds float, float* %100, i64 3
%102 = load float, float* %101
store float %102, float* %22
%103 = load float*, float** %10
%104 = getelementptr inbounds float, float* %103, i64 0
%105 = load float, float* %104
%106 = load float, float* %19
%107 = load float, float* %23
%108 = call float @llvm.fmuladd.f32(float %105, float %106, float %107)
store float %108, float* %23
%109 = load float*, float** %10
%110 = getelementptr inbounds float, float* %109, i64 4
%111 = load float, float* %110
%112 = load float, float* %19
%113 = load float, float* %24
%114 = call float @llvm.fmuladd.f32(float %111, float %112, float %113)
store float %114, float* %24
%115 = load float*, float** %10
%116 = getelementptr inbounds float, float* %115, i64 8
%117 = load float, float* %116
%118 = load float, float* %19
%119 = load float, float* %25
%120 = call float @llvm.fmuladd.f32(float %117, float %118, float %119)
store float %120, float* %25
%121 = load float*, float** %10
%122 = getelementptr inbounds float, float* %121, i64 12
%123 = load float, float* %122
%124 = load float, float* %19
%125 = load float, float* %26
%126 = call float @llvm.fmuladd.f32(float %123, float %124, float %125)
store float %126, float* %26
%127 = load float*, float** %10
%128 = getelementptr inbounds float, float* %127, i64 1
%129 = load float, float* %128
%130 = load float, float* %20
%131 = load float, float* %23
%132 = call float @llvm.fmuladd.f32(float %129, float %130, float %131)
store float %132, float* %23
%133 = load float*, float** %10
%134 = getelementptr inbounds float, float* %133, i64 5
%135 = load float, float* %134
%136 = load float, float* %20
%137 = load float, float* %24
%138 = call float @llvm.fmuladd.f32(float %135, float %136, float %137)
store float %138, float* %24
%139 = load float*, float** %10
%140 = getelementptr inbounds float, float* %139, i64 9
%141 = load float, float* %140
%142 = load float, float* %20
%143 = load float, float* %25
%144 = call float @llvm.fmuladd.f32(float %141, float %142, float %143)
store float %144, float* %25
%145 = load float*, float** %10
%146 = getelementptr inbounds float, float* %145, i64 13
%147 = load float, float* %146
%148 = load float, float* %20
%149 = load float, float* %26
%150 = call float @llvm.fmuladd.f32(float %147, float %148, float %149)
store float %150, float* %26
%151 = load float*, float** %10
%152 = getelementptr inbounds float, float* %151, i64 2
%153 = load float, float* %152
%154 = load float, float* %21
%155 = load float, float* %23
%156 = call float @llvm.fmuladd.f32(float %153, float %154, float %155)
store float %156, float* %23
%157 = load float*, float** %10
%158 = getelementptr inbounds float, float* %157, i64 6
%159 = load float, float* %158
%160 = load float, float* %21
%161 = load float, float* %24
%162 = call float @llvm.fmuladd.f32(float %159, float %160, float %161)
store float %162, float* %24
%163 = load float*, float** %10
%164 = getelementptr inbounds float, float* %163, i64 10
%165 = load float, float* %164
%166 = load float, float* %21
%167 = load float, float* %25
%168 = call float @llvm.fmuladd.f32(float %165, float %166, float %167)
store float %168, float* %25
%169 = load float*, float** %10
%170 = getelementptr inbounds float, float* %169, i64 14
%171 = load float, float* %170
%172 = load float, float* %21
%173 = load float, float* %26
%174 = call float @llvm.fmuladd.f32(float %171, float %172, float %173)
store float %174, float* %26
%175 = load float*, float** %10
%176 = getelementptr inbounds float, float* %175, i64 3
%177 = load float, float* %176
%178 = load float, float* %22
%179 = load float, float* %23
%180 = call float @llvm.fmuladd.f32(float %177, float %178, float %179)
store float %180, float* %23
%181 = load float*, float** %10
%182 = getelementptr inbounds float, float* %181, i64 7
%183 = load float, float* %182
%184 = load float, float* %22
%185 = load float, float* %24
%186 = call float @llvm.fmuladd.f32(float %183, float %184, float %185)
store float %186, float* %24
%187 = load float*, float** %10
%188 = getelementptr inbounds float, float* %187, i64 11
%189 = load float, float* %188
%190 = load float, float* %22
%191 = load float, float* %25
%192 = call float @llvm.fmuladd.f32(float %189, float %190, float %191)
store float %192, float* %25
%193 = load float*, float** %10
%194 = getelementptr inbounds float, float* %193, i64 15
%195 = load float, float* %194
%196 = load float, float* %22
%197 = load float, float* %26
%198 = call float @llvm.fmuladd.f32(float %195, float %196, float %197)
store float %198, float* %26
%199 = load i32, i32* %11
%200 = mul nsw i32 %199, 4
%201 = load float*, float** %10
%202 = sext i32 %200 to i64
%203 = getelementptr inbounds float, float* %201, i64 %202
store float* %203, float** %10
%204 = load float*, float** %12
%205 = getelementptr inbounds float, float* %204, i64 4
store float* %205, float** %12
br label %206
206: ; preds = %90
%207 = load i32, i32* %17
%208 = add nsw i32 %207, 4
store i32 %208, i32* %17
br label %84
209: ; preds = %84
br label %210
210: ; preds = %246, %209
%211 = load i32, i32* %17
%212 = load i32, i32* %18
%213 = icmp slt i32 %211, %212
br i1 %213, label %214, label %249
214: ; preds = %210
%215 = load float*, float** %12
%216 = getelementptr inbounds float, float* %215, i64 0
%217 = load float, float* %216
store float %217, float* %19
%218 = load float*, float** %10
%219 = getelementptr inbounds float, float* %218, i64 0
%220 = load float, float* %219
%221 = load float, float* %19
%222 = load float, float* %23
%223 = call float @llvm.fmuladd.f32(float %220, float %221, float %222)
store float %223, float* %23
%224 = load float*, float** %10
%225 = getelementptr inbounds float, float* %224, i64 4
%226 = load float, float* %225
%227 = load float, float* %19
%228 = load float, float* %24
%229 = call float @llvm.fmuladd.f32(float %226, float %227, float %228)
store float %229, float* %24
%230 = load float*, float** %10
%231 = getelementptr inbounds float, float* %230, i64 8
%232 = load float, float* %231
%233 = load float, float* %19
%234 = load float, float* %25
%235 = call float @llvm.fmuladd.f32(float %232, float %233, float %234)
store float %235, float* %25
%236 = load float*, float** %10
%237 = getelementptr inbounds float, float* %236, i64 12
%238 = load float, float* %237
%239 = load float, float* %19
%240 = load float, float* %26
%241 = call float @llvm.fmuladd.f32(float %238, float %239, float %240)
store float %241, float* %26
%242 = load float*, float** %10
%243 = getelementptr inbounds float, float* %242, i64 1
store float* %243, float** %10
%244 = load float*, float** %12
%245 = getelementptr inbounds float, float* %244, i64 1
store float* %245, float** %12
br label %246
246: ; preds = %214
%247 = load i32, i32* %17
%248 = add nsw i32 %247, 1
store i32 %248, i32* %17
br label %210
249: ; preds = %210
%250 = load i32, i32* %14
%251 = icmp eq i32 %250, 0
br i1 %251, label %252, label %265
252: ; preds = %249
%253 = load float, float* %23
%254 = load float*, float** %13
%255 = getelementptr inbounds float, float* %254, i64 0
store float %253, float* %255
%256 = load float, float* %24
%257 = load float*, float** %13
%258 = getelementptr inbounds float, float* %257, i64 1
store float %256, float* %258
%259 = load float, float* %25
%260 = load float*, float** %13
%261 = getelementptr inbounds float, float* %260, i64 2
store float %259, float* %261
%262 = load float, float* %26
%263 = load float*, float** %13
%264 = getelementptr inbounds float, float* %263, i64 3
store float %262, float* %264
br label %311
265: ; preds = %249
%266 = load i32, i32* %14
%267 = icmp eq i32 %266, 1
br i1 %267, label %268, label %289
268: ; preds = %265
%269 = load float, float* %23
%270 = load float*, float** %13
%271 = getelementptr inbounds float, float* %270, i64 0
%272 = load float, float* %271
%273 = fadd float %272, %269
store float %273, float* %271
%274 = load float, float* %24
%275 = load float*, float** %13
%276 = getelementptr inbounds float, float* %275, i64 1
%277 = load float, float* %276
%278 = fadd float %277, %274
store float %278, float* %276
%279 = load float, float* %25
%280 = load float*, float** %13
%281 = getelementptr inbounds float, float* %280, i64 2
%282 = load float, float* %281
%283 = fadd float %282, %279
store float %283, float* %281
%284 = load float, float* %26
%285 = load float*, float** %13
%286 = getelementptr inbounds float, float* %285, i64 3
%287 = load float, float* %286
%288 = fadd float %287, %284
store float %288, float* %286
br label %310
289: ; preds = %265
%290 = load float, float* %23
%291 = load float*, float** %13
%292 = getelementptr inbounds float, float* %291, i64 0
%293 = load float, float* %292
%294 = fsub float %293, %290
store float %294, float* %292
%295 = load float, float* %24
%296 = load float*, float** %13
%297 = getelementptr inbounds float, float* %296, i64 1
%298 = load float, float* %297
%299 = fsub float %298, %295
store float %299, float* %297
%300 = load float, float* %25
%301 = load float*, float** %13
%302 = getelementptr inbounds float, float* %301, i64 2
%303 = load float, float* %302
%304 = fsub float %303, %300
store float %304, float* %302
%305 = load float, float* %26
%306 = load float*, float** %13
%307 = getelementptr inbounds float, float* %306, i64 3
%308 = load float, float* %307
%309 = fsub float %308, %305
store float %309, float* %307
br label %310
310: ; preds = %289, %268
br label %311
311: ; preds = %29, %310, %252
ret void
}

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