#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 argc, char **argv) {
  int *ptr;
  int x;
  ptr = &x;
  *ptr = 0;
  printf(" x = %dn", x);
  printf(" *ptr = %dn", *ptr);
  *ptr += 5;
  printf(" x  = %dn", x);
  printf(" *ptr = %dn", *ptr);
  (*ptr)++;
  printf(" x = %dn", x);
  printf(" *ptr = %dn", *ptr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x1c(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x1c(%rbp),%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x5,%ecx
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%esi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%esi
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xe5d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
lea    0xedd(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c" x = %dn\00"
@.str.1 = [12 x i8] c" *ptr = %dn\00"
@.str.2 = [10 x i8] c" x = %dn\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 0)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 5)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 6)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 6)
ret i32 0
}