#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) {
  printf("\xD\xA");
  int var = 5;
  int *varPtr = &var;
  int **ptrToVarPtr = &varPtr;
  int ***ptrToptrToVarPtr = &ptrToVarPtr;
  printf("addr of var = %p\n", &var);
  printf("addr of varPtr = %p\n", &varPtr);
  printf("addr of ptrToVarPtr = %p\n", &ptrToVarPtr);
  printf("contents of varPtr (addr  of var) = %p\n", varPtr);
  printf("deref varPtr (value  of var) = %d\n", *varPtr);
  printf("\xD\xA");
  printf("contents of ptrToVarPtr (addr of varPtr) = %p\n", ptrToVarPtr);
  printf("deref of ptrToVarPtr (value of varPtr -> addr of var) = %p\n",
         *ptrToVarPtr);
  printf("deref deref of ptrToVarPtr (value of varPtr -> addr of var -> "
         "contents of var) = %d\n",
         **ptrToVarPtr);
  printf("\xD\xA");
  printf("contents of ptrToptrToVarPtr (addr of ptrToVarPtr) = %p\n",
         ptrToptrToVarPtr);
  printf("deref of ptrToptrToVarPtr (value of ptrToVarPtr -> addr of "
         "ptrTovarPtr) = %p\n",
         *ptrToptrToVarPtr);
  printf("deref deref of ptrToptrToVarPtr (value of ptrToVarPtr -> value of "
         "varPtr -> addr of var -> contents of var) = %p\n",
         **ptrToptrToVarPtr);
  printf("deref deref of ptrToptrToVarPtr (value of ptrToVarPtr -> value of "
         "varPtr -> addr of var -> contents of var) = %d\n",
         ***ptrToptrToVarPtr);
  printf("\xD\xA");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x5,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
lea    0xeef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
lea    0xf14(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xf49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rsi
lea    0xf6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rsi
lea    0xfa3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rax
mov    (%rax),%esi
lea    0xffb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xda5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0x1189(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
movl   $0x5,0x14(%rsp)
lea    0x14(%rsp),%rsi
mov    %rsi,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,(%rsp)
lea    0xea8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeac(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rsi
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%rax
mov    (%rax),%esi
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    (%rsp),%rsi
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%rax
mov    (%rax),%rsi
lea    0xee7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
lea    0xf0c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xf4b(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%rsi
lea    0xf6f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%rax
mov    (%rax),%rsi
lea    0xfa8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
lea    0x1003(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\0D\0A\00"
@.str.1 = [18 x i8] c"addr of var = %p\0A\00"
@.str.2 = [21 x i8] c"addr of varPtr = %p\0A\00"
@.str.3 = [26 x i8] c"addr of ptrToVarPtr = %p\0A\00"
@.str.4 = [40 x i8] c"contents of varPtr (addr of var) = %p\0A\00"
@.str.5 = [35 x i8] c"deref varPtr (value of var) = %d\0A\00"
@.str.6 = [47 x i8] c"contents of ptrToVarPtr (addr of varPtr) = %p\0A\00"
@.str.7 = [60 x i8] c"deref of ptrToVarPtr (value of varPtr -> addr of var) = %p\0A\00"
@.str.8 = [85 x i8] c"deref deref of ptrToVarPtr (value of varPtr -> addr of var -> contents of var) = %d\0A\00"
@.str.9 = [57 x i8] c"contents of ptrToptrToVarPtr (addr of ptrToVarPtr) = %p\0A\00"
@.str.10 = [78 x i8] c"deref of ptrToptrToVarPtr (value of ptrToVarPtr -> addr of ptrTovarPtr) = %p\0A\00"
@.str.11 = [114 x i8] c"deref deref of ptrToptrToVarPtr (value of ptrToVarPtr -> value of varPtr -> addr of var -> contents of var) = %p\0A\00"
@.str.12 = [114 x i8] c"deref deref of ptrToptrToVarPtr (value of ptrToVarPtr -> value of varPtr -> addr of var -> contents of var) = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32**
%4 = alloca i32***
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 5, i32* %1
store i32* %1, i32** %2
store i32** %2, i32*** %3
store i32*** %3, i32**** %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32** %2)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32*** %3)
%9 = load i32*, i32** %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i32* %9)
%11 = load i32*, i32** %2
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%15 = load i32**, i32*** %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i32** %15)
%17 = load i32**, i32*** %3
%18 = load i32*, i32** %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.7, i64 0, i64 0), i32* %18)
%20 = load i32**, i32*** %3
%21 = load i32*, i32** %20
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.8, i64 0, i64 0), i32 %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%25 = load i32***, i32**** %4
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.9, i64 0, i64 0), i32*** %25)
%27 = load i32***, i32**** %4
%28 = load i32**, i32*** %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.10, i64 0, i64 0), i32** %28)
%30 = load i32***, i32**** %4
%31 = load i32**, i32*** %30
%32 = load i32*, i32** %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str.11, i64 0, i64 0), i32* %32)
%34 = load i32***, i32**** %4
%35 = load i32**, i32*** %34
%36 = load i32*, i32** %35
%37 = load i32, i32* %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str.12, i64 0, i64 0), i32 %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c"addr of var = %p\0A\00"
@.str.2 = [21 x i8] c"addr of varPtr = %p\0A\00"
@.str.3 = [26 x i8] c"addr of ptrToVarPtr = %p\0A\00"
@.str.4 = [40 x i8] c"contents of varPtr (addr of var) = %p\0A\00"
@.str.5 = [35 x i8] c"deref varPtr (value of var) = %d\0A\00"
@.str.6 = [47 x i8] c"contents of ptrToVarPtr (addr of varPtr) = %p\0A\00"
@.str.7 = [60 x i8] c"deref of ptrToVarPtr (value of varPtr -> addr of var) = %p\0A\00"
@.str.8 = [85 x i8] c"deref deref of ptrToVarPtr (value of varPtr -> addr of var -> contents of var) = %d\0A\00"
@.str.9 = [57 x i8] c"contents of ptrToptrToVarPtr (addr of ptrToVarPtr) = %p\0A\00"
@.str.10 = [78 x i8] c"deref of ptrToptrToVarPtr (value of ptrToVarPtr -> addr of ptrTovarPtr) = %p\0A\00"
@.str.11 = [114 x i8] c"deref deref of ptrToptrToVarPtr (value of ptrToVarPtr -> value of varPtr -> addr of var -> contents of var) = %p\0A\00"
@.str.12 = [114 x i8] c"deref deref of ptrToptrToVarPtr (value of ptrToVarPtr -> value of varPtr -> addr of var -> contents of var) = %d\0A\00"
@str.15 = [2 x i8] c"\0D\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32**
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.15, i64 0, i64 0))
%5 = bitcast i32* %1 to i8*
store i32 5, i32* %1
%6 = bitcast i32** %2 to i8*
store i32* %1, i32** %2
%7 = bitcast i32*** %3 to i8*
store i32** %2, i32*** %3
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32** %2)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32*** %3)
%11 = load i32*, i32** %2
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i32* %11)
%13 = load i32*, i32** %2
%14 = load i32, i32* %13
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i32 %14)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.15, i64 0, i64 0))
%17 = load i32**, i32*** %3
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i32** %17)
%19 = load i32**, i32*** %3
%20 = load i32*, i32** %19
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.7, i64 0, i64 0), i32* %20)
%22 = load i32**, i32*** %3
%23 = load i32*, i32** %22
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @.str.8, i64 0, i64 0), i32 %24)
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.15, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.9, i64 0, i64 0), i32*** %3)
%28 = load i32**, i32*** %3
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @.str.10, i64 0, i64 0), i32** %28)
%30 = load i32**, i32*** %3
%31 = load i32*, i32** %30
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([114 x i8], [114 x i8]* @.str.11, i64 0, i64 0), i32* %31)
%33 = load i32**, i32*** %3
%34 = load i32*, i32** %33
%35 = load i32, i32* %34
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([114 x i8], [114 x i8]* @.str.12, i64 0, i64 0), i32 %35)
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.15, i64 0, i64 0))
ret i32 0
}