#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);
int main() {
  int arr[10] = {1, 2, 3, 4, 5, 6}, i, *p;
  for (i = 0, p = &arr[0]; i < 10; i++) {
    printf("arr[%d]:%d is *(%p):%d\n", i, arr[i], p, *p);
    p = p + 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movl   $0x1,-0x30(%rbp)
movl   $0x2,-0x2c(%rbp)
movl   $0x3,-0x28(%rbp)
movl   $0x4,-0x24(%rbp)
movl   $0x5,-0x20(%rbp)
movl   $0x6,-0x1c(%rbp)
movl   $0x0,-0x34(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11be <main+0x9e>
mov    -0x34(%rbp),%esi
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
mov    -0x40(%rbp),%rcx
mov    -0x40(%rbp),%rax
mov    (%rax),%r8d
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
mov    -0x40(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x40(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1178 <main+0x58>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0x10(%rsp),%r14
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
lea    0x4(%rsp),%rbp
lea    0x8(%rsp),%r13
lea    0xc(%rsp),%r12
movaps 0xeb6(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x600000005,%rax
mov    %rax,0x10(%rsp)
lea    0x14(%rsp),%r15
lea    0xea7(%rip),%rbx
mov    %rsp,%rcx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x1,%r8d
call   1030 <printf@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %rbp,%rcx
mov    %edx,%r8d
call   1030 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r13,%rcx
mov    %edx,%r8d
call   1030 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %r12,%rcx
mov    %edx,%r8d
call   1030 <printf@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %r14,%rcx
mov    %edx,%r8d
call   1030 <printf@plt>
mov    0x14(%rsp),%edx
mov    %rbx,%rdi
mov    $0x5,%esi
mov    %r15,%rcx
mov    %edx,%r8d
call   1030 <printf@plt>
lea    0x18(%rsp),%rcx
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6,%esi
mov    %edx,%r8d
call   1030 <printf@plt>
lea    0x1c(%rsp),%rcx
mov    0x1c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x7,%esi
mov    %edx,%r8d
call   1030 <printf@plt>
lea    0x20(%rsp),%rcx
mov    0x20(%rsp),%edx
mov    %rbx,%rdi
mov    $0x8,%esi
mov    %edx,%r8d
call   1030 <printf@plt>
lea    0x24(%rsp),%rcx
mov    0x24(%rsp),%edx
mov    %rbx,%rdi
mov    $0x9,%esi
mov    %edx,%r8d
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [24 x i8] c"arr[%d]:%d is *(%p):%d\0A\00"
define i32 @main() {
%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 4
%4 = bitcast i32* %3 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%9 = bitcast [10 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32>* %9
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
store i32 5, i32* %10
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
store i32 6, i32* %11
%12 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 0, i32 1, i32* %5, i32 1)
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%14 = load i32, i32* %6
%15 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 1, i32 %14, i32* %13, i32 %14)
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%17 = load i32, i32* %7
%18 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 2, i32 %17, i32* %16, i32 %17)
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%20 = load i32, i32* %8
%21 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 3, i32 %20, i32* %19, i32 %20)
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%23 = load i32, i32* %10
%24 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 4, i32 %23, i32* %22, i32 %23)
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%26 = load i32, i32* %11
%27 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 5, i32 %26, i32* %25, i32 %26)
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%30 = load i32, i32* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 6, i32 %30, i32* %28, i32 %30)
%32 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%34 = load i32, i32* %33
%35 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 7, i32 %34, i32* %32, i32 %34)
%36 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%38 = load i32, i32* %37
%39 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 8, i32 %38, i32* %36, i32 %38)
%40 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%41 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%42 = load i32, i32* %41
%43 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 9, i32 %42, i32* %40, i32 %42)
ret i32 0
}