#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 *, ...);
void pointers_to_variables(void) {
  printf("\n[1] ----------------------------\n\n");
  printf("Pointers to variables:\n");
  int a = 32, b = a;
  int *c = &(a), *d = &(b), *e = NULL;
  *c = 16;
  e = c;
  printf("Memory Address of 'a': %p\n", c);
  printf("Value of 'a': %i\n\n", *e);
  printf("Memory Address of 'b': %p\n", d);
  printf("Value of 'b': %i\n\n", *d);
}


x86 assembly (clang, -O0):
<pointers_to_variables>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x20,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x10,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pointers_to_variables>:
push   %rax
lea    0xf34(%rip),%rdi
call   1030 <puts@plt>
lea    0xf4b(%rip),%rdi
call   1030 <puts@plt>
movl   $0x20,(%rsp)
movl   $0x10,0x4(%rsp)
lea    0xeb1(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeba(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%esi
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [36 x i8] c"\0A[1] ----------------------------\0A\0A\00"
@.str.1 = [24 x i8] c"Pointers to variables:\0A\00"
@.str.2 = [27 x i8] c"Memory Address of 'a': %p\0A\00"
@.str.3 = [19 x i8] c"Value of 'a': %i\0A\0A\00"
@.str.4 = [27 x i8] c"Memory Address of 'b': %p\0A\00"
@.str.5 = [19 x i8] c"Value of 'b': %i\0A\0A\00"
define void @pointers_to_variables() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
store i32 32, i32* %1
%8 = load i32, i32* %1
store i32 %8, i32* %2
store i32* %1, i32** %3
store i32* %2, i32** %4
store i32* null, i32** %5
%9 = load i32*, i32** %3
store i32 16, i32* %9
%10 = load i32*, i32** %3
store i32* %10, i32** %5
%11 = load i32*, i32** %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32* %11)
%13 = load i32*, i32** %5
%14 = load i32, i32* %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = load i32*, i32** %4
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32* %16)
%18 = load i32*, i32** %4
%19 = load i32, i32* %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %19)
ret void
}

LLVM IR (-O2):
@.str.2 = [27 x i8] c"Memory Address of 'a': %p\0A\00"
@.str.3 = [19 x i8] c"Value of 'a': %i\0A\0A\00"
@.str.4 = [27 x i8] c"Memory Address of 'b': %p\0A\00"
@.str.5 = [19 x i8] c"Value of 'b': %i\0A\0A\00"
@str = [35 x i8] c"\0A[1] ----------------------------\0A\00"
@str.6 = [23 x i8] c"Pointers to variables:\00"
define void @pointers_to_variables() {
%1 = alloca i32
%2 = alloca i32
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.6, i64 0, i64 0))
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
store i32 32, i32* %2
store i32 16, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %11)
ret void
}