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


x86 assembly (clang, -O0):
<kernel_dgemv_t_4_lib4>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     112c <kernel_dgemv_t_4_lib4+0x2c>
jmp    15b4 <kernel_dgemv_t_4_lib4+0x4b4>
movl   $0x4,-0x34(%rbp)
movl   $0x4,-0x38(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x40(%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)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x40(%rbp),%ecx
sub    $0x4,%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    13e3 <kernel_dgemv_t_4_lib4+0x2e3>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%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  0x20(%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  0x40(%rax),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x60(%rax),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%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  0x28(%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  0x48(%rax),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x68(%rax),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%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  0x30(%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  0x50(%rax),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x70(%rax),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  -0x60(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x38(%rax),%xmm0
movsd  -0x60(%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  -0x60(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x78(%rax),%xmm0
movsd  -0x60(%rbp),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x14(%rbp),%ecx
shl    $0x2,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x20(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x3c(%rbp)
jmp    1167 <kernel_dgemv_t_4_lib4+0x67>
jmp    13e8 <kernel_dgemv_t_4_lib4+0x2e8>
mov    -0x3c(%rbp),%eax
cmp    -0x40(%rbp),%eax
jge    14a6 <kernel_dgemv_t_4_lib4+0x3a6>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%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  0x20(%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  0x40(%rax),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x60(%rax),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    13e8 <kernel_dgemv_t_4_lib4+0x2e8>
cmpl   $0x0,0x10(%rbp)
jne    14ec <kernel_dgemv_t_4_lib4+0x3ec>
movsd  -0x68(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x70(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x78(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x80(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x18(%rax)
jmp    15b4 <kernel_dgemv_t_4_lib4+0x4b4>
cmpl   $0x1,0x10(%rbp)
jne    1555 <kernel_dgemv_t_4_lib4+0x455>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
addsd  -0x68(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm0
addsd  -0x70(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x28(%rbp),%rax
movsd  0x10(%rax),%xmm0
addsd  -0x78(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x28(%rbp),%rax
movsd  0x18(%rax),%xmm0
addsd  -0x80(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x18(%rax)
jmp    15af <kernel_dgemv_t_4_lib4+0x4af>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x68(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm0
subsd  -0x70(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x28(%rbp),%rax
movsd  0x10(%rax),%xmm0
subsd  -0x78(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x28(%rbp),%rax
movsd  0x18(%rax),%xmm0
subsd  -0x80(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,0x18(%rax)
jmp    15b4 <kernel_dgemv_t_4_lib4+0x4b4>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_dgemv_t_4_lib4>:
test   %edi,%edi
jle    132f <kernel_dgemv_t_4_lib4+0x22f>
cmp    $0x4,%edi
jb     1214 <kernel_dgemv_t_4_lib4+0x114>
lea    -0x3(%rdi),%r10d
shl    $0x2,%edx
movslq %edx,%rdx
shl    $0x3,%rdx
xorpd  %xmm4,%xmm4
xor    %eax,%eax
xorpd  %xmm5,%xmm5
nopl   0x0(%rax)
movsd  (%rsi),%xmm7
movsd  0x8(%rsi),%xmm1
movsd  0x10(%rsi),%xmm2
movsd  0x18(%rsi),%xmm0
movhpd 0x20(%rsi),%xmm7
movsd  (%rcx),%xmm3
movsd  0x8(%rcx),%xmm6
movsd  0x10(%rcx),%xmm9
movsd  0x18(%rcx),%xmm8
unpcklpd %xmm3,%xmm3
mulpd  %xmm3,%xmm7
addpd  %xmm4,%xmm7
movsd  0x40(%rsi),%xmm4
movhpd 0x60(%rsi),%xmm4
mulpd  %xmm3,%xmm4
addpd  %xmm5,%xmm4
movhpd 0x28(%rsi),%xmm1
unpcklpd %xmm6,%xmm6
mulpd  %xmm6,%xmm1
addpd  %xmm7,%xmm1
movsd  0x48(%rsi),%xmm3
movhpd 0x68(%rsi),%xmm3
mulpd  %xmm6,%xmm3
addpd  %xmm4,%xmm3
movhpd 0x30(%rsi),%xmm2
unpcklpd %xmm9,%xmm9
mulpd  %xmm9,%xmm2
addpd  %xmm1,%xmm2
movsd  0x50(%rsi),%xmm7
movhpd 0x70(%rsi),%xmm7
mulpd  %xmm9,%xmm7
addpd  %xmm3,%xmm7
movhpd 0x38(%rsi),%xmm0
unpcklpd %xmm8,%xmm8
mulpd  %xmm8,%xmm0
movapd %xmm0,%xmm4
addpd  %xmm2,%xmm4
movsd  0x58(%rsi),%xmm1
movhpd 0x78(%rsi),%xmm1
mulpd  %xmm8,%xmm1
movapd %xmm1,%xmm5
addpd  %xmm7,%xmm5
add    $0x20,%rcx
add    $0x4,%eax
add    %rdx,%rsi
cmp    %r10d,%eax
jl     1130 <kernel_dgemv_t_4_lib4+0x30>
addpd  %xmm7,%xmm1
addpd  %xmm2,%xmm0
mov    %edi,%edx
and    $0xfffffffc,%edx
jmp    121e <kernel_dgemv_t_4_lib4+0x11e>
xorpd  %xmm0,%xmm0
xor    %edx,%edx
xorpd  %xmm1,%xmm1
mov    0x8(%rsp),%eax
cmp    %edi,%edx
jge    1288 <kernel_dgemv_t_4_lib4+0x188>
sub    %edx,%edi
xor    %edx,%edx
nopw   0x0(%rax,%rax,1)
movapd %xmm1,%xmm3
movapd %xmm0,%xmm2
movsd  (%rsi,%rdx,8),%xmm4
movsd  0x40(%rsi,%rdx,8),%xmm5
movhpd 0x20(%rsi,%rdx,8),%xmm4
movsd  (%rcx,%rdx,8),%xmm1
unpcklpd %xmm1,%xmm1
mulpd  %xmm1,%xmm4
movapd %xmm4,%xmm0
addpd  %xmm2,%xmm0
movhpd 0x60(%rsi,%rdx,8),%xmm5
mulpd  %xmm1,%xmm5
movapd %xmm5,%xmm1
addpd  %xmm3,%xmm1
add    $0x1,%rdx
cmp    %edx,%edi
jne    1230 <kernel_dgemv_t_4_lib4+0x130>
addpd  %xmm3,%xmm5
addpd  %xmm2,%xmm4
movapd %xmm4,%xmm0
movapd %xmm5,%xmm1
cmp    $0x1,%eax
je     12a5 <kernel_dgemv_t_4_lib4+0x1a5>
test   %eax,%eax
jne    12e2 <kernel_dgemv_t_4_lib4+0x1e2>
movupd %xmm0,(%r8)
movlpd %xmm1,0x10(%r8)
unpckhpd %xmm1,%xmm1
jmp    1329 <kernel_dgemv_t_4_lib4+0x229>
movsd  (%r8),%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,(%r9)
unpckhpd %xmm0,%xmm0
addsd  0x8(%r8),%xmm0
movsd  %xmm0,0x8(%r9)
movsd  0x10(%r8),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%r9)
unpckhpd %xmm1,%xmm1
addsd  0x18(%r8),%xmm1
mov    %r9,%r8
jmp    1329 <kernel_dgemv_t_4_lib4+0x229>
movsd  (%r8),%xmm2
subsd  %xmm0,%xmm2
movsd  %xmm2,(%r9)
movsd  0x8(%r8),%xmm2
unpckhpd %xmm0,%xmm0
subsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%r9)
movsd  0x10(%r8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%r9)
movsd  0x18(%r8),%xmm0
unpckhpd %xmm1,%xmm1
subsd  %xmm1,%xmm0
mov    %r9,%r8
movapd %xmm0,%xmm1
movsd  %xmm1,0x18(%r8)
ret

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

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