#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 *, char);
int main(int argc, char *argv[]) {
  unsigned int a = 0x04030201;
  char *p = (char *)&a;
  printf("p[0]:%0.2x\n", *p);
  printf("p[1]:%0.2x\n", *(p + 1));
  printf("p[2]:%0.2x\n", *(p + 2));
  printf("p[3]:%0.2x\n", *(p + 3));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x4030201,-0x14(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
lea    0xec0(%rip),%rdi
movsbl (%rax),%esi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
lea    0xeb9(%rip),%rdi
movsbl 0x1(%rax),%esi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
lea    0xeb1(%rip),%rdi
movsbl 0x2(%rax),%esi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
lea    0xea9(%rip),%rdi
movsbl 0x3(%rax),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"p[0]:%0.2x\0A\00"
@.str.1 = [12 x i8] c"p[1]:%0.2x\0A\00"
@.str.2 = [12 x i8] c"p[2]:%0.2x\0A\00"
@.str.3 = [12 x i8] c"p[3]:%0.2x\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 signext 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8 signext 2)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8 signext 3)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8 signext 4)
ret i32 0
}