#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 num = 23;
  int *ptr;
  ptr = &num;
  printf("Num = %i\n", num);
  printf("Num = %i\n", *ptr);
  num = 179;
  printf("Num = %i\n", num);
  printf("Num = %i\n", *ptr);
  *ptr = 255;
  printf("Num = %i\n", num);
  printf("Num = %i\n", *ptr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x17,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
movl   $0xb3,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movl   $0xff,(%rax)
mov    -0x8(%rbp),%esi
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x17,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x17,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xb3,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xb3,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xff,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xff,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"Num = %i\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 23)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 23)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 179)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 179)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 255)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 255)
ret i32 0
}