#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 i;

/* Variables and functions */
int /*<<< orphan*/ assert(float *);
void copy(int N, float *d, float *d0) {
  assert(d);
  assert(d0);
  int i, j;
  for (i = 1; i <= N; i++)
    for (j = 1; j <= N; j++) {
      d[((i) + (N + 2) * (j))] = d0[((i) + (N + 2) * (j))];
    }
}


x86 assembly (clang, -O0):
<copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x18(%rbp),%rdi
call   1030 <assert@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11b2 <copy+0xa2>
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     119f <copy+0x8f>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    -0x4(%rbp),%edx
add    $0x2,%edx
imul   -0x20(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    -0x4(%rbp),%edx
add    $0x2,%edx
imul   -0x20(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114f <copy+0x3f>
jmp    11a4 <copy+0x94>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113c <copy+0x2c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1030 <assert@plt>
mov    %r14,%rdi
call   1030 <assert@plt>
test   %ebp,%ebp
jle    12ea <copy+0x1da>
mov    %ebp,%ebp
lea    0x2(%rbp),%r11
lea    0x1(%rbp),%rax
mov    %rax,0x70(%rsp)
lea    -0x1(%rbp),%rax
mov    %rax,0x68(%rsp)
mov    %ebp,%eax
and    $0x3,%eax
mov    %rax,0x10(%rsp)
lea    0x8(,%rbp,4),%rdx
lea    (%r11,%r11,2),%rax
shl    $0x4,%r11
lea    (%rbx,%r11,1),%rcx
add    $0x4,%rcx
mov    %rcx,0x60(%rsp)
mov    %r11,0x48(%rsp)
lea    0x4(%r14,%r11,1),%rcx
mov    %rcx,0x58(%rsp)
lea    0x4(%rbx,%rax,4),%rcx
mov    %rcx,0x50(%rsp)
lea    0x4(%r14,%rax,4),%rax
mov    %rax,0x40(%rsp)
lea    0xc(%r14,%rbp,4),%rax
mov    %rax,0x38(%rsp)
lea    0xc(%rbx,%rbp,4),%rax
mov    %rax,0x30(%rsp)
lea    0x14(%rbx,%rbp,8),%rax
mov    %rax,0x28(%rsp)
lea    (%r14,%rbp,8),%rax
add    $0x14,%rax
mov    %rax,0x20(%rsp)
and    $0xfffffffc,%ebp
neg    %rbp
mov    %rbp,0x78(%rsp)
add    $0x4,%rbx
add    $0x4,%r14
mov    $0x1,%eax
xor    %ecx,%ecx
mov    %rcx,0x8(%rsp)
mov    %rdx,0x18(%rsp)
mov    0x78(%rsp),%r15
mov    0x60(%rsp),%r12
mov    0x58(%rsp),%r13
mov    0x48(%rsp),%r11
mov    0x40(%rsp),%rcx
mov    0x30(%rsp),%rsi
mov    0x28(%rsp),%r8
mov    0x20(%rsp),%rdi
jmp    1245 <copy+0x135>
nopl   0x0(%rax)
mov    0x80(%rsp),%rax
add    $0x1,%rax
addq   $0x4,0x8(%rsp)
add    $0x4,%rbx
add    $0x4,%r14
cmp    0x70(%rsp),%rax
je     12ea <copy+0x1da>
mov    %rax,0x80(%rsp)
mov    $0x1,%r10d
cmpq   $0x3,0x68(%rsp)
mov    0x50(%rsp),%rax
mov    0x38(%rsp),%rdx
jb     12b6 <copy+0x1a6>
mov    $0x1,%r10d
mov    0x8(%rsp),%r9
movss  (%rdx,%r9,1),%xmm0
movss  %xmm0,(%rsi,%r9,1)
movss  (%rdi,%r9,1),%xmm0
movss  %xmm0,(%r8,%r9,1)
movss  (%rcx,%r9,1),%xmm0
movss  %xmm0,(%rax,%r9,1)
movss  0x0(%r13,%r9,1),%xmm0
movss  %xmm0,(%r12,%r9,1)
add    %r11,%r9
lea    (%r15,%r10,1),%rbp
add    $0x4,%rbp
add    $0x4,%r10
cmp    $0x1,%rbp
jne    1270 <copy+0x160>
cmpq   $0x0,0x10(%rsp)
mov    0x18(%rsp),%rdx
je     1220 <copy+0x110>
imul   %rdx,%r10
mov    0x10(%rsp),%rbp
movss  (%r14,%r10,1),%xmm0
movss  %xmm0,(%rbx,%r10,1)
add    %rdx,%r10
add    $0xffffffffffffffff,%rbp
jne    12d0 <copy+0x1c0>
jmp    1220 <copy+0x110>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @copy(i32 %0, float* %1, float* %2) {
%4 = alloca i32
%5 = alloca float*
%6 = alloca float*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store float* %1, float** %5
store float* %2, float** %6
%9 = load float*, float** %5
%10 = call i32 @assert(float* %9)
%11 = load float*, float** %6
%12 = call i32 @assert(float* %11)
store i32 1, i32* %7
br label %13
13: ; preds = %46, %3
%14 = load i32, i32* %7
%15 = load i32, i32* %4
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %49
17: ; preds = %13
store i32 1, i32* %8
br label %18
18: ; preds = %42, %17
%19 = load i32, i32* %8
%20 = load i32, i32* %4
%21 = icmp sle i32 %19, %20
br i1 %21, label %22, label %45
22: ; preds = %18
%23 = load float*, float** %6
%24 = load i32, i32* %7
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 2
%27 = load i32, i32* %8
%28 = mul nsw i32 %26, %27
%29 = add nsw i32 %24, %28
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds float, float* %23, i64 %30
%32 = load float, float* %31
%33 = load float*, float** %5
%34 = load i32, i32* %7
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 2
%37 = load i32, i32* %8
%38 = mul nsw i32 %36, %37
%39 = add nsw i32 %34, %38
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds float, float* %33, i64 %40
store float %32, float* %41
br label %42
42: ; preds = %22
%43 = load i32, i32* %8
%44 = add nsw i32 %43, 1
store i32 %44, i32* %8
br label %18
45: ; preds = %18
br label %46
46: ; preds = %45
%47 = load i32, i32* %7
%48 = add nsw i32 %47, 1
store i32 %48, i32* %7
br label %13
49: ; preds = %13
ret void
}

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