#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*/ memcpy(char *, void *, int);
int /*<<< orphan*/ printf(char *, ...);
unsigned int strtoul(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
void main() {
  char sAddr[] = "0x008721F8";
  unsigned int uAddr = strtoul(sAddr, NULL, 0);
  void *pAddr = (void *)uAddr;
  char *temp;
  memcpy(temp, pAddr, 100);
  printf("%p \n", pAddr);
  printf("This is before\n");
  printf("This is data :\n%s", temp);
  printf("This is after\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0xb(%rbp)
mov    0xebe(%rip),%ax
mov    %ax,-0x3(%rbp)
mov    0xeb6(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0xb(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1050 <strtoul@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x64,%edx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rsi
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x3132373830307830,%rax
37 32 31
mov    %rax,(%rsp)
movl   $0x384631,0x7(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtoul@plt>
mov    %eax,%ebx
mov    %rbx,%rsi
mov    $0x64,%edx
call   1050 <memcpy@plt>
lea    0xe8e(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
lea    0xe76(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe89(%rip),%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@__const.main.sAddr = [11 x i8] c"0x008721F8\00"
@.str = [5 x i8] c"%p \0A\00"
@.str.1 = [16 x i8] c"This is before\0A\00"
@.str.2 = [18 x i8] c"This is data :\0A%s\00"
@.str.3 = [15 x i8] c"This is after\0A\00"
define void @main() {
%1 = alloca [11 x i8]
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = bitcast [11 x i8]* %1 to i8*
%6 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
%7 = call i32 @strtoul(i8* %6, i32* null, i32 0)
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %3
%11 = load i8*, i8** %4
%12 = load i8*, i8** %3
%13 = call i32 @memcpy(i8* %11, i8* %12, i32 100)
%14 = load i8*, i8** %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%17 = load i8*, i8** %4
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.main.sAddr = [11 x i8] c"0x008721F8\00"
@.str = [5 x i8] c"%p \0A\00"
@.str.2 = [18 x i8] c"This is data :\0A%s\00"
@str = [15 x i8] c"This is before\00"
@str.4 = [14 x i8] c"This is after\00"
define void @main() {
%1 = alloca [11 x i8]
%2 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
%3 = call i32 @strtoul(i8* nocapture %2, i32* null, i32 0)
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @memcpy(i8* undef, i8* %5, i32 100)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* undef)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.4, i64 0, i64 0))
ret void
}