int main() {
  int arr[] = {1, 2, 3, 4, 5, 6};
  int arr2[] = {1, 2, 3};
  int *ptr = arr;
  ptr[3] = 4;
  ptr[6] = 10;
  ptr[-1] = 10;
  for (int i = 0; i < 10; ++i) {
    ptr[i] = 5;
  }
  int *ptr2 = arr2;
  ptr2[1] = 3;
  ptr2[3] = 10;
  ptr2[-1] = 10;
  for (int i = 0; i < 5; ++i) {
    ptr2[i] = 5;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    0xeee(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeeb(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xee8(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xee5(%rip),%rax
mov    %rax,-0x2c(%rbp)
mov    0xee3(%rip),%eax
mov    %eax,-0x24(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movl   $0x4,0xc(%rax)
mov    -0x38(%rbp),%rax
movl   $0xa,0x18(%rax)
mov    -0x38(%rbp),%rax
movl   $0xa,-0x4(%rax)
movl   $0x0,-0x3c(%rbp)
cmpl   $0xa,-0x3c(%rbp)
jge    1197 <main+0x97>
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movl   $0x5,(%rax,%rcx,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1170 <main+0x70>
lea    -0x2c(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
movl   $0x3,0x4(%rax)
mov    -0x48(%rbp),%rax
movl   $0xa,0xc(%rax)
mov    -0x48(%rbp),%rax
movl   $0xa,-0x4(%rax)
movl   $0x0,-0x4c(%rbp)
cmpl   $0x5,-0x4c(%rbp)
jge    11ee <main+0xee>
mov    -0x48(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movl   $0x5,(%rax,%rcx,4)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    11c7 <main+0xc7>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}