#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 */

/* Variables and functions */
int /*<<< orphan*/ array_copy(int *, int *, int);
int /*<<< orphan*/ print_array(int *, int);
int /*<<< orphan*/ reset_array(int *, int);
int main() {
  int a[5];
  int b[5];
  int *c;
  int *d;
  int i;
  c = a;
  d = b;
  for (i = 0; i < 5; i++) {
    a[i] = i;
  }
  reset_array(b, 5);
  for (i = 0; i < 5; i++) {
    b[i] = a[i];
  }
  print_array(b, 5);
  reset_array(b, 5);
  for (i = 0; i < 5; i++) {
    d[i] = c[i];
  }
  print_array(b, 5);
  reset_array(b, 5);
  for (i = 0; i < 5; i++) {
    b[i] = c[i];
  }
  print_array(d, 5);
  reset_array(b, 5);
  array_copy(b, a, 5);
  print_array(b, 5);
  reset_array(b, 5);
  array_copy(d, c, 5);
  print_array(b, 5);
  reset_array(b, 5);
  array_copy(d, a, 5);
  print_array(b, 5);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
cmpl   $0x5,-0x54(%rbp)
jge    1179 <main+0x49>
mov    -0x54(%rbp),%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x20(%rbp,%rax,4)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1156 <main+0x26>
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
call   1030 <reset_array@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0x5,-0x54(%rbp)
jge    11b6 <main+0x86>
movslq -0x54(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    118e <main+0x5e>
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
call   1030 <reset_array@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0x5,-0x54(%rbp)
jge    1207 <main+0xd7>
mov    -0x48(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x50(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11d9 <main+0xa9>
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
call   1030 <reset_array@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0x5,-0x54(%rbp)
jge    1255 <main+0x125>
mov    -0x48(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    122a <main+0xfa>
mov    -0x50(%rbp),%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
call   1030 <reset_array@plt>
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x5,%edx
call   1050 <array_copy@plt>
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
call   1030 <reset_array@plt>
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    $0x5,%edx
call   1050 <array_copy@plt>
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
call   1030 <reset_array@plt>
mov    -0x50(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x5,%edx
call   1050 <array_copy@plt>
lea    -0x40(%rbp),%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movaps 0xec2(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x4,0x10(%rsp)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <reset_array@plt>
movaps (%rsp),%xmm0
movaps %xmm0,0x20(%rsp)
mov    0x10(%rsp),%eax
mov    %eax,0x30(%rsp)
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <reset_array@plt>
movaps (%rsp),%xmm0
movaps %xmm0,0x20(%rsp)
mov    0x10(%rsp),%eax
mov    %eax,0x30(%rsp)
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <reset_array@plt>
movaps (%rsp),%xmm0
movaps %xmm0,0x20(%rsp)
mov    0x10(%rsp),%eax
mov    %eax,0x30(%rsp)
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <reset_array@plt>
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
call   1050 <array_copy@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <reset_array@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
call   1050 <array_copy@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <reset_array@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
call   1050 <array_copy@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <print_array@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca [5 x i32]
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
store i32 0, i32* %1
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
store i32* %7, i32** %4
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
store i32* %8, i32** %5
store i32 0, i32* %6
br label %9
9: ; preds = %17, %0
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 5
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = load i32, i32* %6
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %15
store i32 %13, i32* %16
br label %17
17: ; preds = %12
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
br label %9
20: ; preds = %9
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%22 = call i32 @reset_array(i32* %21, i32 5)
store i32 0, i32* %6
br label %23
23: ; preds = %34, %20
%24 = load i32, i32* %6
%25 = icmp slt i32 %24, 5
br i1 %25, label %26, label %37
26: ; preds = %23
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 %32
store i32 %30, i32* %33
br label %34
34: ; preds = %26
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %23
37: ; preds = %23
%38 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%39 = call i32 @print_array(i32* %38, i32 5)
%40 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%41 = call i32 @reset_array(i32* %40, i32 5)
store i32 0, i32* %6
br label %42
42: ; preds = %55, %37
%43 = load i32, i32* %6
%44 = icmp slt i32 %43, 5
br i1 %44, label %45, label %58
45: ; preds = %42
%46 = load i32*, i32** %4
%47 = load i32, i32* %6
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i32, i32* %46, i64 %48
%50 = load i32, i32* %49
%51 = load i32*, i32** %5
%52 = load i32, i32* %6
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i32, i32* %51, i64 %53
store i32 %50, i32* %54
br label %55
55: ; preds = %45
%56 = load i32, i32* %6
%57 = add nsw i32 %56, 1
store i32 %57, i32* %6
br label %42
58: ; preds = %42
%59 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%60 = call i32 @print_array(i32* %59, i32 5)
%61 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%62 = call i32 @reset_array(i32* %61, i32 5)
store i32 0, i32* %6
br label %63
63: ; preds = %75, %58
%64 = load i32, i32* %6
%65 = icmp slt i32 %64, 5
br i1 %65, label %66, label %78
66: ; preds = %63
%67 = load i32*, i32** %4
%68 = load i32, i32* %6
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i32, i32* %67, i64 %69
%71 = load i32, i32* %70
%72 = load i32, i32* %6
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 %73
store i32 %71, i32* %74
br label %75
75: ; preds = %66
%76 = load i32, i32* %6
%77 = add nsw i32 %76, 1
store i32 %77, i32* %6
br label %63
78: ; preds = %63
%79 = load i32*, i32** %5
%80 = call i32 @print_array(i32* %79, i32 5)
%81 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%82 = call i32 @reset_array(i32* %81, i32 5)
%83 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%84 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%85 = call i32 @array_copy(i32* %83, i32* %84, i32 5)
%86 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%87 = call i32 @print_array(i32* %86, i32 5)
%88 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%89 = call i32 @reset_array(i32* %88, i32 5)
%90 = load i32*, i32** %5
%91 = load i32*, i32** %4
%92 = call i32 @array_copy(i32* %90, i32* %91, i32 5)
%93 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%94 = call i32 @print_array(i32* %93, i32 5)
%95 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%96 = call i32 @reset_array(i32* %95, i32 5)
%97 = load i32*, i32** %5
%98 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%99 = call i32 @array_copy(i32* %97, i32* %98, i32 5)
%100 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%101 = call i32 @print_array(i32* %100, i32 5)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = alloca [5 x i32]
%4 = bitcast [5 x i32]* %3 to i8*
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%6 = bitcast [5 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 2, i32 3>, <4 x i32>* %6
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
store i32 4, i32* %7
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%9 = call i32 @reset_array(i32* %8, i32 5)
%10 = call i32 @print_array(i32* %8, i32 5)
%11 = call i32 @reset_array(i32* %8, i32 5)
%12 = call i32 @print_array(i32* %8, i32 5)
%13 = call i32 @reset_array(i32* %8, i32 5)
%14 = call i32 @print_array(i32* %8, i32 5)
%15 = call i32 @reset_array(i32* %8, i32 5)
%16 = call i32 @array_copy(i32* %8, i32* %5, i32 5)
%17 = call i32 @print_array(i32* %8, i32 5)
%18 = call i32 @reset_array(i32* %8, i32 5)
%19 = call i32 @array_copy(i32* %8, i32* %5, i32 5)
%20 = call i32 @print_array(i32* %8, i32 5)
%21 = call i32 @reset_array(i32* %8, i32 5)
%22 = call i32 @array_copy(i32* %8, i32* %5, i32 5)
%23 = call i32 @print_array(i32* %8, i32 5)
ret i32 0
}