#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() {
  int value, *pv, **ppv;
  value = 971;
  pv = (int *)&ppv;
  printf("Contenuto pv: %p - Indirizzo pv: %p\n", pv, &pv);
  ppv = &pv;
  printf("Contenuto ppv: %p - Indirizzo ppv: %p\n", ppv, &ppv);
  printf("%d %d %d\n", value, *pv, **ppv);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3cb,-0x8(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec7(%rip),%rdi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xece(%rip),%rdi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%ecx
lea    0xed1(%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    0x8(%rsp),%r14
mov    %r14,0x10(%rsp)
lea    0xed8(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,0x8(%rsp)
lea    0xedf(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%rax
mov    (%rax),%edx
mov    0x8(%rsp),%rax
mov    (%rax),%rax
mov    (%rax),%ecx
lea    0xee1(%rip),%rdi
mov    $0x3cb,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Contenuto pv: %p - Indirizzo pv: %p\0A\00"
@.str.1 = [39 x i8] c"Contenuto ppv: %p - Indirizzo ppv: %p\0A\00"
@.str.2 = [10 x i8] c"%d %d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32**
store i32 0, i32* %1
store i32 971, i32* %2
%5 = bitcast i32*** %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32* %6, i32** %3)
store i32** %3, i32*** %4
%8 = load i32**, i32*** %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32** %8, i32*** %4)
%10 = load i32, i32* %2
%11 = load i32*, i32** %3
%12 = load i32, i32* %11
%13 = load i32**, i32*** %4
%14 = load i32*, i32** %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %10, i32 %12, i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"Contenuto pv: %p - Indirizzo pv: %p\0A\00"
@.str.1 = [39 x i8] c"Contenuto ppv: %p - Indirizzo ppv: %p\0A\00"
@.str.2 = [10 x i8] c"%d %d %d\0A\00"
define i32 @main() {
%1 = alloca i32*
%2 = alloca i32**
%3 = bitcast i32** %1 to i8*
%4 = bitcast i32*** %2 to i8*
%5 = bitcast i32** %1 to i32****
store i32*** %2, i32**** %5
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32*** %2, i32** %1)
store i32** %1, i32*** %2
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32** %1, i32*** %2)
%8 = load i32*, i32** %1
%9 = load i32, i32* %8
%10 = load i32**, i32*** %2
%11 = load i32*, i32** %10
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 971, i32 %9, i32 %12)
ret i32 0
}