#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*/ memset(void *, int, size_t const);
int /*<<< orphan*/ printf(char *, size_t const);
void f2(void) {
  const size_t ARR_SIZE = 4;
  int a[ARR_SIZE];
  const size_t n = sizeof(int) * ARR_SIZE;
  printf("%ld\n", n);
  void *p = a;
  printf("Pointer value Old - %lx\n", (unsigned long int)p);
  memset(p, 97, n + 48);
  printf("Pointer value New - %lx\n", (unsigned long int)p);
  printf("Pointer value Reset Increment - %lx\n", (unsigned long int)p);
  { printf("%c ", (*(char *)(p + 18))); }
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movq   $0x4,-0x8(%rbp)
mov    %rsp,%rax
mov    %rax,-0x10(%rbp)
movq   $0x10,-0x18(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x10,%esi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    $0x61,%esi
mov    $0x40,%edx
call   1040 <memset@plt>
mov    -0x20(%rbp),%rsi
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
movsbq 0x12(%rax),%rsi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
mov    $0x10,%esi
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0x40,%edx
mov    %rbx,%rdi
mov    $0x61,%esi
call   1040 <memset@plt>
lea    0xebd(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
movsbq 0x12(%rsp),%rsi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%ld\0A\00"
@.str.1 = [25 x i8] c"Pointer value Old - %lx\0A\00"
@.str.2 = [25 x i8] c"Pointer value New - %lx\0A\00"
@.str.3 = [37 x i8] c"Pointer value Reset Increment - %lx\0A\00"
@.str.4 = [4 x i8] c"%c \00"
define void @f2() {
%1 = alloca i64
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i64 4, i64* %1
%5 = call i8* @llvm.stacksave()
store i8* %5, i8** %2
%6 = alloca i32, i64 4
store i64 16, i64* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 16)
%8 = bitcast i32* %6 to i8*
store i8* %8, i8** %4
%9 = load i8*, i8** %4
%10 = ptrtoint i8* %9 to i64
%11 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i64 %10)
%12 = load i8*, i8** %4
%13 = call i32 @memset(i8* %12, i32 97, i64 64)
%14 = load i8*, i8** %4
%15 = ptrtoint i8* %14 to i64
%16 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i64 %15)
%17 = load i8*, i8** %4
%18 = ptrtoint i8* %17 to i64
%19 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i64 %18)
%20 = load i8*, i8** %4
%21 = getelementptr i8, i8* %20, i64 18
%22 = load i8, i8* %21
%23 = sext i8 %22 to i64
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i64 %23)
%25 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%ld\0A\00"
@.str.1 = [25 x i8] c"Pointer value Old - %lx\0A\00"
@.str.2 = [25 x i8] c"Pointer value New - %lx\0A\00"
@.str.3 = [37 x i8] c"Pointer value Reset Increment - %lx\0A\00"
@.str.4 = [4 x i8] c"%c \00"
define void @f2() {
%1 = alloca [4 x i32]
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 16)
%3 = bitcast [4 x i32]* %1 to i8*
%4 = ptrtoint [4 x i32]* %1 to i64
%5 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i64 %4)
%6 = call i32 @memset(i8* %3, i32 97, i64 64)
%7 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i64 %4)
%8 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i64 %4)
%9 = getelementptr i8, i8* %3, i64 18
%10 = load i8, i8* %9
%11 = sext i8 %10 to i64
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i64 %11)
ret void
}