void kernel_sgemv_t_4_vs_lib4(int kmax, float *A, int sda, float *x, int alg,
                              float *y, float *z, int km) {
  if (kmax <= 0)
    return;
  const int bs = 4;
  int k;
  float x_0, x_1, x_2, x_3, y_0 = 0, y_1 = 0, y_2 = 0, y_3 = 0;
  k = 0;
  for (; k < kmax - bs + 1; k += bs) {
    x_0 = x[0];
    x_1 = x[1];
    x_2 = x[2];
    x_3 = x[3];
    y_0 += A[0 + bs * 0] * x_0;
    y_1 += A[0 + bs * 1] * x_0;
    y_2 += A[0 + bs * 2] * x_0;
    y_3 += A[0 + bs * 3] * x_0;
    y_0 += A[1 + bs * 0] * x_1;
    y_1 += A[1 + bs * 1] * x_1;
    y_2 += A[1 + bs * 2] * x_1;
    y_3 += A[1 + bs * 3] * x_1;
    y_0 += A[2 + bs * 0] * x_2;
    y_1 += A[2 + bs * 1] * x_2;
    y_2 += A[2 + bs * 2] * x_2;
    y_3 += A[2 + bs * 3] * x_2;
    y_0 += A[3 + bs * 0] * x_3;
    y_1 += A[3 + bs * 1] * x_3;
    y_2 += A[3 + bs * 2] * x_3;
    y_3 += A[3 + bs * 3] * x_3;
    A += sda * bs;
    x += 4;
  }
  for (; k < kmax; k++) {
    x_0 = x[0];
    y_0 += A[0 + bs * 0] * x_0;
    y_1 += A[0 + bs * 1] * x_0;
    y_2 += A[0 + bs * 2] * x_0;
    y_3 += A[0 + bs * 3] * x_0;
    A += 1;
    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];
    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;
    goto store;
  }
store:
  if (km >= 4) {
    z[0] = y_0;
    z[1] = y_1;
    z[2] = y_2;
    z[3] = y_3;
  } else {
    z[0] = y_0;
    if (km >= 2) {
      z[1] = y_1;
      if (km > 2) {
        z[2] = y_2;
      }
    }
  }
}


x86 assembly (clang, -O0):
<kernel_sgemv_t_4_vs_lib4>:
push   %rbp
mov    %rsp,%rbp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     1130 <kernel_sgemv_t_4_vs_lib4+0x30>
jmp    15de <kernel_sgemv_t_4_vs_lib4+0x4de>
movl   $0x4,-0x34(%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)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x4,%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    13da <kernel_sgemv_t_4_vs_lib4+0x2da>
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    -0x38(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x38(%rbp)
jmp    115e <kernel_sgemv_t_4_vs_lib4+0x5e>
jmp    13df <kernel_sgemv_t_4_vs_lib4+0x2df>
mov    -0x38(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    149d <kernel_sgemv_t_4_vs_lib4+0x39d>
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    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    13df <kernel_sgemv_t_4_vs_lib4+0x2df>
cmpl   $0x0,-0x24(%rbp)
jne    14ac <kernel_sgemv_t_4_vs_lib4+0x3ac>
jmp    1551 <kernel_sgemv_t_4_vs_lib4+0x451>
cmpl   $0x1,-0x24(%rbp)
jne    1506 <kernel_sgemv_t_4_vs_lib4+0x406>
mov    -0x30(%rbp),%rax
movss  (%rax),%xmm0
addss  -0x4c(%rbp),%xmm0
movss  %xmm0,-0x4c(%rbp)
mov    -0x30(%rbp),%rax
movss  0x4(%rax),%xmm0
addss  -0x50(%rbp),%xmm0
movss  %xmm0,-0x50(%rbp)
mov    -0x30(%rbp),%rax
movss  0x8(%rax),%xmm0
addss  -0x54(%rbp),%xmm0
movss  %xmm0,-0x54(%rbp)
mov    -0x30(%rbp),%rax
movss  0xc(%rax),%xmm0
addss  -0x58(%rbp),%xmm0
movss  %xmm0,-0x58(%rbp)
jmp    1551 <kernel_sgemv_t_4_vs_lib4+0x451>
mov    -0x30(%rbp),%rax
movss  (%rax),%xmm0
subss  -0x4c(%rbp),%xmm0
movss  %xmm0,-0x4c(%rbp)
mov    -0x30(%rbp),%rax
movss  0x4(%rax),%xmm0
subss  -0x50(%rbp),%xmm0
movss  %xmm0,-0x50(%rbp)
mov    -0x30(%rbp),%rax
movss  0x8(%rax),%xmm0
subss  -0x54(%rbp),%xmm0
movss  %xmm0,-0x54(%rbp)
mov    -0x30(%rbp),%rax
movss  0xc(%rax),%xmm0
subss  -0x58(%rbp),%xmm0
movss  %xmm0,-0x58(%rbp)
cmpl   $0x4,0x18(%rbp)
jl     1597 <kernel_sgemv_t_4_vs_lib4+0x497>
movss  -0x4c(%rbp),%xmm0
mov    0x10(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x50(%rbp),%xmm0
mov    0x10(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x54(%rbp),%xmm0
mov    0x10(%rbp),%rax
movss  %xmm0,0x8(%rax)
movss  -0x58(%rbp),%xmm0
mov    0x10(%rbp),%rax
movss  %xmm0,0xc(%rax)
jmp    15de <kernel_sgemv_t_4_vs_lib4+0x4de>
movss  -0x4c(%rbp),%xmm0
mov    0x10(%rbp),%rax
movss  %xmm0,(%rax)
cmpl   $0x2,0x18(%rbp)
jl     15d9 <kernel_sgemv_t_4_vs_lib4+0x4d9>
movss  -0x50(%rbp),%xmm0
mov    0x10(%rbp),%rax
movss  %xmm0,0x4(%rax)
cmpl   $0x2,0x18(%rbp)
jle    15d4 <kernel_sgemv_t_4_vs_lib4+0x4d4>
movss  -0x54(%rbp),%xmm0
mov    0x10(%rbp),%rax
movss  %xmm0,0x8(%rax)
jmp    15d9 <kernel_sgemv_t_4_vs_lib4+0x4d9>
jmp    15de <kernel_sgemv_t_4_vs_lib4+0x4de>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_sgemv_t_4_vs_lib4>:
test   %edi,%edi
jle    12d6 <kernel_sgemv_t_4_vs_lib4+0x1d6>
cmp    $0x4,%edi
jb     1206 <kernel_sgemv_t_4_vs_lib4+0x106>
lea    -0x3(%rdi),%r10d
shl    $0x2,%edx
movslq %edx,%rdx
shl    $0x2,%rdx
xorps  %xmm3,%xmm3
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movss  0x30(%rsi),%xmm0
movss  0x20(%rsi),%xmm1
unpcklps %xmm0,%xmm1
movss  0x10(%rsi),%xmm0
movss  (%rsi),%xmm6
unpcklps %xmm0,%xmm6
movlhps %xmm1,%xmm6
movss  0x4(%rsi),%xmm7
movss  0x8(%rsi),%xmm4
movss  0xc(%rsi),%xmm8
movss  (%rcx),%xmm2
movss  0x4(%rcx),%xmm5
movss  0x8(%rcx),%xmm1
movss  0xc(%rcx),%xmm0
shufps $0x0,%xmm2,%xmm2
mulps  %xmm6,%xmm2
addps  %xmm3,%xmm2
movss  0x34(%rsi),%xmm3
movss  0x24(%rsi),%xmm6
unpcklps %xmm3,%xmm6
movss  0x14(%rsi),%xmm3
unpcklps %xmm3,%xmm7
movlhps %xmm6,%xmm7
shufps $0x0,%xmm5,%xmm5
mulps  %xmm7,%xmm5
addps  %xmm2,%xmm5
movss  0x38(%rsi),%xmm2
movss  0x28(%rsi),%xmm3
unpcklps %xmm2,%xmm3
movss  0x18(%rsi),%xmm2
unpcklps %xmm2,%xmm4
movlhps %xmm3,%xmm4
shufps $0x0,%xmm1,%xmm1
mulps  %xmm4,%xmm1
addps  %xmm5,%xmm1
movss  0x3c(%rsi),%xmm2
movss  0x2c(%rsi),%xmm3
unpcklps %xmm2,%xmm3
movss  0x1c(%rsi),%xmm2
unpcklps %xmm2,%xmm8
movlhps %xmm3,%xmm8
shufps $0x0,%xmm0,%xmm0
mulps  %xmm8,%xmm0
movaps %xmm0,%xmm3
addps  %xmm1,%xmm3
add    $0x10,%rcx
add    $0x4,%eax
add    %rdx,%rsi
cmp    %r10d,%eax
jl     1130 <kernel_sgemv_t_4_vs_lib4+0x30>
addps  %xmm1,%xmm0
mov    %edi,%eax
and    $0xfffffffc,%eax
cmp    %edi,%eax
jl     120f <kernel_sgemv_t_4_vs_lib4+0x10f>
jmp    1263 <kernel_sgemv_t_4_vs_lib4+0x163>
xorps  %xmm0,%xmm0
xor    %eax,%eax
cmp    %edi,%eax
jge    1263 <kernel_sgemv_t_4_vs_lib4+0x163>
sub    %eax,%edi
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movaps %xmm0,%xmm1
movss  (%rsi,%rax,4),%xmm0
movss  0x10(%rsi,%rax,4),%xmm2
unpcklps %xmm2,%xmm0
movss  0x20(%rsi,%rax,4),%xmm2
movss  0x30(%rsi,%rax,4),%xmm3
unpcklps %xmm3,%xmm2
movlhps %xmm2,%xmm0
movss  (%rcx,%rax,4),%xmm2
shufps $0x0,%xmm2,%xmm2
mulps  %xmm0,%xmm2
movaps %xmm2,%xmm0
addps  %xmm1,%xmm0
add    $0x1,%rax
cmp    %eax,%edi
jne    1220 <kernel_sgemv_t_4_vs_lib4+0x120>
addps  %xmm1,%xmm2
movaps %xmm2,%xmm0
mov    0x10(%rsp),%ecx
mov    0x8(%rsp),%rax
test   %r8d,%r8d
je     128a <kernel_sgemv_t_4_vs_lib4+0x18a>
cmp    $0x1,%r8d
jne    1280 <kernel_sgemv_t_4_vs_lib4+0x180>
movups (%r9),%xmm1
addps  %xmm1,%xmm0
jmp    128a <kernel_sgemv_t_4_vs_lib4+0x18a>
movups (%r9),%xmm1
subps  %xmm0,%xmm1
movaps %xmm1,%xmm0
movss  %xmm0,(%rax)
cmp    $0x4,%ecx
jl     12b6 <kernel_sgemv_t_4_vs_lib4+0x1b6>
movaps %xmm0,%xmm1
shufps $0x55,%xmm0,%xmm1
movss  %xmm1,0x4(%rax)
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
movss  %xmm1,0x8(%rax)
shufps $0xff,%xmm0,%xmm0
mov    $0x3,%ecx
jmp    12d1 <kernel_sgemv_t_4_vs_lib4+0x1d1>
cmp    $0x2,%ecx
jl     12d6 <kernel_sgemv_t_4_vs_lib4+0x1d6>
movaps %xmm0,%xmm1
shufps $0x55,%xmm0,%xmm1
movss  %xmm1,0x4(%rax)
je     12d6 <kernel_sgemv_t_4_vs_lib4+0x1d6>
movhlps %xmm0,%xmm0
mov    $0x2,%ecx
movss  %xmm0,(%rax,%rcx,4)
ret

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

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