#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 main() {
  int a[5] = {1, 3, 5, 7, 9};
  int i;
  for (i = 0; i < 5; ++i)
    printf("%p\n", &a[i]);
  printf("a is %p\n", a);
  int *q = a;
  int *q2 = (int *)(q + 1);
  int *p = (int *)(&a + 1);
  int *p3 = (int *)(a + 1);
  printf(" q2 = %p,*q2 is %d\n", q2, (*q2));
  printf(" *p = %d,p is %p\n", *p, p);
  printf(" *p3 = %d,p3 is %p\n", *p3, p3);
  printf("%d,%d\n", *(a + 1), *(p - 1));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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)
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    117a <main+0x6a>
movslq -0x24(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1145 <main+0x35>
lea    -0x20(%rbp),%rsi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x38(%rbp)
lea    -0x20(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x40(%rbp)
lea    -0x20(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%rsi
mov    -0x38(%rbp),%rax
mov    (%rax),%edx
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rax
mov    (%rax),%esi
mov    -0x40(%rbp),%rdx
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%rax
mov    (%rax),%esi
mov    -0x48(%rbp),%rdx
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rax
mov    -0x4(%rax),%edx
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    0xeef(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xed4(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x10(%rsp),%r15
lea    0xf17(%rip),%rbx
mov    %rsp,%r12
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe84(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x14(%rsp),%rbx
mov    0x4(%rsp),%edx
lea    0xe73(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x14(%rsp),%esi
lea    0xe72(%rip),%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
lea    0xe6f(%rip),%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    0x10(%rsp),%edx
lea    0xe6a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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