void main() {
  int a[5] = {1, 2, 3, 4, 5};
  int *ptr1 = (int *)(&a + 1);
  int *ptr2 = (int *)((int)a + 1);
  int *i = a;
  int(*j)[] = &a + 1;
  printf("a=%d,i=%d,j=%d\n", (int)a, i, j);
  printf("%d,%d,%d\n", ptr1[-2], ptr1[-1], ptr1[0]);
  printf("%x,%x,%x\n", ptr1[-1], *ptr2, *ptr1);
  printf("%d", checkSystem());
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x28(%rbp)
lea    -0x20(%rbp),%rax
add    $0x1,%eax
cltq
mov    %rax,-0x30(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x20(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x40(%rbp)
lea    -0x20(%rbp),%rax
mov    %eax,%esi
mov    -0x38(%rbp),%rdx
mov    -0x40(%rbp),%rcx
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    -0x8(%rax),%esi
mov    -0x28(%rbp),%rax
mov    -0x4(%rax),%edx
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    -0x4(%rax),%esi
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <checkSystem@plt>
mov    %eax,%esi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    0xee5(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xeca(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x14(%rsp),%rcx
mov    %rsp,%rdx
movslq %edx,%rbx
lea    0xec8(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0x14(%rsp),%ecx
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x1(%rbx),%edx
mov    0x10(%rsp),%esi
mov    0x14(%rsp),%ecx
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <checkSystem@plt>
lea    0xea2(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@.str = [16 x i8] c"a=%d,i=%d,j=%d\0A\00"
@.str.1 = [10 x i8] c"%d,%d,%d\0A\00"
@.str.2 = [10 x i8] c"%x,%x,%x\0A\00"
@.str.3 = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca [5 x i32]
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [0 x i32]*
%6 = bitcast [5 x i32]* %1 to i8*
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 1
%8 = bitcast [5 x i32]* %7 to i32*
store i32* %8, i32** %2
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%10 = ptrtoint i32* %9 to i32
%11 = add nsw i32 %10, 1
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
store i32* %13, i32** %3
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
store i32* %14, i32** %4
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 1
%16 = bitcast [5 x i32]* %15 to [0 x i32]*
store [0 x i32]* %16, [0 x i32]** %5
%17 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%18 = ptrtoint i32* %17 to i32
%19 = load i32*, i32** %4
%20 = load [0 x i32]*, [0 x i32]** %5
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %18, i32* %19, [0 x i32]* %20)
%22 = load i32*, i32** %2
%23 = getelementptr inbounds i32, i32* %22, i64 -2
%24 = load i32, i32* %23
%25 = load i32*, i32** %2
%26 = getelementptr inbounds i32, i32* %25, i64 -1
%27 = load i32, i32* %26
%28 = load i32*, i32** %2
%29 = getelementptr inbounds i32, i32* %28, i64 0
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %24, i32 %27, i32 %30)
%32 = load i32*, i32** %2
%33 = getelementptr inbounds i32, i32* %32, i64 -1
%34 = load i32, i32* %33
%35 = load i32*, i32** %3
%36 = load i32, i32* %35
%37 = load i32*, i32** %2
%38 = load i32, i32* %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %34, i32 %36, i32 %38)
%40 = call i32 (...) @checkSystem()
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %40)
ret void
}

LLVM IR (-O2):
@__const.main.a = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@.str = [16 x i8] c"a=%d,i=%d,j=%d\0A\00"
@.str.1 = [10 x i8] c"%d,%d,%d\0A\00"
@.str.2 = [10 x i8] c"%x,%x,%x\0A\00"
@.str.3 = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 1
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%6 = ptrtoint [5 x i32]* %1 to i64
%7 = trunc i64 %6 to i32
%8 = shl i64 %6, 32
%9 = ashr exact i64 %8, 32
%10 = or i64 %9, 1
%11 = inttoptr i64 %10 to i32*
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %7, i32* %5, [5 x i32]* %3)
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 1, i64 -2
%14 = load i32, i32* %13
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 1, i64 -1
%16 = load i32, i32* %15
%17 = load i32, i32* %4
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %16, i32 %17)
%19 = load i32, i32* %15
%20 = load i32, i32* %11
%21 = load i32, i32* %4
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %19, i32 %20, i32 %21)
%23 = call i32 (...) @checkSystem()
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %23)
ret void
}