#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 *, ...);
void messAroundWithAnArray() {
  int numbers[10] = {101, 102, 103};
  int x = 3, *y = numbers;
  x++;
  y++;
  for (int i = 0; i < 10; i++) {
    printf("address is %p, value is %d\n", numbers + i, *(numbers + i));
  }
  printf("\n\n=========================\n\n");
  for (int i = 0, *p = numbers; i < 10; i++, p++) {
    printf("address is %p, value is %d\n", p, *p);
  }
}


x86 assembly (clang, -O0):
<messAroundWithAnArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movl   $0x65,-0x30(%rbp)
movl   $0x66,-0x2c(%rbp)
movl   $0x67,-0x28(%rbp)
movl   $0x3,-0x34(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x40(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0xa,-0x44(%rbp)
jge    11b5 <messAroundWithAnArray+0x95>
lea    -0x30(%rbp),%rsi
movslq -0x44(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
movslq -0x44(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1178 <messAroundWithAnArray+0x58>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x48(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x50(%rbp)
cmpl   $0xa,-0x48(%rbp)
jge    120e <messAroundWithAnArray+0xee>
mov    -0x50(%rbp),%rsi
mov    -0x50(%rbp),%rax
mov    (%rax),%edx
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
mov    -0x50(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x50(%rbp)
jmp    11d2 <messAroundWithAnArray+0xb2>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<messAroundWithAnArray>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
lea    0x20(%rsp),%r14
lea    0x10(%rsp),%r15
movabs $0x6600000065,%rax
mov    %rax,(%rsp)
lea    0x4(%rsp),%rbp
lea    0x8(%rsp),%r12
movl   $0x67,0x8(%rsp)
lea    0xe8c(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x65,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rbp
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x14(%rsp),%r15
mov    0x14(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x18(%rsp),%r12
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1c(%rsp),%r13
mov    0x1c(%rsp),%edx
mov    %rbx,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x24(%rsp),%r14
mov    0x24(%rsp),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xddd(%rip),%rdi
call   1030 <puts@plt>
mov    (%rsp),%edx
mov    %rbx,%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%edx
mov    %rbx,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%edx
mov    %rbx,%rdi
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x24(%rsp),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [28 x i8] c"address is %p, value is %d\0A\00"
@str = [29 x i8] c"\0A\0A=========================\0A\00"
define void @messAroundWithAnArray() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
store i32 101, i32* %3
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
store i32 102, i32* %4
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
store i32 103, i32* %5
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %3, i32 101)
%7 = load i32, i32* %4
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %4, i32 %7)
%9 = load i32, i32* %5
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %5, i32 %9)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %11, i32 %12)
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %14, i32 %15)
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%18 = load i32, i32* %17
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %17, i32 %18)
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %20, i32 %21)
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %23, i32 %24)
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %26, i32 %27)
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %29, i32 %30)
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%33 = load i32, i32* %3
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %3, i32 %33)
%35 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%36 = load i32, i32* %35
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %35, i32 %36)
%38 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%39 = load i32, i32* %38
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %38, i32 %39)
%41 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%42 = load i32, i32* %41
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %41, i32 %42)
%44 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%45 = load i32, i32* %44
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %44, i32 %45)
%47 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%48 = load i32, i32* %47
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %47, i32 %48)
%50 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %50, i32 %51)
%53 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%54 = load i32, i32* %53
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %53, i32 %54)
%56 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%57 = load i32, i32* %56
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %56, i32 %57)
%59 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%60 = load i32, i32* %59
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32* %59, i32 %60)
ret void
}