#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);
int main() {
  int x = 10, y;
  int *p, *q;
  p = &x;
  q = &y;
  y = *p;
  *p = 15;
  *q = 20;
  printf("Value of x: %d\n", x);
  printf("Value of y: %d\n", y);
  printf("Value of *p: %d\n", *p);
  printf("Value of *q: %d\n", *q);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
movl   $0xf,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x14,(%rax)
mov    -0x8(%rbp),%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xf,%esi
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
mov    $0x14,%esi
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
mov    $0xf,%esi
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
mov    $0x14,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"Value of x: %d\0A\00"
@.str.1 = [16 x i8] c"Value of y: %d\0A\00"
@.str.2 = [17 x i8] c"Value of *p: %d\0A\00"
@.str.3 = [17 x i8] c"Value of *q: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 15)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 20)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 15)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 20)
ret i32 0
}