#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 main(void) {
  int *basic_pointer;
  int basic_value;
  basic_value = 'A';
  basic_pointer = &basic_value;
  printf("pointer is at address %p\n", &basic_pointer);
  printf("value at address of pointer is %c\n\n", *basic_pointer);
  char array[5] = {'a', 'A', 'b', 'z', 'M'};
  char *same_array = array;
  char **fancy_same_array = &same_array;
  printf("array[3] = %c, addr = %p\n", array[3], &array[3]);
  printf("same_array[3] = %c, addr = %p\n", same_array[3], &same_array[3]);
  printf("**fancy_same_array[3] = %c, addr = %p\n", (*fancy_same_array)[3],
         &(*fancy_same_array)[3]);
  printf("array string %s, addr = %p\n", array, &array);
  printf("same array string %s, addr = %p\n", same_array, &same_array);
  printf("fancy array string %s, addr = %p\n\n", (*fancy_same_array),
         &(*fancy_same_array));
  char *ptr_array[2];
  char *ptr1 = NULL, *ptr2 = NULL;
  char char_elements[2] = {'H', 'i'};
  ptr1 = &char_elements[1];
  ptr2 = char_elements;
  ptr_array[0] = ptr2;
  ptr_array[1] = ptr1;
  printf("**ptr_array = %c\n", **ptr_array);
  printf("addr at **ptr_array = %p\n", &(**ptr_array));
  printf("addr at **ptr_array[0] = %p\n\n", &(*ptr_array[0]));
  printf("*ptr_array[1] = %c\n", *ptr_array[1]);
  printf("addr at *ptr_array[0] = %p\n", &(**ptr_array));
  printf("addr at *ptr_array[0] = %p\n", &(**ptr_array));
  printf("addr at *ptr_array[1] = %p\n", &(*ptr_array[1]));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x41,-0x14(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    0xecb(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xfe5(%rip),%eax
mov    %eax,-0x19(%rbp)
mov    0xfe0(%rip),%al
mov    %al,-0x15(%rbp)
lea    -0x19(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
movsbl -0x16(%rbp),%esi
lea    -0x19(%rbp),%rdx
add    $0x3,%rdx
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
movsbl 0x3(%rax),%esi
mov    -0x28(%rbp),%rdx
add    $0x3,%rdx
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
movsbl 0x3(%rax),%esi
mov    -0x30(%rbp),%rax
mov    (%rax),%rdx
add    $0x3,%rdx
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x19(%rbp),%rsi
lea    0xe8d(%rip),%rdi
lea    -0x19(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xe72(%rip),%rdi
lea    -0x28(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
mov    (%rax),%rsi
mov    -0x30(%rbp),%rdx
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
mov    0xf16(%rip),%ax
mov    %ax,-0x52(%rbp)
lea    -0x52(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
lea    -0x52(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x40(%rbp),%rax
movsbl (%rax),%esi
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rsi
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rsi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
movsbl (%rax),%esi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rsi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rsi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rsi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movl   $0x41,0xc(%rsp)
lea    0xc(%rsp),%rax
mov    %rax,0x18(%rsp)
lea    0xece(%rip),%rdi
lea    0x18(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x18(%rsp),%rax
mov    (%rax),%esi
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movb   $0x4d,0x8(%rsp)
movl   $0x7a624161,0x4(%rsp)
7a
lea    0x4(%rsp),%r14
mov    %r14,0x10(%rsp)
lea    0x7(%rsp),%rbx
lea    0xed5(%rip),%rdi
mov    $0x7a,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
movsbl 0x7(%rsp),%esi
lea    0xeb5(%rip),%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
movsbl 0x7(%rsp),%esi
lea    0xe97(%rip),%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb2(%rip),%rdi
mov    %r14,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe99(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%rsi
lea    0xe9c(%rip),%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
movw   $0x6948,0x2(%rsp)
lea    0x3(%rsp),%r14
lea    0xea2(%rip),%rdi
mov    $0x48,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
lea    0x2(%rsp),%r15
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea5(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
movsbl 0x3(%rsp),%esi
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb3(%rip),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [26 x i8] c"pointer is at address %p\0A\00"
@.str.1 = [36 x i8] c"value at address of pointer is %c\0A\0A\00"
@__const.main.array = [5 x i8] c"aAbzM"
@.str.2 = [26 x i8] c"array[3] = %c, addr = %p\0A\00"
@.str.3 = [31 x i8] c"same_array[3] = %c, addr = %p\0A\00"
@.str.4 = [39 x i8] c"**fancy_same_array[3] = %c, addr = %p\0A\00"
@.str.5 = [28 x i8] c"array string %s, addr = %p\0A\00"
@.str.6 = [33 x i8] c"same array string %s, addr = %p\0A\00"
@.str.7 = [35 x i8] c"fancy array string %s, addr = %p\0A\0A\00"
@__const.main.char_elements = [2 x i8] c"Hi"
@.str.8 = [18 x i8] c"**ptr_array = %c\0A\00"
@.str.9 = [26 x i8] c"addr at **ptr_array = %p\0A\00"
@.str.10 = [30 x i8] c"addr at **ptr_array[0] = %p\0A\0A\00"
@.str.11 = [20 x i8] c"*ptr_array[1] = %c\0A\00"
@.str.12 = [28 x i8] c"addr at *ptr_array[0] = %p\0A\00"
@.str.13 = [28 x i8] c"addr at *ptr_array[1] = %p\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca [5 x i8]
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca [2 x i8*]
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca [2 x i8]
store i32 0, i32* %1
store i32 65, i32* %3
store i32* %3, i32** %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32** %2)
%12 = load i32*, i32** %2
%13 = load i32, i32* %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = bitcast [5 x i8]* %4 to i8*
%16 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
store i8* %16, i8** %5
store i8** %5, i8*** %6
%17 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %19, i8* %20)
%22 = load i8*, i8** %5
%23 = getelementptr inbounds i8, i8* %22, i64 3
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = load i8*, i8** %5
%27 = getelementptr inbounds i8, i8* %26, i64 3
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %25, i8* %27)
%29 = load i8**, i8*** %6
%30 = load i8*, i8** %29
%31 = getelementptr inbounds i8, i8* %30, i64 3
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = load i8**, i8*** %6
%35 = load i8*, i8** %34
%36 = getelementptr inbounds i8, i8* %35, i64 3
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 %33, i8* %36)
%38 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* %38, [5 x i8]* %4)
%40 = load i8*, i8** %5
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* %40, i8** %5)
%42 = load i8**, i8*** %6
%43 = load i8*, i8** %42
%44 = load i8**, i8*** %6
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %43, i8** %44)
store i8* null, i8** %8
store i8* null, i8** %9
%46 = bitcast [2 x i8]* %10 to i8*
%47 = getelementptr inbounds [2 x i8], [2 x i8]* %10, i64 0, i64 1
store i8* %47, i8** %8
%48 = getelementptr inbounds [2 x i8], [2 x i8]* %10, i64 0, i64 0
store i8* %48, i8** %9
%49 = load i8*, i8** %9
%50 = getelementptr inbounds [2 x i8*], [2 x i8*]* %7, i64 0, i64 0
store i8* %49, i8** %50
%51 = load i8*, i8** %8
%52 = getelementptr inbounds [2 x i8*], [2 x i8*]* %7, i64 0, i64 1
store i8* %51, i8** %52
%53 = getelementptr inbounds [2 x i8*], [2 x i8*]* %7, i64 0, i64 0
%54 = load i8*, i8** %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i32 %56)
%58 = getelementptr inbounds [2 x i8*], [2 x i8*]* %7, i64 0, i64 0
%59 = load i8*, i8** %58
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i8* %59)
%61 = getelementptr inbounds [2 x i8*], [2 x i8*]* %7, i64 0, i64 0
%62 = load i8*, i8** %61
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i8* %62)
%64 = getelementptr inbounds [2 x i8*], [2 x i8*]* %7, i64 0, i64 1
%65 = load i8*, i8** %64
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), i32 %67)
%69 = getelementptr inbounds [2 x i8*], [2 x i8*]* %7, i64 0, i64 0
%70 = load i8*, i8** %69
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i8* %70)
%72 = getelementptr inbounds [2 x i8*], [2 x i8*]* %7, i64 0, i64 0
%73 = load i8*, i8** %72
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i8* %73)
%75 = getelementptr inbounds [2 x i8*], [2 x i8*]* %7, i64 0, i64 1
%76 = load i8*, i8** %75
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.13, i64 0, i64 0), i8* %76)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"pointer is at address %p\0A\00"
@.str.1 = [36 x i8] c"value at address of pointer is %c\0A\0A\00"
@__const.main.array = [5 x i8] c"aAbzM"
@.str.2 = [26 x i8] c"array[3] = %c, addr = %p\0A\00"
@.str.3 = [31 x i8] c"same_array[3] = %c, addr = %p\0A\00"
@.str.4 = [39 x i8] c"**fancy_same_array[3] = %c, addr = %p\0A\00"
@.str.5 = [28 x i8] c"array string %s, addr = %p\0A\00"
@.str.6 = [33 x i8] c"same array string %s, addr = %p\0A\00"
@.str.7 = [35 x i8] c"fancy array string %s, addr = %p\0A\0A\00"
@.str.8 = [18 x i8] c"**ptr_array = %c\0A\00"
@.str.9 = [26 x i8] c"addr at **ptr_array = %p\0A\00"
@.str.10 = [30 x i8] c"addr at **ptr_array[0] = %p\0A\0A\00"
@.str.11 = [20 x i8] c"*ptr_array[1] = %c\0A\00"
@.str.12 = [28 x i8] c"addr at *ptr_array[0] = %p\0A\00"
@.str.13 = [28 x i8] c"addr at *ptr_array[1] = %p\0A\00"
define i32 @main() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca [5 x i8]
%4 = alloca i8*
%5 = alloca i16
%6 = bitcast i16* %5 to [2 x i8]*
%7 = bitcast i32** %1 to i8*
%8 = bitcast i32* %2 to i8*
store i32 65, i32* %2
store i32* %2, i32** %1
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32** %1)
%10 = load i32*, i32** %1
%11 = load i32, i32* %10
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%14 = bitcast i8** %4 to i8*
store i8* %13, i8** %4
%15 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 3
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 122, i8* %15)
%17 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %19, i8* %17)
%21 = load i8, i8* %17
%22 = sext i8 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 %22, i8* %17)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* %13, [5 x i8]* %3)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* %13, i8** %4)
%26 = load i8*, i8** %4
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %26, i8** %4)
%28 = bitcast i16* %5 to i8*
store i16 26952, i16* %5
%29 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 1
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0), i32 72)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i16* %5)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i16* %5)
%33 = load i8, i8* %29
%34 = sext i8 %33 to i32
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), i32 %34)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i16* %5)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i16* %5)
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.13, i64 0, i64 0), i8* %29)
ret i32 0
}