#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*/ printf(char *, int, int);
void arrayCopy(int fromArray[], int toArray[], int size) {
  int *dt;
  for (int x = 0; x < size; ++x) {
    dt = &fromArray[x];
    toArray[x] = *dt;
    printf("this is what the copied on array has now %d,%d\n", *dt, toArray[x]);
  }
}


x86 assembly (clang, -O0):
<arrayCopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1185 <arrayCopy+0x75>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112a <arrayCopy+0x1a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arrayCopy>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %edx,%edx
jle    114f <arrayCopy+0x3f>
mov    %rsi,%r14
mov    %rdi,%r13
mov    %edx,%r12d
xor    %ebx,%ebx
lea    0xed1(%rip),%r15
nop
mov    0x0(%r13,%rbx,4),%edx
mov    %edx,(%r14,%rbx,4)
mov    0x0(%r13,%rbx,4),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <arrayCopy+0x20>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [48 x i8] c"this is what the copied on array has now %d,%d\0A\00"
define void @arrayCopy(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
store i32 0, i32* %8
br label %9
9: ; preds = %32, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %35
13: ; preds = %9
%14 = load i32*, i32** %4
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
store i32* %17, i32** %7
%18 = load i32*, i32** %7
%19 = load i32, i32* %18
%20 = load i32*, i32** %5
%21 = load i32, i32* %8
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
store i32 %19, i32* %23
%24 = load i32*, i32** %7
%25 = load i32, i32* %24
%26 = load i32*, i32** %5
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %26, i64 %28
%30 = load i32, i32* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %25, i32 %30)
br label %32
32: ; preds = %13
%33 = load i32, i32* %8
%34 = add nsw i32 %33, 1
store i32 %34, i32* %8
br label %9
35: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"this is what the copied on array has now %d,%d\0A\00"
define void @arrayCopy(i32* nocapture %0, i32* nocapture writeonly %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %8
7: ; preds = %8, %3
ret void
8: ; preds = %5, %8
%9 = phi i64 [ 0, %5 ], [ %15, %8 ]
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = getelementptr inbounds i32, i32* %1, i64 %9
store i32 %11, i32* %12
%13 = load i32, i32* %10
%14 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %11)
%15 = add nuw nsw i64 %9, 1
%16 = icmp eq i64 %15, %6
br i1 %16, label %7, label %8
}