main() {
  int j = 9, x = 5, y = 3, z = 8;
  int *p;
  p = &z;
  p = &y;
  *p = 11;
  printf("The value of x is %d.\n", x);
  printf("The value of y is %d.\n", y);
  printf("The address of x is %d %d %d %d.\n", &j, &x, &y, &z);
  printf("The value of pointer is %d.\n", p);
  printf("The value of pointer is %p.\n", p);
  p = 11;
  printf("The value of pointer is %d.\n", p);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x9,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
movl   $0x8,-0x10(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0xb,(%rax)
mov    -0x8(%rbp),%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xb,%eax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe8a(%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   $0x9,0x14(%rsp)
movl   $0x5,0x10(%rsp)
movl   $0x8,0x8(%rsp)
movl   $0xb,0xc(%rsp)
lea    0xec2(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
mov    $0xb,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rbx
lea    0x8(%rsp),%r8
mov    %rbx,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec7(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xb,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"The value of x is %d.\0A\00"
@.str.1 = [23 x i8] c"The value of y is %d.\0A\00"
@.str.2 = [34 x i8] c"The address of x is %d %d %d %d.\0A\00"
@.str.3 = [29 x i8] c"The value of pointer is %d.\0A\00"
@.str.4 = [29 x i8] c"The value of pointer is %p.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 9, i32* %1
store i32 5, i32* %2
store i32 3, i32* %3
store i32 8, i32* %4
store i32* %4, i32** %5
store i32* %3, i32** %5
%6 = load i32*, i32** %5
store i32 11, i32* %6
%7 = load i32, i32* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%12 = load i32*, i32** %5
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32* %12)
%14 = load i32*, i32** %5
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32* %14)
store i32* inttoptr (i64 11 to i32*), i32** %5
%16 = load i32*, i32** %5
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32* %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"The value of x is %d.\0A\00"
@.str.1 = [23 x i8] c"The value of y is %d.\0A\00"
@.str.2 = [34 x i8] c"The address of x is %d %d %d %d.\0A\00"
@.str.3 = [29 x i8] c"The value of pointer is %d.\0A\00"
@.str.4 = [29 x i8] c"The value of pointer is %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 9, i32* %1
%6 = bitcast i32* %2 to i8*
store i32 5, i32* %2
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
store i32 8, i32* %4
store i32 11, i32* %3
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 5)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 11)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32* inttoptr (i64 11 to i32*))
ret i32 0
}