#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_load_sd(double *);
int /*<<< orphan*/ _mm_loadu_pd(double *);
int /*<<< orphan*/ _mm_store_sd(double *, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_storeu_pd(double *, int /*<<< orphan*/);
void kernel_align_panel_3_0_lib4(int kmax, double *A, double *B) {
  if (kmax <= 0)
    return;
  const int bs = 4;
  __m128d a_0, a_1;
  int k;
  for (k = 0; k < kmax - 3; k += 4) {
    a_0 = _mm_loadu_pd(&A[0 + bs * 0]);
    a_1 = _mm_load_sd(&A[2 + bs * 0]);
    _mm_storeu_pd(&B[0 + bs * 0], a_0);
    _mm_store_sd(&B[2 + bs * 0], a_1);
    a_0 = _mm_loadu_pd(&A[0 + bs * 1]);
    a_1 = _mm_load_sd(&A[2 + bs * 1]);
    _mm_storeu_pd(&B[0 + bs * 1], a_0);
    _mm_store_sd(&B[2 + bs * 1], a_1);
    a_0 = _mm_loadu_pd(&A[0 + bs * 2]);
    a_1 = _mm_load_sd(&A[2 + bs * 2]);
    _mm_storeu_pd(&B[0 + bs * 2], a_0);
    _mm_store_sd(&B[2 + bs * 2], a_1);
    a_0 = _mm_loadu_pd(&A[0 + bs * 3]);
    a_1 = _mm_load_sd(&A[2 + bs * 3]);
    _mm_storeu_pd(&B[0 + bs * 3], a_0);
    _mm_store_sd(&B[2 + bs * 3], a_1);
    A += 16;
    B += 16;
  }
  for (; k < kmax; k++) {
    a_0 = _mm_loadu_pd(&A[0 + bs * 0]);
    a_1 = _mm_load_sd(&A[2 + bs * 0]);
    _mm_storeu_pd(&B[0 + bs * 0], a_0);
    _mm_store_sd(&B[2 + bs * 0], a_1);
    A += 4;
    B += 4;
  }
}


x86 assembly (clang, -O0):
<kernel_align_panel_3_0_lib4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     1162 <kernel_align_panel_3_0_lib4+0x22>
jmp    1312 <kernel_align_panel_3_0_lib4+0x1d2>
movl   $0x4,-0x1c(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x3,%ecx
cmp    %ecx,%eax
jge    12a3 <kernel_align_panel_3_0_lib4+0x163>
mov    -0x10(%rbp),%rdi
call   1050 <_mm_loadu_pd@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x10,%rdi
call   1030 <_mm_load_sd@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1040 <_mm_storeu_pd@plt>
mov    -0x18(%rbp),%rdi
add    $0x10,%rdi
mov    -0x24(%rbp),%esi
call   1060 <_mm_store_sd@plt>
mov    -0x10(%rbp),%rdi
add    $0x20,%rdi
call   1050 <_mm_loadu_pd@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x30,%rdi
call   1030 <_mm_load_sd@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x20,%rdi
mov    -0x20(%rbp),%esi
call   1040 <_mm_storeu_pd@plt>
mov    -0x18(%rbp),%rdi
add    $0x30,%rdi
mov    -0x24(%rbp),%esi
call   1060 <_mm_store_sd@plt>
mov    -0x10(%rbp),%rdi
add    $0x40,%rdi
call   1050 <_mm_loadu_pd@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x50,%rdi
call   1030 <_mm_load_sd@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x40,%rdi
mov    -0x20(%rbp),%esi
call   1040 <_mm_storeu_pd@plt>
mov    -0x18(%rbp),%rdi
add    $0x50,%rdi
mov    -0x24(%rbp),%esi
call   1060 <_mm_store_sd@plt>
mov    -0x10(%rbp),%rdi
add    $0x60,%rdi
call   1050 <_mm_loadu_pd@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x70,%rdi
call   1030 <_mm_load_sd@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x60,%rdi
mov    -0x20(%rbp),%esi
call   1040 <_mm_storeu_pd@plt>
mov    -0x18(%rbp),%rdi
add    $0x70,%rdi
mov    -0x24(%rbp),%esi
call   1060 <_mm_store_sd@plt>
mov    -0x10(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x28(%rbp)
jmp    1170 <kernel_align_panel_3_0_lib4+0x30>
jmp    12a8 <kernel_align_panel_3_0_lib4+0x168>
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1312 <kernel_align_panel_3_0_lib4+0x1d2>
mov    -0x10(%rbp),%rdi
call   1050 <_mm_loadu_pd@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x10,%rdi
call   1030 <_mm_load_sd@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1040 <_mm_storeu_pd@plt>
mov    -0x18(%rbp),%rdi
add    $0x10,%rdi
mov    -0x24(%rbp),%esi
call   1060 <_mm_store_sd@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    12a8 <kernel_align_panel_3_0_lib4+0x168>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_align_panel_3_0_lib4>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    129a <kernel_align_panel_3_0_lib4+0x15a>
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%r15d
xor    %r13d,%r13d
cmp    $0x4,%edi
jb     124d <kernel_align_panel_3_0_lib4+0x10d>
lea    -0x3(%r15),%eax
mov    %eax,0x4(%rsp)
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1050 <_mm_loadu_pd@plt>
mov    %eax,%ebp
lea    0x10(%rbx),%rdi
call   1030 <_mm_load_sd@plt>
mov    %eax,%r12d
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <_mm_storeu_pd@plt>
lea    0x10(%r14),%rdi
mov    %r12d,%esi
call   1060 <_mm_store_sd@plt>
lea    0x20(%rbx),%rdi
call   1050 <_mm_loadu_pd@plt>
mov    %eax,%ebp
lea    0x30(%rbx),%rdi
call   1030 <_mm_load_sd@plt>
mov    %eax,%r12d
lea    0x20(%r14),%rdi
mov    %ebp,%esi
call   1040 <_mm_storeu_pd@plt>
lea    0x30(%r14),%rdi
mov    %r12d,%esi
call   1060 <_mm_store_sd@plt>
lea    0x40(%rbx),%rdi
call   1050 <_mm_loadu_pd@plt>
mov    %eax,%ebp
lea    0x50(%rbx),%rdi
call   1030 <_mm_load_sd@plt>
mov    %eax,%r12d
lea    0x40(%r14),%rdi
mov    %ebp,%esi
call   1040 <_mm_storeu_pd@plt>
lea    0x50(%r14),%rdi
mov    %r12d,%esi
call   1060 <_mm_store_sd@plt>
lea    0x60(%rbx),%rdi
call   1050 <_mm_loadu_pd@plt>
mov    %eax,%ebp
lea    0x70(%rbx),%rdi
call   1030 <_mm_load_sd@plt>
mov    %eax,%r12d
lea    0x60(%r14),%rdi
mov    %ebp,%esi
call   1040 <_mm_storeu_pd@plt>
lea    0x70(%r14),%rdi
mov    %r12d,%esi
call   1060 <_mm_store_sd@plt>
sub    $0xffffffffffffff80,%rbx
sub    $0xffffffffffffff80,%r14
add    $0x4,%r13d
cmp    0x4(%rsp),%r13d
jl     1180 <kernel_align_panel_3_0_lib4+0x40>
cmp    %r15d,%r13d
jge    129a <kernel_align_panel_3_0_lib4+0x15a>
sub    %r13d,%r15d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1050 <_mm_loadu_pd@plt>
mov    %eax,%ebp
lea    0x10(%rbx),%rdi
call   1030 <_mm_load_sd@plt>
mov    %eax,%r12d
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <_mm_storeu_pd@plt>
lea    0x10(%r14),%rdi
mov    %r12d,%esi
call   1060 <_mm_store_sd@plt>
add    $0x20,%rbx
add    $0x20,%r14
add    $0xffffffff,%r15d
jne    1260 <kernel_align_panel_3_0_lib4+0x120>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
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
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %4
store double* %1, double** %5
store double* %2, double** %6
%11 = load i32, i32* %4
%12 = icmp sle i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %3
br label %111
14: ; preds = %3
store i32 4, i32* %7
store i32 0, i32* %10
br label %15
15: ; preds = %81, %14
%16 = load i32, i32* %10
%17 = load i32, i32* %4
%18 = sub nsw i32 %17, 3
%19 = icmp slt i32 %16, %18
br i1 %19, label %20, label %84
20: ; preds = %15
%21 = load double*, double** %5
%22 = getelementptr inbounds double, double* %21, i64 0
%23 = call i32 @_mm_loadu_pd(double* %22)
store i32 %23, i32* %8
%24 = load double*, double** %5
%25 = getelementptr inbounds double, double* %24, i64 2
%26 = call i32 @_mm_load_sd(double* %25)
store i32 %26, i32* %9
%27 = load double*, double** %6
%28 = getelementptr inbounds double, double* %27, i64 0
%29 = load i32, i32* %8
%30 = call i32 @_mm_storeu_pd(double* %28, i32 %29)
%31 = load double*, double** %6
%32 = getelementptr inbounds double, double* %31, i64 2
%33 = load i32, i32* %9
%34 = call i32 @_mm_store_sd(double* %32, i32 %33)
%35 = load double*, double** %5
%36 = getelementptr inbounds double, double* %35, i64 4
%37 = call i32 @_mm_loadu_pd(double* %36)
store i32 %37, i32* %8
%38 = load double*, double** %5
%39 = getelementptr inbounds double, double* %38, i64 6
%40 = call i32 @_mm_load_sd(double* %39)
store i32 %40, i32* %9
%41 = load double*, double** %6
%42 = getelementptr inbounds double, double* %41, i64 4
%43 = load i32, i32* %8
%44 = call i32 @_mm_storeu_pd(double* %42, i32 %43)
%45 = load double*, double** %6
%46 = getelementptr inbounds double, double* %45, i64 6
%47 = load i32, i32* %9
%48 = call i32 @_mm_store_sd(double* %46, i32 %47)
%49 = load double*, double** %5
%50 = getelementptr inbounds double, double* %49, i64 8
%51 = call i32 @_mm_loadu_pd(double* %50)
store i32 %51, i32* %8
%52 = load double*, double** %5
%53 = getelementptr inbounds double, double* %52, i64 10
%54 = call i32 @_mm_load_sd(double* %53)
store i32 %54, i32* %9
%55 = load double*, double** %6
%56 = getelementptr inbounds double, double* %55, i64 8
%57 = load i32, i32* %8
%58 = call i32 @_mm_storeu_pd(double* %56, i32 %57)
%59 = load double*, double** %6
%60 = getelementptr inbounds double, double* %59, i64 10
%61 = load i32, i32* %9
%62 = call i32 @_mm_store_sd(double* %60, i32 %61)
%63 = load double*, double** %5
%64 = getelementptr inbounds double, double* %63, i64 12
%65 = call i32 @_mm_loadu_pd(double* %64)
store i32 %65, i32* %8
%66 = load double*, double** %5
%67 = getelementptr inbounds double, double* %66, i64 14
%68 = call i32 @_mm_load_sd(double* %67)
store i32 %68, i32* %9
%69 = load double*, double** %6
%70 = getelementptr inbounds double, double* %69, i64 12
%71 = load i32, i32* %8
%72 = call i32 @_mm_storeu_pd(double* %70, i32 %71)
%73 = load double*, double** %6
%74 = getelementptr inbounds double, double* %73, i64 14
%75 = load i32, i32* %9
%76 = call i32 @_mm_store_sd(double* %74, i32 %75)
%77 = load double*, double** %5
%78 = getelementptr inbounds double, double* %77, i64 16
store double* %78, double** %5
%79 = load double*, double** %6
%80 = getelementptr inbounds double, double* %79, i64 16
store double* %80, double** %6
br label %81
81: ; preds = %20
%82 = load i32, i32* %10
%83 = add nsw i32 %82, 4
store i32 %83, i32* %10
br label %15
84: ; preds = %15
br label %85
85: ; preds = %108, %84
%86 = load i32, i32* %10
%87 = load i32, i32* %4
%88 = icmp slt i32 %86, %87
br i1 %88, label %89, label %111
89: ; preds = %85
%90 = load double*, double** %5
%91 = getelementptr inbounds double, double* %90, i64 0
%92 = call i32 @_mm_loadu_pd(double* %91)
store i32 %92, i32* %8
%93 = load double*, double** %5
%94 = getelementptr inbounds double, double* %93, i64 2
%95 = call i32 @_mm_load_sd(double* %94)
store i32 %95, i32* %9
%96 = load double*, double** %6
%97 = getelementptr inbounds double, double* %96, i64 0
%98 = load i32, i32* %8
%99 = call i32 @_mm_storeu_pd(double* %97, i32 %98)
%100 = load double*, double** %6
%101 = getelementptr inbounds double, double* %100, i64 2
%102 = load i32, i32* %9
%103 = call i32 @_mm_store_sd(double* %101, i32 %102)
%104 = load double*, double** %5
%105 = getelementptr inbounds double, double* %104, i64 4
store double* %105, double** %5
%106 = load double*, double** %6
%107 = getelementptr inbounds double, double* %106, i64 4
store double* %107, double** %6
br label %108
108: ; preds = %89
%109 = load i32, i32* %10
%110 = add nsw i32 %109, 1
store i32 %110, i32* %10
br label %85
111: ; preds = %13, %85
ret void
}

LLVM IR (-O2):
define void @kernel_align_panel_3_0_lib4(i32 %0, double* %1, double* %2) {
%4 = icmp slt i32 %0, 1
br i1 %4, label %65, label %5
5: ; preds = %3
%6 = add nsw i32 %0, -3
%7 = icmp ugt i32 %0, 3
br i1 %7, label %13, label %8
8: ; preds = %13, %5
%9 = phi double* [ %2, %5 ], [ %48, %13 ]
%10 = phi double* [ %1, %5 ], [ %47, %13 ]
%11 = phi i32 [ 0, %5 ], [ %49, %13 ]
%12 = icmp slt i32 %11, %0
br i1 %12, label %51, label %65
13: ; preds = %5, %13
%14 = phi i32 [ %49, %13 ], [ 0, %5 ]
%15 = phi double* [ %47, %13 ], [ %1, %5 ]
%16 = phi double* [ %48, %13 ], [ %2, %5 ]
%17 = tail call i32 @_mm_loadu_pd(double* %15)
%18 = getelementptr inbounds double, double* %15, i64 2
%19 = tail call i32 @_mm_load_sd(double* %18)
%20 = tail call i32 @_mm_storeu_pd(double* %16, i32 %17)
%21 = getelementptr inbounds double, double* %16, i64 2
%22 = tail call i32 @_mm_store_sd(double* %21, i32 %19)
%23 = getelementptr inbounds double, double* %15, i64 4
%24 = tail call i32 @_mm_loadu_pd(double* %23)
%25 = getelementptr inbounds double, double* %15, i64 6
%26 = tail call i32 @_mm_load_sd(double* %25)
%27 = getelementptr inbounds double, double* %16, i64 4
%28 = tail call i32 @_mm_storeu_pd(double* %27, i32 %24)
%29 = getelementptr inbounds double, double* %16, i64 6
%30 = tail call i32 @_mm_store_sd(double* %29, i32 %26)
%31 = getelementptr inbounds double, double* %15, i64 8
%32 = tail call i32 @_mm_loadu_pd(double* %31)
%33 = getelementptr inbounds double, double* %15, i64 10
%34 = tail call i32 @_mm_load_sd(double* %33)
%35 = getelementptr inbounds double, double* %16, i64 8
%36 = tail call i32 @_mm_storeu_pd(double* %35, i32 %32)
%37 = getelementptr inbounds double, double* %16, i64 10
%38 = tail call i32 @_mm_store_sd(double* %37, i32 %34)
%39 = getelementptr inbounds double, double* %15, i64 12
%40 = tail call i32 @_mm_loadu_pd(double* %39)
%41 = getelementptr inbounds double, double* %15, i64 14
%42 = tail call i32 @_mm_load_sd(double* %41)
%43 = getelementptr inbounds double, double* %16, i64 12
%44 = tail call i32 @_mm_storeu_pd(double* %43, i32 %40)
%45 = getelementptr inbounds double, double* %16, i64 14
%46 = tail call i32 @_mm_store_sd(double* %45, i32 %42)
%47 = getelementptr inbounds double, double* %15, i64 16
%48 = getelementptr inbounds double, double* %16, i64 16
%49 = add nuw nsw i32 %14, 4
%50 = icmp slt i32 %49, %6
br i1 %50, label %13, label %8
51: ; preds = %8, %51
%52 = phi i32 [ %63, %51 ], [ %11, %8 ]
%53 = phi double* [ %61, %51 ], [ %10, %8 ]
%54 = phi double* [ %62, %51 ], [ %9, %8 ]
%55 = tail call i32 @_mm_loadu_pd(double* %53)
%56 = getelementptr inbounds double, double* %53, i64 2
%57 = tail call i32 @_mm_load_sd(double* %56)
%58 = tail call i32 @_mm_storeu_pd(double* %54, i32 %55)
%59 = getelementptr inbounds double, double* %54, i64 2
%60 = tail call i32 @_mm_store_sd(double* %59, i32 %57)
%61 = getelementptr inbounds double, double* %53, i64 4
%62 = getelementptr inbounds double, double* %54, i64 4
%63 = add i32 %52, 1
%64 = icmp eq i32 %63, %0
br i1 %64, label %65, label %51
65: ; preds = %51, %8, %3
ret void
}