void kernel_align_panel_3_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[0 + bs * 1] = A[0 + bs * 1];
    B[1 + bs * 1] = A[1 + bs * 1];
    B[2 + bs * 1] = A[2 + 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[0 + bs * 3] = A[0 + bs * 3];
    B[1 + bs * 3] = A[1 + bs * 3];
    B[2 + bs * 3] = A[2 + 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];
    A += 4;
    B += 4;
  }
}


x86 assembly (clang, -O0):
<kernel_align_panel_3_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_3_0_lib4+0x1e>
jmp    12a8 <kernel_align_panel_3_0_lib4+0x1a8>
movl   $0x4,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x3,%ecx
cmp    %ecx,%eax
jge    123d <kernel_align_panel_3_0_lib4+0x13d>
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  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  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  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
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_3_0_lib4+0x2c>
jmp    1242 <kernel_align_panel_3_0_lib4+0x142>
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    12a8 <kernel_align_panel_3_0_lib4+0x1a8>
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
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    1242 <kernel_align_panel_3_0_lib4+0x142>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_align_panel_3_0_lib4>:
test   %edi,%edi
jle    123f <kernel_align_panel_3_0_lib4+0x13f>
xor    %eax,%eax
cmp    $0x4,%edi
jb     11ae <kernel_align_panel_3_0_lib4+0xae>
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  0x20(%rsi),%xmm0
movsd  %xmm0,0x20(%rdx)
movsd  0x28(%rsi),%xmm0
movsd  %xmm0,0x28(%rdx)
movsd  0x30(%rsi),%xmm0
movsd  %xmm0,0x30(%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  0x60(%rsi),%xmm0
movsd  %xmm0,0x60(%rdx)
movsd  0x68(%rsi),%xmm0
movsd  %xmm0,0x68(%rdx)
movsd  0x70(%rsi),%xmm0
movsd  %xmm0,0x70(%rdx)
sub    $0xffffffffffffff80,%rsi
sub    $0xffffffffffffff80,%rdx
add    $0x4,%ecx
cmp    %eax,%ecx
jl     1120 <kernel_align_panel_3_0_lib4+0x20>
mov    %edi,%eax
and    $0xfffffffc,%eax
cmp    %edi,%eax
jge    123f <kernel_align_panel_3_0_lib4+0x13f>
mov    %eax,%ecx
not    %ecx
test   $0x1,%dil
je     11e7 <kernel_align_panel_3_0_lib4+0xe7>
movsd  (%rsi),%xmm0
movsd  %xmm0,(%rdx)
movsd  0x8(%rsi),%xmm0
movsd  %xmm0,0x8(%rdx)
movsd  0x10(%rsi),%xmm0
movsd  %xmm0,0x10(%rdx)
add    $0x20,%rsi
add    $0x20,%rdx
or     $0x1,%eax
add    %edi,%ecx
je     123f <kernel_align_panel_3_0_lib4+0x13f>
sub    %eax,%edi
xor    %eax,%eax
nop
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  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)
add    $0x40,%rax
add    $0xfffffffe,%edi
jne    11f0 <kernel_align_panel_3_0_lib4+0xf0>
ret

LLVM IR (-O0):
define void @kernel_align_panel_3_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 %114
12: ; preds = %3
store i32 4, i32* %7
store i32 0, i32* %8
br label %13
13: ; preds = %83, %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 %86
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 4
%36 = load double, double* %35
%37 = load double*, double** %6
%38 = getelementptr inbounds double, double* %37, i64 4
store double %36, double* %38
%39 = load double*, double** %5
%40 = getelementptr inbounds double, double* %39, i64 5
%41 = load double, double* %40
%42 = load double*, double** %6
%43 = getelementptr inbounds double, double* %42, i64 5
store double %41, double* %43
%44 = load double*, double** %5
%45 = getelementptr inbounds double, double* %44, i64 6
%46 = load double, double* %45
%47 = load double*, double** %6
%48 = getelementptr inbounds double, double* %47, i64 6
store double %46, double* %48
%49 = load double*, double** %5
%50 = getelementptr inbounds double, double* %49, i64 8
%51 = load double, double* %50
%52 = load double*, double** %6
%53 = getelementptr inbounds double, double* %52, i64 8
store double %51, double* %53
%54 = load double*, double** %5
%55 = getelementptr inbounds double, double* %54, i64 9
%56 = load double, double* %55
%57 = load double*, double** %6
%58 = getelementptr inbounds double, double* %57, i64 9
store double %56, double* %58
%59 = load double*, double** %5
%60 = getelementptr inbounds double, double* %59, i64 10
%61 = load double, double* %60
%62 = load double*, double** %6
%63 = getelementptr inbounds double, double* %62, i64 10
store double %61, double* %63
%64 = load double*, double** %5
%65 = getelementptr inbounds double, double* %64, i64 12
%66 = load double, double* %65
%67 = load double*, double** %6
%68 = getelementptr inbounds double, double* %67, i64 12
store double %66, double* %68
%69 = load double*, double** %5
%70 = getelementptr inbounds double, double* %69, i64 13
%71 = load double, double* %70
%72 = load double*, double** %6
%73 = getelementptr inbounds double, double* %72, i64 13
store double %71, double* %73
%74 = load double*, double** %5
%75 = getelementptr inbounds double, double* %74, i64 14
%76 = load double, double* %75
%77 = load double*, double** %6
%78 = getelementptr inbounds double, double* %77, i64 14
store double %76, double* %78
%79 = load double*, double** %5
%80 = getelementptr inbounds double, double* %79, i64 16
store double* %80, double** %5
%81 = load double*, double** %6
%82 = getelementptr inbounds double, double* %81, i64 16
store double* %82, double** %6
br label %83
83: ; preds = %18
%84 = load i32, i32* %8
%85 = add nsw i32 %84, 4
store i32 %85, i32* %8
br label %13
86: ; preds = %13
br label %87
87: ; preds = %111, %86
%88 = load i32, i32* %8
%89 = load i32, i32* %4
%90 = icmp slt i32 %88, %89
br i1 %90, label %91, label %114
91: ; preds = %87
%92 = load double*, double** %5
%93 = getelementptr inbounds double, double* %92, i64 0
%94 = load double, double* %93
%95 = load double*, double** %6
%96 = getelementptr inbounds double, double* %95, i64 0
store double %94, double* %96
%97 = load double*, double** %5
%98 = getelementptr inbounds double, double* %97, i64 1
%99 = load double, double* %98
%100 = load double*, double** %6
%101 = getelementptr inbounds double, double* %100, i64 1
store double %99, double* %101
%102 = load double*, double** %5
%103 = getelementptr inbounds double, double* %102, i64 2
%104 = load double, double* %103
%105 = load double*, double** %6
%106 = getelementptr inbounds double, double* %105, i64 2
store double %104, double* %106
%107 = load double*, double** %5
%108 = getelementptr inbounds double, double* %107, i64 4
store double* %108, double** %5
%109 = load double*, double** %6
%110 = getelementptr inbounds double, double* %109, i64 4
store double* %110, double** %6
br label %111
111: ; preds = %91
%112 = load i32, i32* %8
%113 = add nsw i32 %112, 1
store i32 %113, i32* %8
br label %87
114: ; preds = %11, %87
ret void
}

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