int array_and_pointers_1() {
  int arr[3] = {10, 20, 30};
  int *px;
  px = &arr[0];
  printf("arr [0] = %d\n", *px);
  printf("address of px = %u\n", px);
  printf("value of px = %u\n", *px);
  printf("Incrementing address... \n");
  px = px + 1;
  printf("address of px = %u\n", px);
  printf("value of px = %u\n", *px);
}


x86 assembly (clang, -O0):
<array_and_pointers_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xedf(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_and_pointers_1>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0xedb(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xec8(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xec8(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec3(%rip),%r14
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
lea    0xebd(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.array_and_pointers_1.arr = [3 x i32] [i32 10, i32 20, i32 30]
@.str = [14 x i8] c"arr [0] = %d\0A\00"
@.str.1 = [20 x i8] c"address of px = %u\0A\00"
@.str.2 = [18 x i8] c"value of px = %u\0A\00"
@.str.3 = [26 x i8] c"Incrementing address... \0A\00"
define i32 @array_and_pointers_1() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca i32*
%4 = bitcast [3 x i32]* %2 to i8*
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32*, i32** %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%11 = load i32*, i32** %3
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%15 = load i32*, i32** %3
%16 = getelementptr inbounds i32, i32* %15, i64 1
store i32* %16, i32** %3
%17 = load i32*, i32** %3
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32* %17)
%19 = load i32*, i32** %3
%20 = load i32, i32* %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@__const.array_and_pointers_1.arr = [3 x i32] [i32 10, i32 20, i32 30]
@.str = [14 x i8] c"arr [0] = %d\0A\00"
@.str.1 = [20 x i8] c"address of px = %u\0A\00"
@.str.2 = [18 x i8] c"value of px = %u\0A\00"
@str = [25 x i8] c"Incrementing address... \00"
define i32 @array_and_pointers_1() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 10)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%11 = load i32, i32* %9
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %11)
ret i32 undef
}