#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 *, ...);
void normal_var_and_pointers() {
  int other = 20;
  int i = 10;
  int *ptrToVar = &i;
  int *const ptrToConstantLoc = &i;
  const int *ptrToConstantVar = &i;
  const int *const ptrToConstantVarAndLoc = &i;
  printf("\nOriginal value of i: %i", i);
  printf("\n\tIncrementing value of i via i.");
  i++;
  printf("\n\t\tNew value of i: %i", i);
  printf("\n\tDecrementing value of i via pointer `int * ptrToVar`.");
  --*ptrToVar;
  printf("\n\t\tNew value of i: %i", *ptrToVar);
  printf("\n\tIncrementing value of i via pointer to constant location: `int * "
         "const ptrToConstantLoc`.");
  ++*ptrToConstantLoc;
  printf("\n\t\tNew value of i: %i", *ptrToConstantLoc);
  printf("\n\tDecrementing value of i via pointer to constant var: `const int "
         "* ptrToConstantVar`.");
  printf("\nERROR: cannot decrement as to what it points cannot be modified "
         "for `const int * ptrToConstantVar`.");
  printf("\nINFO: Though we can point to entirely different variable.");
  ptrToConstantVar = &other;
  printf("\n\t\tNew value of i: %i", *ptrToConstantVar);
  printf("\n\tIncrementing value of i via pointer to constant var and "
         "location: `const int * const ptrToConstantVarAndLoc`.");
  printf("\nERROR: Cannot change location or value for `const int * const "
         "ptrToConstantVarAndLoc`.");
  printf("\n\t\tNew value of i: %i", *ptrToConstantVarAndLoc);
}


x86 assembly (clang, -O0):
<normal_var_and_pointers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x14,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0xffffffff,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfa4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x4(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x1017(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normal_var_and_pointers>:
push   %rbx
lea    0xee8(%rip),%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf01(%rip),%rbx
mov    %rbx,%rdi
mov    $0xb,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf01(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf1c(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf5b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xfa4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xffb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x1019(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x107b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"\0AOriginal value of i: %i\00"
@.str.1 = [33 x i8] c"\0A\09Incrementing value of i via i.\00"
@.str.2 = [22 x i8] c"\0A\09\09New value of i: %i\00"
@.str.3 = [56 x i8] c"\0A\09Decrementing value of i via pointer `int * ptrToVar`.\00"
@.str.4 = [92 x i8] c"\0A\09Incrementing value of i via pointer to constant location: `int * const ptrToConstantLoc`.\00"
@.str.5 = [87 x i8] c"\0A\09Decrementing value of i via pointer to constant var: `const int * ptrToConstantVar`.\00"
@.str.6 = [101 x i8] c"\0AERROR: cannot decrement as to what it points cannot be modified for `const int * ptrToConstantVar`.\00"
@.str.7 = [59 x i8] c"\0AINFO: Though we can point to entirely different variable.\00"
@.str.8 = [112 x i8] c"\0A\09Incrementing value of i via pointer to constant var and location: `const int * const ptrToConstantVarAndLoc`.\00"
@.str.9 = [88 x i8] c"\0AERROR: Cannot change location or value for `const int * const ptrToConstantVarAndLoc`.\00"
define void @normal_var_and_pointers() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32 20, i32* %1
store i32 10, i32* %2
store i32* %2, i32** %3
store i32* %2, i32** %4
store i32* %2, i32** %5
store i32* %2, i32** %6
%7 = load i32, i32* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0))
%15 = load i32*, i32** %3
%16 = load i32, i32* %15
%17 = add nsw i32 %16, -1
store i32 %17, i32* %15
%18 = load i32*, i32** %3
%19 = load i32, i32* %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str.4, i64 0, i64 0))
%22 = load i32*, i32** %4
%23 = load i32, i32* %22
%24 = add nsw i32 %23, 1
store i32 %24, i32* %22
%25 = load i32*, i32** %4
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str.5, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.6, i64 0, i64 0))
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.7, i64 0, i64 0))
store i32* %1, i32** %5
%31 = load i32*, i32** %5
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([112 x i8], [112 x i8]* @.str.8, i64 0, i64 0))
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.9, i64 0, i64 0))
%36 = load i32*, i32** %6
%37 = load i32, i32* %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %37)
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"\0AOriginal value of i: %i\00"
@.str.1 = [33 x i8] c"\0A\09Incrementing value of i via i.\00"
@.str.2 = [22 x i8] c"\0A\09\09New value of i: %i\00"
@.str.3 = [56 x i8] c"\0A\09Decrementing value of i via pointer `int * ptrToVar`.\00"
@.str.4 = [92 x i8] c"\0A\09Incrementing value of i via pointer to constant location: `int * const ptrToConstantLoc`.\00"
@.str.5 = [87 x i8] c"\0A\09Decrementing value of i via pointer to constant var: `const int * ptrToConstantVar`.\00"
@.str.6 = [101 x i8] c"\0AERROR: cannot decrement as to what it points cannot be modified for `const int * ptrToConstantVar`.\00"
@.str.7 = [59 x i8] c"\0AINFO: Though we can point to entirely different variable.\00"
@.str.8 = [112 x i8] c"\0A\09Incrementing value of i via pointer to constant var and location: `const int * const ptrToConstantVarAndLoc`.\00"
@.str.9 = [88 x i8] c"\0AERROR: Cannot change location or value for `const int * const ptrToConstantVarAndLoc`.\00"
define void @normal_var_and_pointers() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 10)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 11)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 10)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([92 x i8], [92 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 11)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([87 x i8], [87 x i8]* @.str.5, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([101 x i8], [101 x i8]* @.str.6, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.7, i64 0, i64 0))
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 20)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([112 x i8], [112 x i8]* @.str.8, i64 0, i64 0))
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([88 x i8], [88 x i8]* @.str.9, i64 0, i64 0))
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 11)
ret void
}