#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*/ y;
typedef int /*<<< orphan*/ x;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, ...);
int sameArray(int x[], int y[], int length) {
  printf("Size of x: %d", sizeof(x));
  if (sizeof(x) / sizeof(*x) != sizeof(y) / sizeof(*x)) {
    return -2;
  }
  int i;
  for (i = 0; i < length; i++) {
    printf("\nx at i: %d\ny at i: %d", x[i], y[i]);
    if (x[i] != y[i]) {
      return i + 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<sameArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
lea    0xed6(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11aa <sameArray+0x9a>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
je     1197 <sameArray+0x87>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11b1 <sameArray+0xa1>
jmp    119c <sameArray+0x8c>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    113d <sameArray+0x2d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sameArray>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xed9(%rip),%rdi
xor    %ebx,%ebx
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebp,%ebp
jle    117c <sameArray+0x6c>
mov    %ebp,%ebp
lea    0xecc(%rip),%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r15,%rbx,4),%esi
mov    (%r14,%rbx,4),%edx
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r15,%rbx,4),%eax
cmp    (%r14,%rbx,4),%eax
jne    1179 <sameArray+0x69>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1150 <sameArray+0x40>
xor    %ebx,%ebx
jmp    117c <sameArray+0x6c>
add    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Size of x: %d\00"
@.str.1 = [23 x i8] c"\0Ax at i: %d\0Ay at i: %d\00"
define i32 @sameArray(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** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 8)
store i32 0, i32* %8
br label %10
10: ; preds = %41, %3
%11 = load i32, i32* %8
%12 = load i32, i32* %7
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %44
14: ; preds = %10
%15 = load i32*, i32** %5
%16 = load i32, i32* %8
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %15, i64 %17
%19 = load i32, i32* %18
%20 = load i32*, i32** %6
%21 = load i32, i32* %8
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
%24 = load i32, i32* %23
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %19, 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 = load i32*, i32** %6
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %31, i64 %33
%35 = load i32, i32* %34
%36 = icmp ne i32 %30, %35
br i1 %36, label %37, label %40
37: ; preds = %14
%38 = load i32, i32* %8
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %45
40: ; preds = %14
br label %41
41: ; preds = %40
%42 = load i32, i32* %8
%43 = add nsw i32 %42, 1
store i32 %43, i32* %8
br label %10
44: ; preds = %10
store i32 0, i32* %4
br label %45
45: ; preds = %44, %37
%46 = load i32, i32* %4
ret i32 %46
}

LLVM IR (-O2):
@.str = [14 x i8] c"Size of x: %d\00"
@.str.1 = [23 x i8] c"\0Ax at i: %d\0Ay at i: %d\00"
define i32 @sameArray(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 8)
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %24
6: ; preds = %3
%7 = zext i32 %2 to i64
br label %8
8: ; preds = %6, %21
%9 = phi i64 [ 0, %6 ], [ %22, %21 ]
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = getelementptr inbounds i32, i32* %1, i64 %9
%13 = load i32, i32* %12
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %13)
%15 = load i32, i32* %10
%16 = load i32, i32* %12
%17 = icmp eq i32 %15, %16
br i1 %17, label %21, label %18
18: ; preds = %8
%19 = trunc i64 %9 to i32
%20 = add nuw nsw i32 %19, 1
br label %24
21: ; preds = %8
%22 = add nuw nsw i64 %9, 1
%23 = icmp eq i64 %22, %7
br i1 %23, label %24, label %8
24: ; preds = %21, %3, %18
%25 = phi i32 [ %20, %18 ], [ 0, %3 ], [ 0, %21 ]
ret i32 %25
}