#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void printPointerToArray(int **a) {
  fprintf(stderr, "Native: a = %p\n", a);
  fprintf(stderr, "Native: *a = %p\n", *a);
  fprintf(stderr, "Native: *a[0] = %i\n", (*a)[0]);
  fprintf(stderr, "Native: *a[1] = %i\n", (*a)[1]);
  fprintf(stderr, "Native: *a[2] = %i\n", (*a)[2]);
}


x86 assembly (clang, -O0):
<printPointerToArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
lea    0xec2(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%edx
lea    0xeb3(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x4(%rax),%edx
lea    0xea6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x8(%rax),%edx
lea    0xe99(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printPointerToArray>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ec2(%rip),%r14
mov    (%r14),%edi
lea    0xed8(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
mov    (%rbx),%rdx
lea    0xed1(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
mov    (%rbx),%rax
mov    (%rax),%edx
lea    0xecc(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
mov    (%rbx),%rax
mov    0x4(%rax),%edx
lea    0xec9(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
mov    (%rbx),%rax
mov    0x8(%rax),%edx
lea    0xec6(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"Native: a = %p\0A\00"
@.str.1 = [17 x i8] c"Native: *a = %p\0A\00"
@.str.2 = [20 x i8] c"Native: *a[0] = %i\0A\00"
@.str.3 = [20 x i8] c"Native: *a[1] = %i\0A\00"
@.str.4 = [20 x i8] c"Native: *a[2] = %i\0A\00"
define void @printPointerToArray(i32** %0) {
%2 = alloca i32**
store i32** %0, i32*** %2
%3 = load i32, i32* @stderr
%4 = load i32**, i32*** %2
%5 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32** %4)
%6 = load i32, i32* @stderr
%7 = load i32**, i32*** %2
%8 = load i32*, i32** %7
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = load i32, i32* @stderr
%11 = load i32**, i32*** %2
%12 = load i32*, i32** %11
%13 = getelementptr inbounds i32, i32* %12, i64 0
%14 = load i32, i32* %13
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = load i32, i32* @stderr
%17 = load i32**, i32*** %2
%18 = load i32*, i32** %17
%19 = getelementptr inbounds i32, i32* %18, i64 1
%20 = load i32, i32* %19
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %20)
%22 = load i32, i32* @stderr
%23 = load i32**, i32*** %2
%24 = load i32*, i32** %23
%25 = getelementptr inbounds i32, i32* %24, i64 2
%26 = load i32, i32* %25
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %26)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"Native: a = %p\0A\00"
@.str.1 = [17 x i8] c"Native: *a = %p\0A\00"
@.str.2 = [20 x i8] c"Native: *a[0] = %i\0A\00"
@.str.3 = [20 x i8] c"Native: *a[1] = %i\0A\00"
@.str.4 = [20 x i8] c"Native: *a[2] = %i\0A\00"
define void @printPointerToArray(i32** %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32** %0)
%4 = load i32, i32* @stderr
%5 = load i32*, i32** %0
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%7 = load i32, i32* @stderr
%8 = load i32*, i32** %0
%9 = load i32, i32* %8
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = load i32, i32* @stderr
%12 = load i32*, i32** %0
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = load i32, i32* %13
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = load i32, i32* @stderr
%17 = load i32*, i32** %0
%18 = getelementptr inbounds i32, i32* %17, i64 2
%19 = load i32, i32* %18
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %19)
ret void
}