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


x86 assembly (clang, -O0):
<kernel_align_panel_2_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     1142 <kernel_align_panel_2_0_lib4+0x22>
jmp    1252 <kernel_align_panel_2_0_lib4+0x132>
movl   $0x4,-0x1c(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x3,%ecx
cmp    %ecx,%eax
jge    1203 <kernel_align_panel_2_0_lib4+0xe3>
mov    -0x10(%rbp),%rdi
call   1040 <_mm_loadu_pd@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1030 <_mm_storeu_pd@plt>
mov    -0x10(%rbp),%rdi
add    $0x20,%rdi
call   1040 <_mm_loadu_pd@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x20,%rdi
mov    -0x20(%rbp),%esi
call   1030 <_mm_storeu_pd@plt>
mov    -0x10(%rbp),%rdi
add    $0x40,%rdi
call   1040 <_mm_loadu_pd@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x40,%rdi
mov    -0x20(%rbp),%esi
call   1030 <_mm_storeu_pd@plt>
mov    -0x10(%rbp),%rdi
add    $0x60,%rdi
call   1040 <_mm_loadu_pd@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x60,%rdi
mov    -0x20(%rbp),%esi
call   1030 <_mm_storeu_pd@plt>
mov    -0x10(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x18(%rbp)
mov    -0x24(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x24(%rbp)
jmp    1150 <kernel_align_panel_2_0_lib4+0x30>
jmp    1208 <kernel_align_panel_2_0_lib4+0xe8>
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1252 <kernel_align_panel_2_0_lib4+0x132>
mov    -0x10(%rbp),%rdi
call   1040 <_mm_loadu_pd@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1030 <_mm_storeu_pd@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x18(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1208 <kernel_align_panel_2_0_lib4+0xe8>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_align_panel_2_0_lib4>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
jle    11e0 <kernel_align_panel_2_0_lib4+0xc0>
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%r15d
xor    %ebp,%ebp
cmp    $0x4,%edi
jb     11ae <kernel_align_panel_2_0_lib4+0x8e>
lea    -0x3(%r15),%r12d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <_mm_loadu_pd@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <_mm_storeu_pd@plt>
lea    0x20(%rbx),%rdi
call   1040 <_mm_loadu_pd@plt>
lea    0x20(%r14),%rdi
mov    %eax,%esi
call   1030 <_mm_storeu_pd@plt>
lea    0x40(%rbx),%rdi
call   1040 <_mm_loadu_pd@plt>
lea    0x40(%r14),%rdi
mov    %eax,%esi
call   1030 <_mm_storeu_pd@plt>
lea    0x60(%rbx),%rdi
call   1040 <_mm_loadu_pd@plt>
lea    0x60(%r14),%rdi
mov    %eax,%esi
call   1030 <_mm_storeu_pd@plt>
sub    $0xffffffffffffff80,%rbx
sub    $0xffffffffffffff80,%r14
add    $0x4,%ebp
cmp    %r12d,%ebp
jl     1150 <kernel_align_panel_2_0_lib4+0x30>
cmp    %r15d,%ebp
jge    11e0 <kernel_align_panel_2_0_lib4+0xc0>
sub    %ebp,%r15d
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <_mm_loadu_pd@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <_mm_storeu_pd@plt>
add    $0x20,%rbx
add    $0x20,%r14
add    $0xffffffff,%r15d
jne    11c0 <kernel_align_panel_2_0_lib4+0xa0>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @kernel_align_panel_2_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
store i32 %0, i32* %4
store double* %1, double** %5
store double* %2, double** %6
%10 = load i32, i32* %4
%11 = icmp sle i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %3
br label %75
13: ; preds = %3
store i32 4, i32* %7
store i32 0, i32* %9
br label %14
14: ; preds = %52, %13
%15 = load i32, i32* %9
%16 = load i32, i32* %4
%17 = sub nsw i32 %16, 3
%18 = icmp slt i32 %15, %17
br i1 %18, label %19, label %55
19: ; preds = %14
%20 = load double*, double** %5
%21 = getelementptr inbounds double, double* %20, i64 0
%22 = call i32 @_mm_loadu_pd(double* %21)
store i32 %22, i32* %8
%23 = load double*, double** %6
%24 = getelementptr inbounds double, double* %23, i64 0
%25 = load i32, i32* %8
%26 = call i32 @_mm_storeu_pd(double* %24, i32 %25)
%27 = load double*, double** %5
%28 = getelementptr inbounds double, double* %27, i64 4
%29 = call i32 @_mm_loadu_pd(double* %28)
store i32 %29, i32* %8
%30 = load double*, double** %6
%31 = getelementptr inbounds double, double* %30, i64 4
%32 = load i32, i32* %8
%33 = call i32 @_mm_storeu_pd(double* %31, i32 %32)
%34 = load double*, double** %5
%35 = getelementptr inbounds double, double* %34, i64 8
%36 = call i32 @_mm_loadu_pd(double* %35)
store i32 %36, i32* %8
%37 = load double*, double** %6
%38 = getelementptr inbounds double, double* %37, i64 8
%39 = load i32, i32* %8
%40 = call i32 @_mm_storeu_pd(double* %38, i32 %39)
%41 = load double*, double** %5
%42 = getelementptr inbounds double, double* %41, i64 12
%43 = call i32 @_mm_loadu_pd(double* %42)
store i32 %43, i32* %8
%44 = load double*, double** %6
%45 = getelementptr inbounds double, double* %44, i64 12
%46 = load i32, i32* %8
%47 = call i32 @_mm_storeu_pd(double* %45, i32 %46)
%48 = load double*, double** %5
%49 = getelementptr inbounds double, double* %48, i64 16
store double* %49, double** %5
%50 = load double*, double** %6
%51 = getelementptr inbounds double, double* %50, i64 16
store double* %51, double** %6
br label %52
52: ; preds = %19
%53 = load i32, i32* %9
%54 = add nsw i32 %53, 4
store i32 %54, i32* %9
br label %14
55: ; preds = %14
br label %56
56: ; preds = %72, %55
%57 = load i32, i32* %9
%58 = load i32, i32* %4
%59 = icmp slt i32 %57, %58
br i1 %59, label %60, label %75
60: ; preds = %56
%61 = load double*, double** %5
%62 = getelementptr inbounds double, double* %61, i64 0
%63 = call i32 @_mm_loadu_pd(double* %62)
store i32 %63, i32* %8
%64 = load double*, double** %6
%65 = getelementptr inbounds double, double* %64, i64 0
%66 = load i32, i32* %8
%67 = call i32 @_mm_storeu_pd(double* %65, i32 %66)
%68 = load double*, double** %5
%69 = getelementptr inbounds double, double* %68, i64 4
store double* %69, double** %5
%70 = load double*, double** %6
%71 = getelementptr inbounds double, double* %70, i64 4
store double* %71, double** %6
br label %72
72: ; preds = %60
%73 = load i32, i32* %9
%74 = add nsw i32 %73, 1
store i32 %74, i32* %9
br label %56
75: ; preds = %12, %56
ret void
}

LLVM IR (-O2):
define void @kernel_align_panel_2_0_lib4(i32 %0, double* %1, double* %2) {
%4 = icmp slt i32 %0, 1
br i1 %4, label %45, 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 ], [ %32, %13 ]
%10 = phi double* [ %1, %5 ], [ %31, %13 ]
%11 = phi i32 [ 0, %5 ], [ %33, %13 ]
%12 = icmp slt i32 %11, %0
br i1 %12, label %35, label %45
13: ; preds = %5, %13
%14 = phi i32 [ %33, %13 ], [ 0, %5 ]
%15 = phi double* [ %31, %13 ], [ %1, %5 ]
%16 = phi double* [ %32, %13 ], [ %2, %5 ]
%17 = tail call i32 @_mm_loadu_pd(double* %15)
%18 = tail call i32 @_mm_storeu_pd(double* %16, i32 %17)
%19 = getelementptr inbounds double, double* %15, i64 4
%20 = tail call i32 @_mm_loadu_pd(double* %19)
%21 = getelementptr inbounds double, double* %16, i64 4
%22 = tail call i32 @_mm_storeu_pd(double* %21, i32 %20)
%23 = getelementptr inbounds double, double* %15, i64 8
%24 = tail call i32 @_mm_loadu_pd(double* %23)
%25 = getelementptr inbounds double, double* %16, i64 8
%26 = tail call i32 @_mm_storeu_pd(double* %25, i32 %24)
%27 = getelementptr inbounds double, double* %15, i64 12
%28 = tail call i32 @_mm_loadu_pd(double* %27)
%29 = getelementptr inbounds double, double* %16, i64 12
%30 = tail call i32 @_mm_storeu_pd(double* %29, i32 %28)
%31 = getelementptr inbounds double, double* %15, i64 16
%32 = getelementptr inbounds double, double* %16, i64 16
%33 = add nuw nsw i32 %14, 4
%34 = icmp slt i32 %33, %6
br i1 %34, label %13, label %8
35: ; preds = %8, %35
%36 = phi i32 [ %43, %35 ], [ %11, %8 ]
%37 = phi double* [ %41, %35 ], [ %10, %8 ]
%38 = phi double* [ %42, %35 ], [ %9, %8 ]
%39 = tail call i32 @_mm_loadu_pd(double* %37)
%40 = tail call i32 @_mm_storeu_pd(double* %38, i32 %39)
%41 = getelementptr inbounds double, double* %37, i64 4
%42 = getelementptr inbounds double, double* %38, i64 4
%43 = add i32 %36, 1
%44 = icmp eq i32 %43, %0
br i1 %44, label %45, label %35
45: ; preds = %35, %8, %3
ret void
}