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


x86 assembly (clang, -O0):
<kernel_dgead_2_0_lib4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     1123 <kernel_dgead_2_0_lib4+0x23>
jmp    1305 <kernel_dgead_2_0_lib4+0x205>
movl   $0x4,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x3,%ecx
cmp    %ecx,%eax
jge    1289 <kernel_dgead_2_0_lib4+0x189>
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x20(%rax),%xmm2
mov    -0x20(%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  0x28(%rax),%xmm2
mov    -0x20(%rbp),%rax
movsd  0x28(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x28(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x40(%rax),%xmm2
mov    -0x20(%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  0x48(%rax),%xmm2
mov    -0x20(%rbp),%rax
movsd  0x48(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x48(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x60(%rax),%xmm2
mov    -0x20(%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  0x68(%rax),%xmm2
mov    -0x20(%rbp),%rax
movsd  0x68(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x68(%rax)
mov    -0x18(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x28(%rbp)
jmp    1131 <kernel_dgead_2_0_lib4+0x31>
jmp    128e <kernel_dgead_2_0_lib4+0x18e>
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1305 <kernel_dgead_2_0_lib4+0x205>
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    128e <kernel_dgead_2_0_lib4+0x18e>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_dgead_2_0_lib4>:
test   %edi,%edi
jle    127e <kernel_dgead_2_0_lib4+0x17e>
xor    %eax,%eax
cmp    $0x4,%edi
jb     11cd <kernel_dgead_2_0_lib4+0xcd>
lea    -0x3(%rdi),%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
movsd  (%rsi),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rdx),%xmm1
movsd  %xmm1,(%rdx)
movsd  0x8(%rsi),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x8(%rdx),%xmm1
movsd  %xmm1,0x8(%rdx)
movsd  0x20(%rsi),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x20(%rdx),%xmm1
movsd  %xmm1,0x20(%rdx)
movsd  0x28(%rsi),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x28(%rdx),%xmm1
movsd  %xmm1,0x28(%rdx)
movsd  0x40(%rsi),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x40(%rdx),%xmm1
movsd  %xmm1,0x40(%rdx)
movsd  0x48(%rsi),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x48(%rdx),%xmm1
movsd  %xmm1,0x48(%rdx)
movsd  0x60(%rsi),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x60(%rdx),%xmm1
movsd  %xmm1,0x60(%rdx)
movsd  0x68(%rsi),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x68(%rdx),%xmm1
movsd  %xmm1,0x68(%rdx)
sub    $0xffffffffffffff80,%rsi
sub    $0xffffffffffffff80,%rdx
add    $0x4,%ecx
cmp    %eax,%ecx
jl     1120 <kernel_dgead_2_0_lib4+0x20>
mov    %edi,%eax
and    $0xfffffffc,%eax
cmp    %edi,%eax
jge    127e <kernel_dgead_2_0_lib4+0x17e>
mov    %eax,%ecx
not    %ecx
test   $0x1,%dil
je     120d <kernel_dgead_2_0_lib4+0x10d>
movsd  (%rsi),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rdx),%xmm1
movsd  %xmm1,(%rdx)
movsd  0x8(%rsi),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x8(%rdx),%xmm1
movsd  %xmm1,0x8(%rdx)
add    $0x20,%rsi
add    $0x20,%rdx
or     $0x1,%eax
add    %edi,%ecx
je     127e <kernel_dgead_2_0_lib4+0x17e>
sub    %eax,%edi
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%rsi,%rax,1),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rdx,%rax,1),%xmm1
movsd  %xmm1,(%rdx,%rax,1)
movsd  0x8(%rsi,%rax,1),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x8(%rdx,%rax,1),%xmm1
movsd  %xmm1,0x8(%rdx,%rax,1)
movsd  0x20(%rsi,%rax,1),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x20(%rdx,%rax,1),%xmm1
movsd  %xmm1,0x20(%rdx,%rax,1)
movsd  0x28(%rsi,%rax,1),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x28(%rdx,%rax,1),%xmm1
movsd  %xmm1,0x28(%rdx,%rax,1)
add    $0x40,%rax
add    $0xfffffffe,%edi
jne    1220 <kernel_dgead_2_0_lib4+0x120>
ret

LLVM IR (-O0):
define void @kernel_dgead_2_0_lib4(i32 %0, double %1, double* %2, double* %3) {
%5 = alloca i32
%6 = alloca double
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store double %1, double* %6
store double* %2, double** %7
store double* %3, double** %8
%11 = load i32, i32* %5
%12 = icmp sle i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %4
br label %121
14: ; preds = %4
store i32 4, i32* %9
store i32 0, i32* %10
br label %15
15: ; preds = %89, %14
%16 = load i32, i32* %10
%17 = load i32, i32* %5
%18 = sub nsw i32 %17, 3
%19 = icmp slt i32 %16, %18
br i1 %19, label %20, label %92
20: ; preds = %15
%21 = load double, double* %6
%22 = load double*, double** %7
%23 = getelementptr inbounds double, double* %22, i64 0
%24 = load double, double* %23
%25 = load double*, double** %8
%26 = getelementptr inbounds double, double* %25, i64 0
%27 = load double, double* %26
%28 = call double @llvm.fmuladd.f64(double %21, double %24, double %27)
store double %28, double* %26
%29 = load double, double* %6
%30 = load double*, double** %7
%31 = getelementptr inbounds double, double* %30, i64 1
%32 = load double, double* %31
%33 = load double*, double** %8
%34 = getelementptr inbounds double, double* %33, i64 1
%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* %6
%38 = load double*, double** %7
%39 = getelementptr inbounds double, double* %38, i64 4
%40 = load double, double* %39
%41 = load double*, double** %8
%42 = getelementptr inbounds double, double* %41, i64 4
%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* %6
%46 = load double*, double** %7
%47 = getelementptr inbounds double, double* %46, i64 5
%48 = load double, double* %47
%49 = load double*, double** %8
%50 = getelementptr inbounds double, double* %49, i64 5
%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* %6
%54 = load double*, double** %7
%55 = getelementptr inbounds double, double* %54, i64 8
%56 = load double, double* %55
%57 = load double*, double** %8
%58 = getelementptr inbounds double, double* %57, i64 8
%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* %6
%62 = load double*, double** %7
%63 = getelementptr inbounds double, double* %62, i64 9
%64 = load double, double* %63
%65 = load double*, double** %8
%66 = getelementptr inbounds double, double* %65, i64 9
%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* %6
%70 = load double*, double** %7
%71 = getelementptr inbounds double, double* %70, i64 12
%72 = load double, double* %71
%73 = load double*, double** %8
%74 = getelementptr inbounds double, double* %73, i64 12
%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* %6
%78 = load double*, double** %7
%79 = getelementptr inbounds double, double* %78, i64 13
%80 = load double, double* %79
%81 = load double*, double** %8
%82 = getelementptr inbounds double, double* %81, i64 13
%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 = getelementptr inbounds double, double* %85, i64 16
store double* %86, double** %7
%87 = load double*, double** %8
%88 = getelementptr inbounds double, double* %87, i64 16
store double* %88, double** %8
br label %89
89: ; preds = %20
%90 = load i32, i32* %10
%91 = add nsw i32 %90, 4
store i32 %91, i32* %10
br label %15
92: ; preds = %15
br label %93
93: ; preds = %118, %92
%94 = load i32, i32* %10
%95 = load i32, i32* %5
%96 = icmp slt i32 %94, %95
br i1 %96, label %97, label %121
97: ; preds = %93
%98 = load double, double* %6
%99 = load double*, double** %7
%100 = getelementptr inbounds double, double* %99, i64 0
%101 = load double, double* %100
%102 = load double*, double** %8
%103 = getelementptr inbounds double, double* %102, i64 0
%104 = load double, double* %103
%105 = call double @llvm.fmuladd.f64(double %98, double %101, double %104)
store double %105, double* %103
%106 = load double, double* %6
%107 = load double*, double** %7
%108 = getelementptr inbounds double, double* %107, i64 1
%109 = load double, double* %108
%110 = load double*, double** %8
%111 = getelementptr inbounds double, double* %110, i64 1
%112 = load double, double* %111
%113 = call double @llvm.fmuladd.f64(double %106, double %109, double %112)
store double %113, double* %111
%114 = load double*, double** %7
%115 = getelementptr inbounds double, double* %114, i64 4
store double* %115, double** %7
%116 = load double*, double** %8
%117 = getelementptr inbounds double, double* %116, i64 4
store double* %117, double** %8
br label %118
118: ; preds = %97
%119 = load i32, i32* %10
%120 = add nsw i32 %119, 1
store i32 %120, i32* %10
br label %93
121: ; preds = %13, %93
ret void
}

LLVM IR (-O2):
define void @kernel_dgead_2_0_lib4(i32 %0, double %1, double* nocapture %2, double* nocapture %3) {
%5 = icmp slt i32 %0, 1
br i1 %5, label %110, label %6
6: ; preds = %4
%7 = add nsw i32 %0, -3
%8 = icmp ugt i32 %0, 3
br i1 %8, label %38, label %11
9: ; preds = %38
%10 = and i32 %0, -4
br label %11
11: ; preds = %9, %6
%12 = phi double* [ %3, %6 ], [ %81, %9 ]
%13 = phi double* [ %2, %6 ], [ %80, %9 ]
%14 = phi i32 [ 0, %6 ], [ %10, %9 ]
%15 = icmp slt i32 %14, %0
br i1 %15, label %16, label %110
16: ; preds = %11
%17 = xor i32 %14, -1
%18 = and i32 %0, 1
%19 = icmp eq i32 %18, 0
br i1 %19, label %32, label %20
20: ; preds = %16
%21 = load double, double* %13
%22 = load double, double* %12
%23 = tail call double @llvm.fmuladd.f64(double %1, double %21, double %22)
store double %23, double* %12
%24 = getelementptr inbounds double, double* %13, i64 1
%25 = load double, double* %24
%26 = getelementptr inbounds double, double* %12, i64 1
%27 = load double, double* %26
%28 = tail call double @llvm.fmuladd.f64(double %1, double %25, double %27)
store double %28, double* %26
%29 = getelementptr inbounds double, double* %13, i64 4
%30 = getelementptr inbounds double, double* %12, i64 4
%31 = or i32 %14, 1
br label %32
32: ; preds = %20, %16
%33 = phi i32 [ %14, %16 ], [ %31, %20 ]
%34 = phi double* [ %13, %16 ], [ %29, %20 ]
%35 = phi double* [ %12, %16 ], [ %30, %20 ]
%36 = sub i32 0, %0
%37 = icmp eq i32 %17, %36
br i1 %37, label %110, label %84
38: ; preds = %6, %38
%39 = phi i32 [ %82, %38 ], [ 0, %6 ]
%40 = phi double* [ %80, %38 ], [ %2, %6 ]
%41 = phi double* [ %81, %38 ], [ %3, %6 ]
%42 = load double, double* %40
%43 = load double, double* %41
%44 = tail call double @llvm.fmuladd.f64(double %1, double %42, double %43)
store double %44, double* %41
%45 = getelementptr inbounds double, double* %40, i64 1
%46 = load double, double* %45
%47 = getelementptr inbounds double, double* %41, i64 1
%48 = load double, double* %47
%49 = tail call double @llvm.fmuladd.f64(double %1, double %46, double %48)
store double %49, double* %47
%50 = getelementptr inbounds double, double* %40, i64 4
%51 = load double, double* %50
%52 = getelementptr inbounds double, double* %41, i64 4
%53 = load double, double* %52
%54 = tail call double @llvm.fmuladd.f64(double %1, double %51, double %53)
store double %54, double* %52
%55 = getelementptr inbounds double, double* %40, i64 5
%56 = load double, double* %55
%57 = getelementptr inbounds double, double* %41, i64 5
%58 = load double, double* %57
%59 = tail call double @llvm.fmuladd.f64(double %1, double %56, double %58)
store double %59, double* %57
%60 = getelementptr inbounds double, double* %40, i64 8
%61 = load double, double* %60
%62 = getelementptr inbounds double, double* %41, i64 8
%63 = load double, double* %62
%64 = tail call double @llvm.fmuladd.f64(double %1, double %61, double %63)
store double %64, double* %62
%65 = getelementptr inbounds double, double* %40, i64 9
%66 = load double, double* %65
%67 = getelementptr inbounds double, double* %41, i64 9
%68 = load double, double* %67
%69 = tail call double @llvm.fmuladd.f64(double %1, double %66, double %68)
store double %69, double* %67
%70 = getelementptr inbounds double, double* %40, i64 12
%71 = load double, double* %70
%72 = getelementptr inbounds double, double* %41, i64 12
%73 = load double, double* %72
%74 = tail call double @llvm.fmuladd.f64(double %1, double %71, double %73)
store double %74, double* %72
%75 = getelementptr inbounds double, double* %40, i64 13
%76 = load double, double* %75
%77 = getelementptr inbounds double, double* %41, i64 13
%78 = load double, double* %77
%79 = tail call double @llvm.fmuladd.f64(double %1, double %76, double %78)
store double %79, double* %77
%80 = getelementptr inbounds double, double* %40, i64 16
%81 = getelementptr inbounds double, double* %41, i64 16
%82 = add nuw nsw i32 %39, 4
%83 = icmp slt i32 %82, %7
br i1 %83, label %38, label %9
84: ; preds = %32, %84
%85 = phi i32 [ %108, %84 ], [ %33, %32 ]
%86 = phi double* [ %106, %84 ], [ %34, %32 ]
%87 = phi double* [ %107, %84 ], [ %35, %32 ]
%88 = load double, double* %86
%89 = load double, double* %87
%90 = tail call double @llvm.fmuladd.f64(double %1, double %88, double %89)
store double %90, double* %87
%91 = getelementptr inbounds double, double* %86, i64 1
%92 = load double, double* %91
%93 = getelementptr inbounds double, double* %87, i64 1
%94 = load double, double* %93
%95 = tail call double @llvm.fmuladd.f64(double %1, double %92, double %94)
store double %95, double* %93
%96 = getelementptr inbounds double, double* %86, i64 4
%97 = getelementptr inbounds double, double* %87, i64 4
%98 = load double, double* %96
%99 = load double, double* %97
%100 = tail call double @llvm.fmuladd.f64(double %1, double %98, double %99)
store double %100, double* %97
%101 = getelementptr inbounds double, double* %86, i64 5
%102 = load double, double* %101
%103 = getelementptr inbounds double, double* %87, i64 5
%104 = load double, double* %103
%105 = tail call double @llvm.fmuladd.f64(double %1, double %102, double %104)
store double %105, double* %103
%106 = getelementptr inbounds double, double* %86, i64 8
%107 = getelementptr inbounds double, double* %87, i64 8
%108 = add nuw nsw i32 %85, 2
%109 = icmp eq i32 %108, %0
br i1 %109, label %110, label %84
110: ; preds = %32, %84, %11, %4
ret void
}