void kernel_align_panel_4_0_lib4(int kmax, 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] = A[0 + bs * 0];
    B[1 + bs * 0] = A[1 + bs * 0];
    B[2 + bs * 0] = A[2 + bs * 0];
    B[3 + bs * 0] = A[3 + bs * 0];
    B[0 + bs * 1] = A[0 + bs * 1];
    B[1 + bs * 1] = A[1 + bs * 1];
    B[2 + bs * 1] = A[2 + bs * 1];
    B[3 + bs * 1] = A[3 + bs * 1];
    B[0 + bs * 2] = A[0 + bs * 2];
    B[1 + bs * 2] = A[1 + bs * 2];
    B[2 + bs * 2] = A[2 + bs * 2];
    B[3 + bs * 2] = A[3 + bs * 2];
    B[0 + bs * 3] = A[0 + bs * 3];
    B[1 + bs * 3] = A[1 + bs * 3];
    B[2 + bs * 3] = A[2 + bs * 3];
    B[3 + bs * 3] = A[3 + bs * 3];
    A += 16;
    B += 16;
  }
  for (; k < kmax; k++) {
    B[0 + bs * 0] = A[0 + bs * 0];
    B[1 + bs * 0] = A[1 + bs * 0];
    B[2 + bs * 0] = A[2 + bs * 0];
    B[3 + bs * 0] = A[3 + bs * 0];
    A += 4;
    B += 4;
  }
}


x86 assembly (clang, -O0):
<kernel_align_panel_4_0_lib4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     111e <kernel_align_panel_4_0_lib4+0x1e>
jmp    1302 <kernel_align_panel_4_0_lib4+0x202>
movl   $0x4,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x3,%ecx
cmp    %ecx,%eax
jge    1285 <kernel_align_panel_4_0_lib4+0x185>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x28(%rax)
mov    -0x10(%rbp),%rax
movsd  0x30(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x30(%rax)
mov    -0x10(%rbp),%rax
movsd  0x38(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x38(%rax)
mov    -0x10(%rbp),%rax
movsd  0x40(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x40(%rax)
mov    -0x10(%rbp),%rax
movsd  0x48(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x48(%rax)
mov    -0x10(%rbp),%rax
movsd  0x50(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x50(%rax)
mov    -0x10(%rbp),%rax
movsd  0x58(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x58(%rax)
mov    -0x10(%rbp),%rax
movsd  0x60(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x60(%rax)
mov    -0x10(%rbp),%rax
movsd  0x68(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x68(%rax)
mov    -0x10(%rbp),%rax
movsd  0x70(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x70(%rax)
mov    -0x10(%rbp),%rax
movsd  0x78(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x78(%rax)
mov    -0x10(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x20(%rbp)
jmp    112c <kernel_align_panel_4_0_lib4+0x2c>
jmp    128a <kernel_align_panel_4_0_lib4+0x18a>
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1302 <kernel_align_panel_4_0_lib4+0x202>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x10(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    128a <kernel_align_panel_4_0_lib4+0x18a>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_align_panel_4_0_lib4>:
test   %edi,%edi
jle    1297 <kernel_align_panel_4_0_lib4+0x197>
xor    %eax,%eax
cmp    $0x4,%edi
jb     11d6 <kernel_align_panel_4_0_lib4+0xd6>
lea    -0x3(%rdi),%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
movsd  (%rsi),%xmm0
movsd  %xmm0,(%rdx)
movsd  0x8(%rsi),%xmm0
movsd  %xmm0,0x8(%rdx)
movsd  0x10(%rsi),%xmm0
movsd  %xmm0,0x10(%rdx)
movsd  0x18(%rsi),%xmm0
movsd  %xmm0,0x18(%rdx)
movsd  0x20(%rsi),%xmm0
movsd  %xmm0,0x20(%rdx)
movsd  0x28(%rsi),%xmm0
movsd  %xmm0,0x28(%rdx)
movsd  0x30(%rsi),%xmm0
movsd  %xmm0,0x30(%rdx)
movsd  0x38(%rsi),%xmm0
movsd  %xmm0,0x38(%rdx)
movsd  0x40(%rsi),%xmm0
movsd  %xmm0,0x40(%rdx)
movsd  0x48(%rsi),%xmm0
movsd  %xmm0,0x48(%rdx)
movsd  0x50(%rsi),%xmm0
movsd  %xmm0,0x50(%rdx)
movsd  0x58(%rsi),%xmm0
movsd  %xmm0,0x58(%rdx)
movsd  0x60(%rsi),%xmm0
movsd  %xmm0,0x60(%rdx)
movsd  0x68(%rsi),%xmm0
movsd  %xmm0,0x68(%rdx)
movsd  0x70(%rsi),%xmm0
movsd  %xmm0,0x70(%rdx)
movsd  0x78(%rsi),%xmm0
movsd  %xmm0,0x78(%rdx)
sub    $0xffffffffffffff80,%rsi
sub    $0xffffffffffffff80,%rdx
add    $0x4,%ecx
cmp    %eax,%ecx
jl     1120 <kernel_align_panel_4_0_lib4+0x20>
mov    %edi,%eax
and    $0xfffffffc,%eax
cmp    %edi,%eax
jge    1297 <kernel_align_panel_4_0_lib4+0x197>
mov    %eax,%ecx
not    %ecx
test   $0x1,%dil
je     1219 <kernel_align_panel_4_0_lib4+0x119>
movsd  (%rsi),%xmm0
movsd  %xmm0,(%rdx)
movsd  0x8(%rsi),%xmm0
movsd  %xmm0,0x8(%rdx)
movsd  0x10(%rsi),%xmm0
movsd  %xmm0,0x10(%rdx)
movsd  0x18(%rsi),%xmm0
movsd  %xmm0,0x18(%rdx)
add    $0x20,%rsi
add    $0x20,%rdx
or     $0x1,%eax
add    %edi,%ecx
je     1297 <kernel_align_panel_4_0_lib4+0x197>
sub    %eax,%edi
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%rsi,%rax,1),%xmm0
movsd  %xmm0,(%rdx,%rax,1)
movsd  0x8(%rsi,%rax,1),%xmm0
movsd  %xmm0,0x8(%rdx,%rax,1)
movsd  0x10(%rsi,%rax,1),%xmm0
movsd  %xmm0,0x10(%rdx,%rax,1)
movsd  0x18(%rsi,%rax,1),%xmm0
movsd  %xmm0,0x18(%rdx,%rax,1)
movsd  0x20(%rsi,%rax,1),%xmm0
movsd  %xmm0,0x20(%rdx,%rax,1)
movsd  0x28(%rsi,%rax,1),%xmm0
movsd  %xmm0,0x28(%rdx,%rax,1)
movsd  0x30(%rsi,%rax,1),%xmm0
movsd  %xmm0,0x30(%rdx,%rax,1)
movsd  0x38(%rsi,%rax,1),%xmm0
movsd  %xmm0,0x38(%rdx,%rax,1)
add    $0x40,%rax
add    $0xfffffffe,%edi
jne    1230 <kernel_align_panel_4_0_lib4+0x130>
ret

LLVM IR (-O0):
define void @kernel_align_panel_4_0_lib4(i32 %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store double* %1, double** %5
store double* %2, double** %6
%9 = load i32, i32* %4
%10 = icmp sle i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %3
br label %139
12: ; preds = %3
store i32 4, i32* %7
store i32 0, i32* %8
br label %13
13: ; preds = %103, %12
%14 = load i32, i32* %8
%15 = load i32, i32* %4
%16 = sub nsw i32 %15, 3
%17 = icmp slt i32 %14, %16
br i1 %17, label %18, label %106
18: ; preds = %13
%19 = load double*, double** %5
%20 = getelementptr inbounds double, double* %19, i64 0
%21 = load double, double* %20
%22 = load double*, double** %6
%23 = getelementptr inbounds double, double* %22, i64 0
store double %21, double* %23
%24 = load double*, double** %5
%25 = getelementptr inbounds double, double* %24, i64 1
%26 = load double, double* %25
%27 = load double*, double** %6
%28 = getelementptr inbounds double, double* %27, i64 1
store double %26, double* %28
%29 = load double*, double** %5
%30 = getelementptr inbounds double, double* %29, i64 2
%31 = load double, double* %30
%32 = load double*, double** %6
%33 = getelementptr inbounds double, double* %32, i64 2
store double %31, double* %33
%34 = load double*, double** %5
%35 = getelementptr inbounds double, double* %34, i64 3
%36 = load double, double* %35
%37 = load double*, double** %6
%38 = getelementptr inbounds double, double* %37, i64 3
store double %36, double* %38
%39 = load double*, double** %5
%40 = getelementptr inbounds double, double* %39, i64 4
%41 = load double, double* %40
%42 = load double*, double** %6
%43 = getelementptr inbounds double, double* %42, i64 4
store double %41, double* %43
%44 = load double*, double** %5
%45 = getelementptr inbounds double, double* %44, i64 5
%46 = load double, double* %45
%47 = load double*, double** %6
%48 = getelementptr inbounds double, double* %47, i64 5
store double %46, double* %48
%49 = load double*, double** %5
%50 = getelementptr inbounds double, double* %49, i64 6
%51 = load double, double* %50
%52 = load double*, double** %6
%53 = getelementptr inbounds double, double* %52, i64 6
store double %51, double* %53
%54 = load double*, double** %5
%55 = getelementptr inbounds double, double* %54, i64 7
%56 = load double, double* %55
%57 = load double*, double** %6
%58 = getelementptr inbounds double, double* %57, i64 7
store double %56, double* %58
%59 = load double*, double** %5
%60 = getelementptr inbounds double, double* %59, i64 8
%61 = load double, double* %60
%62 = load double*, double** %6
%63 = getelementptr inbounds double, double* %62, i64 8
store double %61, double* %63
%64 = load double*, double** %5
%65 = getelementptr inbounds double, double* %64, i64 9
%66 = load double, double* %65
%67 = load double*, double** %6
%68 = getelementptr inbounds double, double* %67, i64 9
store double %66, double* %68
%69 = load double*, double** %5
%70 = getelementptr inbounds double, double* %69, i64 10
%71 = load double, double* %70
%72 = load double*, double** %6
%73 = getelementptr inbounds double, double* %72, i64 10
store double %71, double* %73
%74 = load double*, double** %5
%75 = getelementptr inbounds double, double* %74, i64 11
%76 = load double, double* %75
%77 = load double*, double** %6
%78 = getelementptr inbounds double, double* %77, i64 11
store double %76, double* %78
%79 = load double*, double** %5
%80 = getelementptr inbounds double, double* %79, i64 12
%81 = load double, double* %80
%82 = load double*, double** %6
%83 = getelementptr inbounds double, double* %82, i64 12
store double %81, double* %83
%84 = load double*, double** %5
%85 = getelementptr inbounds double, double* %84, i64 13
%86 = load double, double* %85
%87 = load double*, double** %6
%88 = getelementptr inbounds double, double* %87, i64 13
store double %86, double* %88
%89 = load double*, double** %5
%90 = getelementptr inbounds double, double* %89, i64 14
%91 = load double, double* %90
%92 = load double*, double** %6
%93 = getelementptr inbounds double, double* %92, i64 14
store double %91, double* %93
%94 = load double*, double** %5
%95 = getelementptr inbounds double, double* %94, i64 15
%96 = load double, double* %95
%97 = load double*, double** %6
%98 = getelementptr inbounds double, double* %97, i64 15
store double %96, double* %98
%99 = load double*, double** %5
%100 = getelementptr inbounds double, double* %99, i64 16
store double* %100, double** %5
%101 = load double*, double** %6
%102 = getelementptr inbounds double, double* %101, i64 16
store double* %102, double** %6
br label %103
103: ; preds = %18
%104 = load i32, i32* %8
%105 = add nsw i32 %104, 4
store i32 %105, i32* %8
br label %13
106: ; preds = %13
br label %107
107: ; preds = %136, %106
%108 = load i32, i32* %8
%109 = load i32, i32* %4
%110 = icmp slt i32 %108, %109
br i1 %110, label %111, label %139
111: ; preds = %107
%112 = load double*, double** %5
%113 = getelementptr inbounds double, double* %112, i64 0
%114 = load double, double* %113
%115 = load double*, double** %6
%116 = getelementptr inbounds double, double* %115, i64 0
store double %114, double* %116
%117 = load double*, double** %5
%118 = getelementptr inbounds double, double* %117, i64 1
%119 = load double, double* %118
%120 = load double*, double** %6
%121 = getelementptr inbounds double, double* %120, i64 1
store double %119, double* %121
%122 = load double*, double** %5
%123 = getelementptr inbounds double, double* %122, i64 2
%124 = load double, double* %123
%125 = load double*, double** %6
%126 = getelementptr inbounds double, double* %125, i64 2
store double %124, double* %126
%127 = load double*, double** %5
%128 = getelementptr inbounds double, double* %127, i64 3
%129 = load double, double* %128
%130 = load double*, double** %6
%131 = getelementptr inbounds double, double* %130, i64 3
store double %129, double* %131
%132 = load double*, double** %5
%133 = getelementptr inbounds double, double* %132, i64 4
store double* %133, double** %5
%134 = load double*, double** %6
%135 = getelementptr inbounds double, double* %134, i64 4
store double* %135, double** %6
br label %136
136: ; preds = %111
%137 = load i32, i32* %8
%138 = add nsw i32 %137, 1
store i32 %138, i32* %8
br label %107
139: ; preds = %11, %107
ret void
}

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