void main() {
  int i = 0;
  int *p;
  i = 123;
  printf("i = %d;\n", i);
  p = &i;
  printf("p = & ( i = %d ) = %d as digital, %p as pointer;\n\n", i, p, p);
  printf("* p = %d as digital, %p as pointer.\n", *p, *p);
  *p = *p + 100;
  printf("after adding *p = %d; i = %d;\n", *p, i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7b,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xf3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x64,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x4(%rbp),%edx
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x7b,0x4(%rsp)
lea    0xf4e(%rip),%rdi
mov    $0x7b,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    0x4(%rsp),%rcx
mov    $0x7b,%esi
mov    %rcx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%edx
lea    0xee1(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%edx
add    $0x64,%edx
mov    %edx,0x4(%rsp)
lea    0xeeb(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [9 x i8] c"i = %d;\0A\00"
@.str.1 = [51 x i8] c"p = & ( i = %d ) = %d as digital, %p as pointer;\0A\0A\00"
@.str.2 = [37 x i8] c"* p = %d as digital, %p as pointer.\0A\00"
@.str.3 = [31 x i8] c"after adding *p = %d; i = %d;\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
store i32 123, i32* %1
%3 = load i32, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %3)
store i32* %1, i32** %2
%5 = load i32, i32* %1
%6 = load i32*, i32** %2
%7 = load i32*, i32** %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32* %6, i32* %7)
%9 = load i32*, i32** %2
%10 = load i32, i32* %9
%11 = load i32*, i32** %2
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %10, i32 %12)
%14 = load i32*, i32** %2
%15 = load i32, i32* %14
%16 = add nsw i32 %15, 100
%17 = load i32*, i32** %2
store i32 %16, i32* %17
%18 = load i32*, i32** %2
%19 = load i32, i32* %18
%20 = load i32, i32* %1
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %19, i32 %20)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"i = %d;\0A\00"
@.str.1 = [51 x i8] c"p = & ( i = %d ) = %d as digital, %p as pointer;\0A\0A\00"
@.str.2 = [37 x i8] c"* p = %d as digital, %p as pointer.\0A\00"
@.str.3 = [31 x i8] c"after adding *p = %d; i = %d;\0A\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 123, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 123)
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i32 123, i32* %1, i32* %1)
%5 = load i32, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %5)
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 100
store i32 %8, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %8, i32 %8)
ret void
}