#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 const, ...);
int main03() {
  int i = 0x12345678;
  unsigned char *p = &i;
  printf("%x, %x, %x, %x\n", p[0], p[1], p[2], p[3]);
  const int *p1 = &i;
  printf("i = %x\n", *p1);
  int *const p2 = &i;
  *p2 = 100;
  int i1 = 0;
  p1 = &i1;
  printf("i = %d\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main03>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x12345678,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%esi
mov    -0x10(%rbp),%rax
movzbl 0x1(%rax),%edx
mov    -0x10(%rbp),%rax
movzbl 0x2(%rax),%ecx
mov    -0x10(%rbp),%rax
movzbl 0x3(%rax),%r8d
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x4(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x64,(%rax)
movl   $0x0,-0x24(%rbp)
lea    -0x24(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main03>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x78,%esi
mov    $0x56,%edx
mov    $0x34,%ecx
mov    $0x12,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x12345678,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"%x, %x, %x, %x\0A\00"
@.str.1 = [8 x i8] c"i = %x\0A\00"
@.str.2 = [8 x i8] c"i = %d\0A\00"
define i32 @main03() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 120, i32 86, i32 52, i32 18)
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 305419896)
%3 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 100)
ret i32 0
}