void printArray(void) {
  int speeds[] = {100, 45, 57, 78};
  int *pntr = speeds;
  pntr;
  printf("address %x stores first value %d\n", pntr, *pntr);
  pntr++;
  printf("address %x stores second value %d\n", pntr, *pntr);
  pntr++;
  printf("address %x stores third value %d\n", pntr, *pntr);
  pntr--;
  pntr--;
  printf("address %x stores first value %d\n", pntr, *pntr);
}


x86 assembly (clang, -O0):
<printArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArray>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movaps 0xee2(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xee7(%rip),%r14
mov    %rsp,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x64,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    0x4(%rsp),%edx
lea    0xee4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    0x8(%rsp),%edx
lea    0xef0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.printArray.speeds = [4 x i32] [i32 100, i32 45, i32 57, i32 78]
@.str = [34 x i8] c"address %x stores first value %d\0A\00"
@.str.1 = [35 x i8] c"address %x stores second value %d\0A\00"
@.str.2 = [34 x i8] c"address %x stores third value %d\0A\00"
define void @printArray() {
%1 = alloca [4 x i32]
%2 = alloca i32*
%3 = bitcast [4 x i32]* %1 to i8*
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
store i32* %4, i32** %2
%5 = load i32*, i32** %2
%6 = load i32*, i32** %2
%7 = load i32*, i32** %2
%8 = load i32, i32* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32* %6, i32 %8)
%10 = load i32*, i32** %2
%11 = getelementptr inbounds i32, i32* %10, i32 1
store i32* %11, i32** %2
%12 = load i32*, i32** %2
%13 = load i32*, i32** %2
%14 = load i32, i32* %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32* %12, i32 %14)
%16 = load i32*, i32** %2
%17 = getelementptr inbounds i32, i32* %16, i32 1
store i32* %17, i32** %2
%18 = load i32*, i32** %2
%19 = load i32*, i32** %2
%20 = load i32, i32* %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32* %18, i32 %20)
%22 = load i32*, i32** %2
%23 = getelementptr inbounds i32, i32* %22, i32 -1
store i32* %23, i32** %2
%24 = load i32*, i32** %2
%25 = getelementptr inbounds i32, i32* %24, i32 -1
store i32* %25, i32** %2
%26 = load i32*, i32** %2
%27 = load i32*, i32** %2
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32* %26, i32 %28)
ret void
}

LLVM IR (-O2):
@__const.printArray.speeds = [4 x i32] [i32 100, i32 45, i32 57, i32 78]
@.str = [34 x i8] c"address %x stores first value %d\0A\00"
@.str.1 = [35 x i8] c"address %x stores second value %d\0A\00"
@.str.2 = [34 x i8] c"address %x stores third value %d\0A\00"
define void @printArray() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32* %3, i32 100)
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 1
%6 = load i32, i32* %5
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32 %6)
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%9 = load i32, i32* %8
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32* %8, i32 %9)
%11 = load i32, i32* %3
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32* %3, i32 %11)
ret void
}