#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*/ cant_change(int *, int *);
int /*<<< orphan*/ change(int **, int *);
int /*<<< orphan*/ printf(char *, int *);
int main() {
  int c = 1;
  int d = 2;
  int e = 3;
  int *a = &c;
  int *b = &d;
  int *f = &e;
  int **pp = &a;
  printf("\n A value: %p \n", a);
  printf("\n B value: %p \n", b);
  printf("\n F value: %p \n", f);
  a = b;
  printf("\n A = B : %p, \n", a);
  cant_change(a, f);
  printf("\n cant_change(a, f): %p \n", a);
  change(pp, f);
  printf("\n change(pp, f): %p\n", a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
movl   $0x3,-0x10(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <cant_change@plt>
mov    -0x18(%rbp),%rsi
lea    0xe6c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <change@plt>
mov    -0x18(%rbp),%rsi
lea    0xe69(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movl   $0x1,0xc(%rsp)
movl   $0x2,0x8(%rsp)
movl   $0x3,0x4(%rsp)
lea    0xeaa(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <printf@plt>
lea    0xea9(%rip),%rdi
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0xea5(%rip),%rdi
lea    0x4(%rsp),%r14
mov    %r14,%rsi
call   1040 <printf@plt>
mov    %rbx,0x10(%rsp)
lea    0xe9c(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <cant_change@plt>
lea    0xe92(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    0x10(%rsp),%rdi
mov    %r14,%rsi
call   1030 <change@plt>
mov    0x10(%rsp),%rsi
lea    0xe8b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"\0A A value: %p \0A\00"
@.str.1 = [16 x i8] c"\0A B value: %p \0A\00"
@.str.2 = [16 x i8] c"\0A F value: %p \0A\00"
@.str.3 = [16 x i8] c"\0A A = B : %p, \0A\00"
@.str.4 = [26 x i8] c"\0A cant_change(a, f): %p \0A\00"
@.str.5 = [21 x i8] c"\0A change(pp, f): %p\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%6 = bitcast i32* %2 to i8*
store i32 2, i32* %2
%7 = bitcast i32* %3 to i8*
store i32 3, i32* %3
%8 = bitcast i32** %4 to i8*
%9 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32* %1)
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32* %3)
store i32* %2, i32** %4
%12 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%13 = call i32 @cant_change(i32* %2, i32* %3)
%14 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%15 = call i32 @change(i32** %4, i32* %3)
%16 = load i32*, i32** %4
%17 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i32* %16)
ret i32 0
}