#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*/ printf(char *, int, int, int);
int main() {
  int a[5] = {1, 2, 3, 4, 5};
  int *p1 = (int *)(&a + 1);
  int *p2 = (int *)((int)a + 1);
  int *p3 = (int *)(a + 1);
  printf("%d, %d, %d\n", p1[-1], p2[0], p3[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed5(%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
add    $0x4,%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x4(%rax),%esi
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%ecx
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xef6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xedb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rax
cltq
mov    0x1(%rax),%edx
lea    0xedc(%rip),%rdi
mov    $0x5,%esi
mov    $0x3,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@.str = [12 x i8] c"%d, %d, %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
store i32 0, i32* %1
%6 = bitcast [5 x i32]* %2 to i8*
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 1
%8 = bitcast [5 x i32]* %7 to i32*
store i32* %8, i32** %3
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %2, 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** %4
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%15 = getelementptr inbounds i32, i32* %14, i64 1
store i32* %15, i32** %5
%16 = load i32*, i32** %3
%17 = getelementptr inbounds i32, i32* %16, i64 -1
%18 = load i32, i32* %17
%19 = load i32*, i32** %4
%20 = getelementptr inbounds i32, i32* %19, i64 0
%21 = load i32, i32* %20
%22 = load i32*, i32** %5
%23 = getelementptr inbounds i32, i32* %22, i64 1
%24 = load i32, i32* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %21, i32 %24)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@.str = [12 x i8] c"%d, %d, %d\0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = ptrtoint [5 x i32]* %1 to i64
%4 = shl i64 %3, 32
%5 = ashr exact i64 %4, 32
%6 = or i64 %5, 1
%7 = inttoptr i64 %6 to i32*
%8 = load i32, i32* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 5, i32 %8, i32 3)
ret i32 0
}