#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 i, *p, **q;
  i = 5;
  p = &i;
  q = &p;
  printf("i adres: %p\n", &i);
  printf("i adres: %p\n", p);
  printf("p adres: %p\n", &p);
  printf("p adres: %p\n", q);
  printf("q adres: %p\n", &q);
  printf("i degeri: %d\n", **q);
  **q = 10;
  printf("i degeri: %d\n", **q);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeac(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movl   $0xa,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
lea    0xe63(%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
movl   $0x5,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    %rsi,0x10(%rsp)
lea    0x10(%rsp),%r14
mov    %r14,(%rsp)
lea    0xec7(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb4(%rip),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea0(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
lea    0xe93(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%rax
mov    (%rax),%rax
movl   $0xa,(%rax)
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [13 x i8] c"i adres: %p\0A\00"
@.str.1 = [13 x i8] c"p adres: %p\0A\00"
@.str.2 = [13 x i8] c"q adres: %p\0A\00"
@.str.3 = [14 x i8] c"i degeri: %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 5, i32* %2
store i32* %2, i32** %3
store i32** %3, i32*** %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32*, i32** %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32** %3)
%9 = load i32**, i32*** %4
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32** %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32*** %4)
%12 = load i32**, i32*** %4
%13 = load i32*, i32** %12
%14 = load i32, i32* %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = load i32**, i32*** %4
%17 = load i32*, i32** %16
store i32 10, i32* %17
%18 = load i32**, i32*** %4
%19 = load i32*, i32** %18
%20 = load i32, i32* %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"i adres: %p\0A\00"
@.str.1 = [13 x i8] c"p adres: %p\0A\00"
@.str.2 = [13 x i8] c"q adres: %p\0A\00"
@.str.3 = [14 x i8] c"i degeri: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32**
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32** %2 to i8*
%6 = bitcast i32*** %3 to i8*
store i32 5, i32* %1
store i32* %1, i32** %2
store i32** %2, i32*** %3
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32*, i32** %2
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32* %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32** %2)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32** %2)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32*** %3)
%13 = load i32**, i32*** %3
%14 = load i32*, i32** %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = load i32**, i32*** %3
%18 = load i32*, i32** %17
store i32 10, i32* %18
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 10)
ret i32 0
}