#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*/ abort();
int main(void) {
  int i;
  int x[100000];
  for (i = 0; i < 10000; i++)
    x[i] = x[i + 10000];
  for (i = 0; i < 10000; i++) {
    if (x[i] != x[i + 10000])
      abort();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x61a90,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x2710,-0x8(%rbp)
jge    1160 <main+0x50>
mov    -0x8(%rbp),%eax
add    $0x2710,%eax
cltq
mov    -0x61a90(%rbp,%rax,4),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x61a90(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <main+0x19>
movl   $0x0,-0x8(%rbp)
cmpl   $0x2710,-0x8(%rbp)
jge    11b2 <main+0xa2>
movslq -0x8(%rbp),%rax
mov    -0x61a90(%rbp,%rax,4),%eax
mov    -0x8(%rbp),%ecx
add    $0x2710,%ecx
movslq %ecx,%rcx
cmp    -0x61a90(%rbp,%rcx,4),%eax
je     119f <main+0x8f>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    11a4 <main+0x94>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1167 <main+0x57>
xor    %eax,%eax
add    $0x61a90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x61a88,%rsp
mov    $0xffffffffffffd8f0,%rax
xchg   %ax,%ax
mov    0x9c40(%rsp,%rax,4),%ecx
cmp    0x13880(%rsp,%rax,4),%ecx
jne    1170 <main+0x60>
mov    0x9c44(%rsp,%rax,4),%ecx
cmp    0x13884(%rsp,%rax,4),%ecx
jne    1170 <main+0x60>
mov    0x9c48(%rsp,%rax,4),%ecx
cmp    0x13888(%rsp,%rax,4),%ecx
jne    1170 <main+0x60>
mov    0x9c4c(%rsp,%rax,4),%ecx
cmp    0x1388c(%rsp,%rax,4),%ecx
jne    1170 <main+0x60>
add    $0x4,%rax
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x61a88,%rsp
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100000 x i32]
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %16, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 10000
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 10000
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [100000 x i32], [100000 x i32]* %3, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [100000 x i32], [100000 x i32]* %3, i64 0, i64 %14
store i32 %12, i32* %15
br label %16
16: ; preds = %7
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %4
19: ; preds = %4
store i32 0, i32* %2
br label %20
20: ; preds = %37, %19
%21 = load i32, i32* %2
%22 = icmp slt i32 %21, 10000
br i1 %22, label %23, label %40
23: ; preds = %20
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [100000 x i32], [100000 x i32]* %3, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 10000
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [100000 x i32], [100000 x i32]* %3, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = icmp ne i32 %27, %32
br i1 %33, label %34, label %36
34: ; preds = %23
%35 = call i32 (...) @abort()
unreachable
36: ; preds = %23
br label %37
37: ; preds = %36
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 1
store i32 %39, i32* %2
br label %20
40: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [100000 x i32]
%2 = bitcast [100000 x i32]* %1 to i8*
br label %30
3: ; preds = %30
%4 = or i64 %31, 1
%5 = getelementptr inbounds [100000 x i32], [100000 x i32]* %1, i64 0, i64 %4
%6 = load i32, i32* %5
%7 = add nuw nsw i64 %31, 10001
%8 = getelementptr inbounds [100000 x i32], [100000 x i32]* %1, i64 0, i64 %7
%9 = load i32, i32* %8
%10 = icmp eq i32 %6, %9
br i1 %10, label %11, label %38
11: ; preds = %3
%12 = or i64 %31, 2
%13 = getelementptr inbounds [100000 x i32], [100000 x i32]* %1, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = add nuw nsw i64 %31, 10002
%16 = getelementptr inbounds [100000 x i32], [100000 x i32]* %1, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = icmp eq i32 %14, %17
br i1 %18, label %19, label %38
19: ; preds = %11
%20 = or i64 %31, 3
%21 = getelementptr inbounds [100000 x i32], [100000 x i32]* %1, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = add nuw nsw i64 %31, 10003
%24 = getelementptr inbounds [100000 x i32], [100000 x i32]* %1, i64 0, i64 %23
%25 = load i32, i32* %24
%26 = icmp eq i32 %22, %25
br i1 %26, label %27, label %38
27: ; preds = %19
%28 = add nuw nsw i64 %31, 4
%29 = icmp eq i64 %28, 10000
br i1 %29, label %40, label %30
30: ; preds = %27, %0
%31 = phi i64 [ 0, %0 ], [ %28, %27 ]
%32 = getelementptr inbounds [100000 x i32], [100000 x i32]* %1, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = add nuw nsw i64 %31, 10000
%35 = getelementptr inbounds [100000 x i32], [100000 x i32]* %1, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = icmp eq i32 %33, %36
br i1 %37, label %3, label %38
38: ; preds = %19, %11, %3, %30
%39 = tail call i32 (...) @abort()
unreachable
40: ; preds = %27
ret i32 0
}