#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 main() {
  int *p, a = 4, b = 5;
  p = &b;
  *p *= 2;
  printf("b=%d *p=%d\n", b, *p);
  printf("&b=%p p=%p &p=%p\n", &b, p, &p);
  b = *p * 3;
  printf("b=%d *p=%d\n", b, *p);
  printf("&b=%p p=%p\n", &b, p);
  a = b;
  p = &a;
  (*p)++;
  printf("b=%d a=%d *p=%d\n", b, a, *p);
  printf("&b=%p &a=%p p=%p &p=%p\n", &b, &a, p, &p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x14(%rbp)
movl   $0x5,-0x18(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
shl    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdx
lea    0xeaa(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x10(%rbp),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
imul   $0x3,(%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdx
lea    0xe81(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rcx
lea    0xe55(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x10(%rbp),%r8
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0x4(%rsp),%r12
mov    %r12,0x8(%rsp)
movl   $0xa,0x4(%rsp)
lea    0xecc(%rip),%r15
mov    %r15,%rdi
mov    $0xa,%esi
mov    $0xa,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
lea    0x8(%rsp),%r14
mov    %r12,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%rax
mov    (%rax),%ecx
lea    (%rcx,%rcx,2),%esi
mov    %esi,0x4(%rsp)
mov    (%rax),%edx
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%rdx
lea    0xe94(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
lea    0x14(%rsp),%rbx
mov    %rbx,0x8(%rsp)
lea    0x1(%rsi),%ecx
mov    %ecx,0x14(%rsp)
lea    0xe7a(%rip),%rdi
mov    %ecx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%rcx
lea    0xe76(%rip),%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r14,%r8
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"b=%d *p=%d\0A\00"
@.str.1 = [18 x i8] c"&b=%p p=%p &p=%p\0A\00"
@.str.2 = [12 x i8] c"&b=%p p=%p\0A\00"
@.str.3 = [17 x i8] c"b=%d a=%d *p=%d\0A\00"
@.str.4 = [24 x i8] c"&b=%p &a=%p p=%p &p=%p\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 4, i32* %3
store i32 5, i32* %4
store i32* %4, i32** %2
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
%7 = mul nsw i32 %6, 2
store i32 %7, i32* %5
%8 = load i32, i32* %4
%9 = load i32*, i32** %2
%10 = load i32, i32* %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %10)
%12 = load i32*, i32** %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %12, i32** %2)
%14 = load i32*, i32** %2
%15 = load i32, i32* %14
%16 = mul nsw i32 %15, 3
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = load i32*, i32** %2
%19 = load i32, i32* %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %19)
%21 = load i32*, i32** %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %4, i32* %21)
%23 = load i32, i32* %4
store i32 %23, i32* %3
store i32* %3, i32** %2
%24 = load i32*, i32** %2
%25 = load i32, i32* %24
%26 = add nsw i32 %25, 1
store i32 %26, i32* %24
%27 = load i32, i32* %4
%28 = load i32, i32* %3
%29 = load i32*, i32** %2
%30 = load i32, i32* %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %27, i32 %28, i32 %30)
%32 = load i32*, i32** %2
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32* %4, i32* %3, i32* %32, i32** %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"b=%d *p=%d\0A\00"
@.str.1 = [18 x i8] c"&b=%p p=%p &p=%p\0A\00"
@.str.2 = [12 x i8] c"&b=%p p=%p\0A\00"
@.str.3 = [17 x i8] c"b=%d a=%d *p=%d\0A\00"
@.str.4 = [24 x i8] c"&b=%p &a=%p p=%p &p=%p\0A\00"
define i32 @main() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32** %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
store i32* %3, i32** %1
store i32 10, i32* %3
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 10, i32 10)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %3, i32** %1)
%9 = load i32*, i32** %1
%10 = load i32, i32* %9
%11 = mul nsw i32 %10, 3
store i32 %11, i32* %3
%12 = load i32, i32* %9
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12)
%14 = load i32*, i32** %1
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %14)
%16 = load i32, i32* %3
store i32* %2, i32** %1
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %16, i32 %17, i32 %17)
%19 = load i32*, i32** %1
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32* %3, i32* %2, i32* %19, i32** %1)
ret i32 0
}