void kernel_dgead_4_2_lib4(int kmax, double alpha, double *A0, int sda,
                           double *B) {
  if (kmax <= 0)
    return;
  const int bs = 4;
  double *A1 = A0 + bs * sda;
  int k;
  for (k = 0; k < kmax - 3; k += 4) {
    B[0 + bs * 0] += alpha * A0[2 + bs * 0];
    B[1 + bs * 0] += alpha * A0[3 + bs * 0];
    B[2 + bs * 0] += alpha * A1[0 + bs * 0];
    B[3 + bs * 0] += alpha * A1[1 + bs * 0];
    B[0 + bs * 1] += alpha * A0[2 + bs * 1];
    B[1 + bs * 1] += alpha * A0[3 + bs * 1];
    B[2 + bs * 1] += alpha * A1[0 + bs * 1];
    B[3 + bs * 1] += alpha * A1[1 + bs * 1];
    B[0 + bs * 2] += alpha * A0[2 + bs * 2];
    B[1 + bs * 2] += alpha * A0[3 + bs * 2];
    B[2 + bs * 2] += alpha * A1[0 + bs * 2];
    B[3 + bs * 2] += alpha * A1[1 + bs * 2];
    B[0 + bs * 3] += alpha * A0[2 + bs * 3];
    B[1 + bs * 3] += alpha * A0[3 + bs * 3];
    B[2 + bs * 3] += alpha * A1[0 + bs * 3];
    B[3 + bs * 3] += alpha * A1[1 + bs * 3];
    A0 += 16;
    A1 += 16;
    B += 16;
  }
  for (; k < kmax; k++) {
    B[0 + bs * 0] += alpha * A0[2 + bs * 0];
    B[1 + bs * 0] += alpha * A0[3 + bs * 0];
    B[2 + bs * 0] += alpha * A1[0 + bs * 0];
    B[3 + bs * 0] += alpha * A1[1 + bs * 0];
    A0 += 4;
    A1 += 4;
    B += 4;
  }
}


x86 assembly (clang, -O0):
<kernel_dgead_4_2_lib4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     1126 <kernel_dgead_4_2_lib4+0x26>
jmp    14a2 <kernel_dgead_4_2_lib4+0x3a2>
movl   $0x4,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x3,%ecx
cmp    %ecx,%eax
jge    13d2 <kernel_dgead_4_2_lib4+0x2d2>
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x10(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x18(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x30(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x20(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x20(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x38(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x28(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x28(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  0x20(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x30(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x30(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  0x28(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x38(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x38(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x50(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x40(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x40(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x58(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x48(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x48(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  0x40(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x50(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x50(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  0x48(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x58(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x58(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x70(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x60(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x60(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x78(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x68(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x68(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  0x60(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x70(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x70(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  0x68(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x78(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x78(%rax)
mov    -0x18(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x18(%rbp)
mov    -0x38(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x28(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x3c(%rbp)
jmp    114c <kernel_dgead_4_2_lib4+0x4c>
jmp    13d7 <kernel_dgead_4_2_lib4+0x2d7>
mov    -0x3c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    14a2 <kernel_dgead_4_2_lib4+0x3a2>
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x10(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x18(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rax)
mov    -0x18(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x18(%rbp)
mov    -0x38(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x28(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    13d7 <kernel_dgead_4_2_lib4+0x2d7>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_dgead_4_2_lib4>:
push   %rbp
push   %rbx
test   %edi,%edi
jle    145e <kernel_dgead_4_2_lib4+0x35e>
shl    $0x2,%edx
movslq %edx,%rax
cmp    $0x4,%edi
jb     127e <kernel_dgead_4_2_lib4+0x17e>
lea    -0x3(%rdi),%r8d
xor    %edx,%edx
nop
movsd  0x10(%rsi),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rcx),%xmm1
movsd  %xmm1,(%rcx)
movsd  0x18(%rsi),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x8(%rcx),%xmm1
movsd  %xmm1,0x8(%rcx)
movsd  (%rsi,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x10(%rcx),%xmm1
movsd  %xmm1,0x10(%rcx)
movsd  0x8(%rsi,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x18(%rcx),%xmm1
movsd  %xmm1,0x18(%rcx)
movsd  0x30(%rsi),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x20(%rcx),%xmm1
movsd  %xmm1,0x20(%rcx)
movsd  0x38(%rsi),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x28(%rcx),%xmm1
movsd  %xmm1,0x28(%rcx)
movsd  0x20(%rsi,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x30(%rcx),%xmm1
movsd  %xmm1,0x30(%rcx)
movsd  0x28(%rsi,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x38(%rcx),%xmm1
movsd  %xmm1,0x38(%rcx)
movsd  0x50(%rsi),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x40(%rcx),%xmm1
movsd  %xmm1,0x40(%rcx)
movsd  0x58(%rsi),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x48(%rcx),%xmm1
movsd  %xmm1,0x48(%rcx)
movsd  0x40(%rsi,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x50(%rcx),%xmm1
movsd  %xmm1,0x50(%rcx)
movsd  0x48(%rsi,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x58(%rcx),%xmm1
movsd  %xmm1,0x58(%rcx)
movsd  0x70(%rsi),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x60(%rcx),%xmm1
movsd  %xmm1,0x60(%rcx)
movsd  0x78(%rsi),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x68(%rcx),%xmm1
movsd  %xmm1,0x68(%rcx)
movsd  0x60(%rsi,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x70(%rcx),%xmm1
movsd  %xmm1,0x70(%rcx)
movsd  0x68(%rsi,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x78(%rcx),%xmm1
movsd  %xmm1,0x78(%rcx)
sub    $0xffffffffffffff80,%rsi
sub    $0xffffffffffffff80,%rcx
add    $0x4,%edx
cmp    %r8d,%edx
jl     1120 <kernel_dgead_4_2_lib4+0x20>
mov    %edi,%r8d
and    $0xfffffffc,%r8d
lea    (%rsi,%rax,8),%rax
cmp    %edi,%r8d
jl     128e <kernel_dgead_4_2_lib4+0x18e>
jmp    145e <kernel_dgead_4_2_lib4+0x35e>
lea    (%rsi,%rax,8),%rax
xor    %r8d,%r8d
cmp    %edi,%r8d
jge    145e <kernel_dgead_4_2_lib4+0x35e>
mov    %r8d,%edx
not    %edx
add    %edi,%edx
cmp    $0x1,%edx
jbe    13f4 <kernel_dgead_4_2_lib4+0x2f4>
mov    %rdx,%rbx
shl    $0x5,%rbx
lea    (%rcx,%rbx,1),%r9
add    $0x20,%r9
lea    (%rax,%rbx,1),%r10
add    $0x10,%r10
lea    0x10(%rsi),%r11
add    %rsi,%rbx
add    $0x20,%rbx
cmp    %r10,%rcx
setb   %r10b
cmp    %r9,%rax
setb   %bpl
cmp    %rbx,%rcx
setb   %bl
cmp    %r9,%r11
setb   %r9b
test   %bpl,%r10b
jne    13f4 <kernel_dgead_4_2_lib4+0x2f4>
and    %r9b,%bl
jne    13f4 <kernel_dgead_4_2_lib4+0x2f4>
add    $0x1,%rdx
mov    %edx,%ebp
and    $0x1,%ebp
test   %rbp,%rbp
mov    $0x2,%ebx
cmovne %rbp,%rbx
sub    %rbx,%rdx
add    %edx,%r8d
mov    %rdx,%r9
shl    $0x5,%r9
lea    (%rax,%r9,1),%r10
lea    (%rsi,%r9,1),%r11
add    %rcx,%r9
movapd %xmm0,%xmm8
unpcklpd %xmm0,%xmm8
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsd  0x10(%rsi,%rbx,1),%xmm2
movsd  0x18(%rsi,%rbx,1),%xmm3
movhpd 0x30(%rsi,%rbx,1),%xmm2
movupd (%rcx,%rbx,1),%xmm1
movupd 0x10(%rcx,%rbx,1),%xmm4
movupd 0x20(%rcx,%rbx,1),%xmm6
movupd 0x30(%rcx,%rbx,1),%xmm7
movapd %xmm1,%xmm5
unpcklpd %xmm6,%xmm5
unpckhpd %xmm6,%xmm1
movapd %xmm4,%xmm6
unpcklpd %xmm7,%xmm6
unpckhpd %xmm7,%xmm4
mulpd  %xmm8,%xmm2
addpd  %xmm5,%xmm2
movhpd 0x38(%rsi,%rbx,1),%xmm3
mulpd  %xmm8,%xmm3
addpd  %xmm1,%xmm3
movupd (%rax,%rbx,1),%xmm1
movupd 0x20(%rax,%rbx,1),%xmm5
movapd %xmm1,%xmm7
unpcklpd %xmm5,%xmm7
unpckhpd %xmm5,%xmm1
mulpd  %xmm8,%xmm7
addpd  %xmm6,%xmm7
mulpd  %xmm8,%xmm1
addpd  %xmm4,%xmm1
movapd %xmm7,%xmm4
unpcklpd %xmm1,%xmm4
movapd %xmm2,%xmm5
unpcklpd %xmm3,%xmm5
movhlps %xmm7,%xmm1
movhlps %xmm2,%xmm3
movups %xmm3,0x20(%rcx,%rbx,1)
movups %xmm1,0x30(%rcx,%rbx,1)
movupd %xmm5,(%rcx,%rbx,1)
movupd %xmm4,0x10(%rcx,%rbx,1)
add    $0x40,%rbx
add    $0xfffffffffffffffe,%rdx
jne    1330 <kernel_dgead_4_2_lib4+0x230>
mov    %r10,%rax
mov    %r11,%rsi
mov    %r9,%rcx
sub    %r8d,%edi
xor    %edx,%edx
nopl   0x0(%rax)
movsd  0x10(%rsi,%rdx,1),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rcx,%rdx,1),%xmm1
movsd  %xmm1,(%rcx,%rdx,1)
movsd  0x18(%rsi,%rdx,1),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x8(%rcx,%rdx,1),%xmm1
movsd  %xmm1,0x8(%rcx,%rdx,1)
movsd  (%rax,%rdx,1),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x10(%rcx,%rdx,1),%xmm1
movsd  %xmm1,0x10(%rcx,%rdx,1)
movsd  0x8(%rax,%rdx,1),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x18(%rcx,%rdx,1),%xmm1
movsd  %xmm1,0x18(%rcx,%rdx,1)
add    $0x20,%rdx
add    $0xffffffff,%edi
jne    1400 <kernel_dgead_4_2_lib4+0x300>
pop    %rbx
pop    %rbp
ret

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

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