#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 /*<<< orphan*/ check_vect();
int /*<<< orphan*/ with_restrict(int *);
int /*<<< orphan*/ without_restrict(int *);
int main(void) {
  int i;
  int a[1002];
  int b[1002];
  check_vect();
  for (i = 0; i < 1002; ++i) {
    a[i] = b[i] = i;
  }
  with_restrict(a + 1);
  without_restrict(b + 1);
  for (i = 0; i < 1002; ++i) {
    if (a[i] != b[i])
      abort();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f60,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <check_vect@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3ea,-0x8(%rbp)
jge    1194 <main+0x54>
mov    -0x8(%rbp),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x1f60(%rbp,%rax,4)
movslq -0x8(%rbp),%rax
mov    %ecx,-0xfb0(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1160 <main+0x20>
lea    -0xfb0(%rbp),%rdi
add    $0x4,%rdi
call   1050 <with_restrict@plt>
lea    -0x1f60(%rbp),%rdi
add    $0x4,%rdi
call   1060 <without_restrict@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3ea,-0x8(%rbp)
jge    11fe <main+0xbe>
movslq -0x8(%rbp),%rax
mov    -0xfb0(%rbp,%rax,4),%eax
movslq -0x8(%rbp),%rcx
cmp    -0x1f60(%rbp,%rcx,4),%eax
je     11eb <main+0xab>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    11f0 <main+0xb0>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11bb <main+0x7b>
xor    %eax,%eax
add    $0x1f60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x1f58,%rsp
xor    %eax,%eax
call   1040 <check_vect@plt>
movdqa 0xeaa(%rip),%xmm0
mov    $0xc,%eax
movdqa 0xead(%rip),%xmm1
movdqa 0xeb5(%rip),%xmm2
movdqa 0xebd(%rip),%xmm3
movdqa 0xec5(%rip),%xmm4
nopl   0x0(%rax,%rax,1)
movdqa %xmm0,%xmm5
paddd  %xmm1,%xmm5
movdqa %xmm0,-0x30(%rsp,%rax,4)
movdqa %xmm5,-0x20(%rsp,%rax,4)
movdqa %xmm0,0xf80(%rsp,%rax,4)
movdqa %xmm5,0xf90(%rsp,%rax,4)
cmp    $0x3ec,%rax
je     11e5 <main+0xa5>
movdqa %xmm0,%xmm5
paddd  %xmm2,%xmm5
movdqa %xmm0,%xmm6
paddd  %xmm3,%xmm6
movdqa %xmm5,-0x10(%rsp,%rax,4)
movdqa %xmm6,(%rsp,%rax,4)
movdqa %xmm5,0xfa0(%rsp,%rax,4)
movdqa %xmm6,0xfb0(%rsp,%rax,4)
paddd  %xmm4,%xmm0
add    $0x10,%rax
jmp    1180 <main+0x40>
movabs $0x3e9000003e8,%rax
mov    %rax,0xfa0(%rsp)
mov    %rax,0x1f50(%rsp)
lea    0xfb4(%rsp),%rdi
call   1050 <with_restrict@plt>
lea    0x4(%rsp),%rdi
call   1060 <without_restrict@plt>
mov    $0x2,%eax
nopl   0x0(%rax,%rax,1)
mov    0xfa8(%rsp,%rax,4),%ecx
cmp    -0x8(%rsp,%rax,4),%ecx
jne    125c <main+0x11c>
mov    0xfac(%rsp,%rax,4),%ecx
cmp    -0x4(%rsp,%rax,4),%ecx
jne    125c <main+0x11c>
mov    0xfb0(%rsp,%rax,4),%ecx
cmp    (%rsp,%rax,4),%ecx
jne    125c <main+0x11c>
add    $0x3,%rax
cmp    $0x3ec,%rax
jne    1220 <main+0xe0>
xor    %eax,%eax
add    $0x1f58,%rsp
ret
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [1002 x i32]
%2 = alloca [1002 x i32]
%3 = bitcast [1002 x i32]* %1 to i8*
%4 = bitcast [1002 x i32]* %2 to i8*
%5 = tail call i32 (...) @check_vect()
br label %6
6: ; preds = %21, %0
%7 = phi i64 [ 0, %0 ], [ %31, %21 ]
%8 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %0 ], [ %32, %21 ]
%9 = add <4 x i32> %8, <i32 4, i32 4, i32 4, i32 4>
%10 = getelementptr inbounds [1002 x i32], [1002 x i32]* %2, i64 0, i64 %7
%11 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> %8, <4 x i32>* %11
%12 = getelementptr inbounds i32, i32* %10, i64 4
%13 = bitcast i32* %12 to <4 x i32>*
store <4 x i32> %9, <4 x i32>* %13
%14 = getelementptr inbounds [1002 x i32], [1002 x i32]* %1, i64 0, i64 %7
%15 = bitcast i32* %14 to <4 x i32>*
store <4 x i32> %8, <4 x i32>* %15
%16 = getelementptr inbounds i32, i32* %14, i64 4
%17 = bitcast i32* %16 to <4 x i32>*
store <4 x i32> %9, <4 x i32>* %17
%18 = or i64 %7, 8
%19 = add <4 x i32> %8, <i32 8, i32 8, i32 8, i32 8>
%20 = icmp eq i64 %18, 1000
br i1 %20, label %33, label %21
21: ; preds = %6
%22 = add <4 x i32> %8, <i32 12, i32 12, i32 12, i32 12>
%23 = getelementptr inbounds [1002 x i32], [1002 x i32]* %2, i64 0, i64 %18
%24 = bitcast i32* %23 to <4 x i32>*
store <4 x i32> %19, <4 x i32>* %24
%25 = getelementptr inbounds i32, i32* %23, i64 4
%26 = bitcast i32* %25 to <4 x i32>*
store <4 x i32> %22, <4 x i32>* %26
%27 = getelementptr inbounds [1002 x i32], [1002 x i32]* %1, i64 0, i64 %18
%28 = bitcast i32* %27 to <4 x i32>*
store <4 x i32> %19, <4 x i32>* %28
%29 = getelementptr inbounds i32, i32* %27, i64 4
%30 = bitcast i32* %29 to <4 x i32>*
store <4 x i32> %22, <4 x i32>* %30
%31 = add nuw nsw i64 %7, 16
%32 = add <4 x i32> %8, <i32 16, i32 16, i32 16, i32 16>
br label %6
33: ; preds = %6
%34 = getelementptr inbounds [1002 x i32], [1002 x i32]* %2, i64 0, i64 1000
store i32 1000, i32* %34
%35 = getelementptr inbounds [1002 x i32], [1002 x i32]* %1, i64 0, i64 1000
store i32 1000, i32* %35
%36 = getelementptr inbounds [1002 x i32], [1002 x i32]* %2, i64 0, i64 1001
store i32 1001, i32* %36
%37 = getelementptr inbounds [1002 x i32], [1002 x i32]* %1, i64 0, i64 1001
store i32 1001, i32* %37
%38 = getelementptr inbounds [1002 x i32], [1002 x i32]* %1, i64 0, i64 1
%39 = call i32 @with_restrict(i32* %38)
%40 = getelementptr inbounds [1002 x i32], [1002 x i32]* %2, i64 0, i64 1
%41 = call i32 @without_restrict(i32* %40)
br label %59
42: ; preds = %59
%43 = add nuw nsw i64 %60, 1
%44 = getelementptr inbounds [1002 x i32], [1002 x i32]* %1, i64 0, i64 %43
%45 = load i32, i32* %44
%46 = getelementptr inbounds [1002 x i32], [1002 x i32]* %2, i64 0, i64 %43
%47 = load i32, i32* %46
%48 = icmp eq i32 %45, %47
br i1 %48, label %49, label %66
49: ; preds = %42
%50 = add nuw nsw i64 %60, 2
%51 = getelementptr inbounds [1002 x i32], [1002 x i32]* %1, i64 0, i64 %50
%52 = load i32, i32* %51
%53 = getelementptr inbounds [1002 x i32], [1002 x i32]* %2, i64 0, i64 %50
%54 = load i32, i32* %53
%55 = icmp eq i32 %52, %54
br i1 %55, label %56, label %66
56: ; preds = %49
%57 = add nuw nsw i64 %60, 3
%58 = icmp eq i64 %57, 1002
br i1 %58, label %68, label %59
59: ; preds = %56, %33
%60 = phi i64 [ 0, %33 ], [ %57, %56 ]
%61 = getelementptr inbounds [1002 x i32], [1002 x i32]* %1, i64 0, i64 %60
%62 = load i32, i32* %61
%63 = getelementptr inbounds [1002 x i32], [1002 x i32]* %2, i64 0, i64 %60
%64 = load i32, i32* %63
%65 = icmp eq i32 %62, %64
br i1 %65, label %42, label %66
66: ; preds = %49, %42, %59
%67 = call i32 (...) @abort()
unreachable
68: ; preds = %56
ret i32 0
}