#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ __m128d;

/* Variables and functions */
int /*<<< orphan*/ _mm_add_pd(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_add_sd(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_load_sd(double *);
int /*<<< orphan*/ _mm_mul_sd(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_setzero_pd();
int /*<<< orphan*/ _mm_store_sd(double *, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_sub_sd(int /*<<< orphan*/, int /*<<< orphan*/);
void kernel_dgemv_n_1_lib4(int kmax, double *A, double *x, double *y, double *z,
                           int alg) {
  if (kmax <= 0)
    return;
  const int lda = 4;
  int k;
  __m128d ax_temp, a_00, a_01, a_02, a_03, x_0, x_1, x_2, x_3, y_0, y_0_b,
      y_0_c, y_0_d, z_0;
  y_0 = _mm_setzero_pd();
  y_0_b = _mm_setzero_pd();
  y_0_c = _mm_setzero_pd();
  y_0_d = _mm_setzero_pd();
  k = 0;
  for (; k < kmax - 3; k += 4) {
    x_0 = _mm_load_sd(&x[0]);
    x_1 = _mm_load_sd(&x[1]);
    a_00 = _mm_load_sd(&A[0 + lda * 0]);
    a_01 = _mm_load_sd(&A[0 + lda * 1]);
    x_2 = _mm_load_sd(&x[2]);
    x_3 = _mm_load_sd(&x[3]);
    a_02 = _mm_load_sd(&A[0 + lda * 2]);
    a_03 = _mm_load_sd(&A[0 + lda * 3]);
    ax_temp = _mm_mul_sd(a_00, x_0);
    y_0 = _mm_add_sd(y_0, ax_temp);
    ax_temp = _mm_mul_sd(a_01, x_1);
    y_0_b = _mm_add_sd(y_0_b, ax_temp);
    ax_temp = _mm_mul_sd(a_02, x_2);
    y_0_c = _mm_add_sd(y_0_c, ax_temp);
    ax_temp = _mm_mul_sd(a_03, x_3);
    y_0_d = _mm_add_sd(y_0_d, ax_temp);
    A += 4 * lda;
    x += 4;
  }
  y_0 = _mm_add_pd(y_0, y_0_c);
  y_0_b = _mm_add_pd(y_0_b, y_0_d);
  if (kmax % 4 >= 2) {
    x_0 = _mm_load_sd(&x[0]);
    x_1 = _mm_load_sd(&x[1]);
    a_00 = _mm_load_sd(&A[0 + lda * 0]);
    a_01 = _mm_load_sd(&A[0 + lda * 1]);
    ax_temp = _mm_mul_sd(a_00, x_0);
    y_0 = _mm_add_sd(y_0, ax_temp);
    ax_temp = _mm_mul_sd(a_01, x_1);
    y_0_b = _mm_add_sd(y_0_b, ax_temp);
    A += 2 * lda;
    x += 2;
  }
  y_0 = _mm_add_pd(y_0, y_0_b);
  if (kmax % 2 == 1) {
    x_0 = _mm_load_sd(&x[0]);
    a_00 = _mm_load_sd(&A[0 + lda * 0]);
    ax_temp = _mm_mul_sd(a_00, x_0);
    y_0 = _mm_add_sd(y_0, ax_temp);
  }
  if (alg == 0) {
    _mm_store_sd(&z[0], y_0);
  } else if (alg == 1) {
    z_0 = _mm_load_sd(&y[0]);
    z_0 = _mm_add_sd(z_0, y_0);
    _mm_store_sd(&z[0], z_0);
  } else {
    z_0 = _mm_load_sd(&y[0]);
    z_0 = _mm_sub_sd(z_0, y_0);
    _mm_store_sd(&z[0], z_0);
  }
}


x86 assembly (clang, -O0):
<kernel_dgemv_n_1_lib4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     119e <kernel_dgemv_n_1_lib4+0x2e>
jmp    147e <kernel_dgemv_n_1_lib4+0x30e>
movl   $0x4,-0x30(%rbp)
mov    $0x0,%al
call   1070 <_mm_setzero_pd@plt>
mov    %eax,-0x5c(%rbp)
mov    $0x0,%al
call   1070 <_mm_setzero_pd@plt>
mov    %eax,-0x60(%rbp)
mov    $0x0,%al
call   1070 <_mm_setzero_pd@plt>
mov    %eax,-0x64(%rbp)
mov    $0x0,%al
call   1070 <_mm_setzero_pd@plt>
mov    %eax,-0x68(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x3,%ecx
cmp    %ecx,%eax
jge    12f5 <kernel_dgemv_n_1_lib4+0x185>
mov    -0x18(%rbp),%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x8,%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x20,%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x10,%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,-0x54(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x18,%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x40,%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x60,%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,-0x48(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x4c(%rbp),%esi
call   1060 <_mm_mul_sd@plt>
mov    %eax,-0x38(%rbp)
mov    -0x5c(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1030 <_mm_add_sd@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x40(%rbp),%edi
mov    -0x50(%rbp),%esi
call   1060 <_mm_mul_sd@plt>
mov    %eax,-0x38(%rbp)
mov    -0x60(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1030 <_mm_add_sd@plt>
mov    %eax,-0x60(%rbp)
mov    -0x44(%rbp),%edi
mov    -0x54(%rbp),%esi
call   1060 <_mm_mul_sd@plt>
mov    %eax,-0x38(%rbp)
mov    -0x64(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1030 <_mm_add_sd@plt>
mov    %eax,-0x64(%rbp)
mov    -0x48(%rbp),%edi
mov    -0x58(%rbp),%esi
call   1060 <_mm_mul_sd@plt>
mov    %eax,-0x38(%rbp)
mov    -0x68(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1030 <_mm_add_sd@plt>
mov    %eax,-0x68(%rbp)
mov    -0x10(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x18(%rbp)
mov    -0x34(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x34(%rbp)
jmp    11d4 <kernel_dgemv_n_1_lib4+0x64>
mov    -0x5c(%rbp),%edi
mov    -0x64(%rbp),%esi
call   1040 <_mm_add_pd@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x60(%rbp),%edi
mov    -0x68(%rbp),%esi
call   1040 <_mm_add_pd@plt>
mov    %eax,-0x60(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x2,%edx
jl     13ad <kernel_dgemv_n_1_lib4+0x23d>
mov    -0x18(%rbp),%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x8,%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x20,%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x4c(%rbp),%esi
call   1060 <_mm_mul_sd@plt>
mov    %eax,-0x38(%rbp)
mov    -0x5c(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1030 <_mm_add_sd@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x40(%rbp),%edi
mov    -0x50(%rbp),%esi
call   1060 <_mm_mul_sd@plt>
mov    %eax,-0x38(%rbp)
mov    -0x60(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1030 <_mm_add_sd@plt>
mov    %eax,-0x60(%rbp)
mov    -0x10(%rbp),%rax
add    $0x40,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x18(%rbp)
mov    -0x5c(%rbp),%edi
mov    -0x60(%rbp),%esi
call   1040 <_mm_add_pd@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    1403 <kernel_dgemv_n_1_lib4+0x293>
mov    -0x18(%rbp),%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%edi
mov    -0x4c(%rbp),%esi
call   1060 <_mm_mul_sd@plt>
mov    %eax,-0x38(%rbp)
mov    -0x5c(%rbp),%edi
mov    -0x38(%rbp),%esi
call   1030 <_mm_add_sd@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    141e <kernel_dgemv_n_1_lib4+0x2ae>
mov    -0x28(%rbp),%rdi
mov    -0x5c(%rbp),%esi
call   1080 <_mm_store_sd@plt>
jmp    147e <kernel_dgemv_n_1_lib4+0x30e>
cmpl   $0x1,-0x2c(%rbp)
jne    1453 <kernel_dgemv_n_1_lib4+0x2e3>
mov    -0x20(%rbp),%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x6c(%rbp),%edi
mov    -0x5c(%rbp),%esi
call   1030 <_mm_add_sd@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x6c(%rbp),%esi
call   1080 <_mm_store_sd@plt>
jmp    1479 <kernel_dgemv_n_1_lib4+0x309>
mov    -0x20(%rbp),%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x6c(%rbp),%edi
mov    -0x5c(%rbp),%esi
call   1090 <_mm_sub_sd@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x6c(%rbp),%esi
call   1080 <_mm_store_sd@plt>
jmp    147e <kernel_dgemv_n_1_lib4+0x30e>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_dgemv_n_1_lib4>:
test   %edi,%edi
jle    12d9 <kernel_dgemv_n_1_lib4+0x169>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdx,%rbp
mov    %rsi,%rbx
mov    %edi,%r12d
mov    %r9d,0xc(%rsp)
mov    %rcx,0x30(%rsp)
mov    %r8,0x40(%rsp)
xor    %r14d,%r14d
xor    %eax,%eax
call   1070 <_mm_setzero_pd@plt>
mov    %eax,0x4(%rsp)
xor    %eax,%eax
call   1070 <_mm_setzero_pd@plt>
mov    %eax,%r13d
xor    %eax,%eax
call   1070 <_mm_setzero_pd@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1070 <_mm_setzero_pd@plt>
cmp    $0x4,%r12d
mov    %r12,0x38(%rsp)
jb     12da <kernel_dgemv_n_1_lib4+0x16a>
lea    -0x3(%r12),%ecx
mov    %ecx,0x10(%rsp)
nop
mov    %r13d,0x24(%rsp)
mov    %r15d,0x2c(%rsp)
mov    %eax,0x8(%rsp)
mov    %rbp,%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,0x18(%rsp)
lea    0x8(%rbp),%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,0x20(%rsp)
mov    %rbx,%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,%r13d
lea    0x20(%rbx),%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,%r15d
lea    0x10(%rbp),%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,0x1c(%rsp)
lea    0x18(%rbp),%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,0x28(%rsp)
lea    0x40(%rbx),%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,%r12d
lea    0x60(%rbx),%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,0x14(%rsp)
mov    %r13d,%edi
mov    0x18(%rsp),%esi
call   1060 <_mm_mul_sd@plt>
mov    0x4(%rsp),%edi
mov    %eax,%esi
call   1030 <_mm_add_sd@plt>
mov    %eax,0x4(%rsp)
mov    %r15d,%edi
mov    0x20(%rsp),%esi
call   1060 <_mm_mul_sd@plt>
mov    0x24(%rsp),%edi
mov    %eax,%esi
call   1030 <_mm_add_sd@plt>
mov    %eax,%r13d
mov    %r12d,%edi
mov    0x1c(%rsp),%esi
call   1060 <_mm_mul_sd@plt>
mov    0x2c(%rsp),%edi
mov    %eax,%esi
call   1030 <_mm_add_sd@plt>
mov    %eax,%r15d
mov    0x14(%rsp),%edi
mov    0x28(%rsp),%esi
call   1060 <_mm_mul_sd@plt>
mov    0x8(%rsp),%edi
mov    %eax,%esi
call   1030 <_mm_add_sd@plt>
sub    $0xffffffffffffff80,%rbx
add    $0x20,%rbp
add    $0x4,%r14d
cmp    0x10(%rsp),%r14d
jl     11e0 <kernel_dgemv_n_1_lib4+0x70>
mov    %eax,%r14d
mov    0x38(%rsp),%r12
jmp    12dd <kernel_dgemv_n_1_lib4+0x16d>
ret
mov    %eax,%r14d
mov    0x4(%rsp),%edi
mov    %r15d,%esi
call   1040 <_mm_add_pd@plt>
mov    %eax,%r15d
mov    %r13d,%edi
mov    %r14d,%esi
call   1040 <_mm_add_pd@plt>
lea    0x3(%r12),%ecx
test   %r12d,%r12d
cmovns %r12d,%ecx
mov    %eax,%r14d
and    $0xfffffffc,%ecx
mov    %r12d,%eax
sub    %ecx,%eax
cmp    $0x2,%eax
jl     1382 <kernel_dgemv_n_1_lib4+0x212>
mov    %rbp,%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,0x8(%rsp)
lea    0x8(%rbp),%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,0x4(%rsp)
mov    %rbx,%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,%r13d
lea    0x20(%rbx),%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,%r12d
mov    %r13d,%edi
mov    0x8(%rsp),%esi
call   1060 <_mm_mul_sd@plt>
mov    %r15d,%edi
mov    %eax,%esi
call   1030 <_mm_add_sd@plt>
mov    %eax,%r15d
mov    %r12d,%edi
mov    0x38(%rsp),%r12
mov    0x4(%rsp),%esi
call   1060 <_mm_mul_sd@plt>
mov    %r14d,%edi
mov    %eax,%esi
call   1030 <_mm_add_sd@plt>
mov    %eax,%r14d
add    $0x40,%rbx
add    $0x10,%rbp
mov    %r15d,%edi
mov    %r14d,%esi
call   1040 <_mm_add_pd@plt>
mov    %eax,%r14d
mov    %r12d,%eax
shr    $0x1f,%eax
add    %r12d,%eax
and    $0xfffffffe,%eax
sub    %eax,%r12d
cmp    $0x1,%r12d
jne    13cd <kernel_dgemv_n_1_lib4+0x25d>
mov    %rbp,%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,%edi
mov    %ebp,%esi
call   1060 <_mm_mul_sd@plt>
mov    %r14d,%edi
mov    %eax,%esi
call   1030 <_mm_add_sd@plt>
mov    %eax,%r14d
mov    0xc(%rsp),%eax
test   %eax,%eax
je     1407 <kernel_dgemv_n_1_lib4+0x297>
cmp    $0x1,%eax
jne    13f0 <kernel_dgemv_n_1_lib4+0x280>
mov    0x30(%rsp),%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,%edi
mov    %r14d,%esi
call   1030 <_mm_add_sd@plt>
jmp    1404 <kernel_dgemv_n_1_lib4+0x294>
mov    0x30(%rsp),%rdi
call   1050 <_mm_load_sd@plt>
mov    %eax,%edi
mov    %r14d,%esi
call   1090 <_mm_sub_sd@plt>
mov    %eax,%r14d
mov    0x40(%rsp),%rdi
mov    %r14d,%esi
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <_mm_store_sd@plt>

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

LLVM IR (-O2):
define void @kernel_dgemv_n_1_lib4(i32 %0, double* %1, double* %2, double* %3, double* %4, i32 %5) {
%7 = icmp slt i32 %0, 1
br i1 %7, label %97, label %8
8: ; preds = %6
%9 = tail call i32 (...) @_mm_setzero_pd()
%10 = tail call i32 (...) @_mm_setzero_pd()
%11 = tail call i32 (...) @_mm_setzero_pd()
%12 = tail call i32 (...) @_mm_setzero_pd()
%13 = add nsw i32 %0, -3
%14 = icmp ugt i32 %0, 3
br i1 %14, label %15, label %49
15: ; preds = %8, %15
%16 = phi i32 [ %44, %15 ], [ %12, %8 ]
%17 = phi i32 [ %42, %15 ], [ %11, %8 ]
%18 = phi i32 [ %40, %15 ], [ %10, %8 ]
%19 = phi i32 [ %38, %15 ], [ %9, %8 ]
%20 = phi double* [ %45, %15 ], [ %1, %8 ]
%21 = phi double* [ %46, %15 ], [ %2, %8 ]
%22 = phi i32 [ %47, %15 ], [ 0, %8 ]
%23 = tail call i32 @_mm_load_sd(double* %21)
%24 = getelementptr inbounds double, double* %21, i64 1
%25 = tail call i32 @_mm_load_sd(double* %24)
%26 = tail call i32 @_mm_load_sd(double* %20)
%27 = getelementptr inbounds double, double* %20, i64 4
%28 = tail call i32 @_mm_load_sd(double* %27)
%29 = getelementptr inbounds double, double* %21, i64 2
%30 = tail call i32 @_mm_load_sd(double* %29)
%31 = getelementptr inbounds double, double* %21, i64 3
%32 = tail call i32 @_mm_load_sd(double* %31)
%33 = getelementptr inbounds double, double* %20, i64 8
%34 = tail call i32 @_mm_load_sd(double* %33)
%35 = getelementptr inbounds double, double* %20, i64 12
%36 = tail call i32 @_mm_load_sd(double* %35)
%37 = tail call i32 @_mm_mul_sd(i32 %26, i32 %23)
%38 = tail call i32 @_mm_add_sd(i32 %19, i32 %37)
%39 = tail call i32 @_mm_mul_sd(i32 %28, i32 %25)
%40 = tail call i32 @_mm_add_sd(i32 %18, i32 %39)
%41 = tail call i32 @_mm_mul_sd(i32 %34, i32 %30)
%42 = tail call i32 @_mm_add_sd(i32 %17, i32 %41)
%43 = tail call i32 @_mm_mul_sd(i32 %36, i32 %32)
%44 = tail call i32 @_mm_add_sd(i32 %16, i32 %43)
%45 = getelementptr inbounds double, double* %20, i64 16
%46 = getelementptr inbounds double, double* %21, i64 4
%47 = add nuw nsw i32 %22, 4
%48 = icmp slt i32 %47, %13
br i1 %48, label %15, label %49
49: ; preds = %15, %8
%50 = phi double* [ %2, %8 ], [ %46, %15 ]
%51 = phi double* [ %1, %8 ], [ %45, %15 ]
%52 = phi i32 [ %9, %8 ], [ %38, %15 ]
%53 = phi i32 [ %10, %8 ], [ %40, %15 ]
%54 = phi i32 [ %11, %8 ], [ %42, %15 ]
%55 = phi i32 [ %12, %8 ], [ %44, %15 ]
%56 = tail call i32 @_mm_add_pd(i32 %52, i32 %54)
%57 = tail call i32 @_mm_add_pd(i32 %53, i32 %55)
%58 = srem i32 %0, 4
%59 = icmp sgt i32 %58, 1
br i1 %59, label %60, label %73
60: ; preds = %49
%61 = tail call i32 @_mm_load_sd(double* %50)
%62 = getelementptr inbounds double, double* %50, i64 1
%63 = tail call i32 @_mm_load_sd(double* %62)
%64 = tail call i32 @_mm_load_sd(double* %51)
%65 = getelementptr inbounds double, double* %51, i64 4
%66 = tail call i32 @_mm_load_sd(double* %65)
%67 = tail call i32 @_mm_mul_sd(i32 %64, i32 %61)
%68 = tail call i32 @_mm_add_sd(i32 %56, i32 %67)
%69 = tail call i32 @_mm_mul_sd(i32 %66, i32 %63)
%70 = tail call i32 @_mm_add_sd(i32 %57, i32 %69)
%71 = getelementptr inbounds double, double* %51, i64 8
%72 = getelementptr inbounds double, double* %50, i64 2
br label %73
73: ; preds = %60, %49
%74 = phi double* [ %72, %60 ], [ %50, %49 ]
%75 = phi double* [ %71, %60 ], [ %51, %49 ]
%76 = phi i32 [ %68, %60 ], [ %56, %49 ]
%77 = phi i32 [ %70, %60 ], [ %57, %49 ]
%78 = tail call i32 @_mm_add_pd(i32 %76, i32 %77)
%79 = srem i32 %0, 2
%80 = icmp eq i32 %79, 1
br i1 %80, label %81, label %86
81: ; preds = %73
%82 = tail call i32 @_mm_load_sd(double* %74)
%83 = tail call i32 @_mm_load_sd(double* %75)
%84 = tail call i32 @_mm_mul_sd(i32 %83, i32 %82)
%85 = tail call i32 @_mm_add_sd(i32 %78, i32 %84)
br label %86
86: ; preds = %81, %73
%87 = phi i32 [ %85, %81 ], [ %78, %73 ]
switch i32 %5, label %91 [
i32 0, label %94
i32 1, label %88
]
88: ; preds = %86
%89 = tail call i32 @_mm_load_sd(double* %3)
%90 = tail call i32 @_mm_add_sd(i32 %89, i32 %87)
br label %94
91: ; preds = %86
%92 = tail call i32 @_mm_load_sd(double* %3)
%93 = tail call i32 @_mm_sub_sd(i32 %92, i32 %87)
br label %94
94: ; preds = %86, %88, %91
%95 = phi i32 [ %93, %91 ], [ %90, %88 ], [ %87, %86 ]
%96 = tail call i32 @_mm_store_sd(double* %4, i32 %95)
br label %97
97: ; preds = %94, %6
ret void
}