#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 main(int argc, char *argv[]) {
  int i;
  unsigned char array[8] = {0xF0, 0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12};
  for (i = 0; i < 8; ++i)
    printf("addr: %p, val: 0x%2X\n", &array[i], array[i]);
  unsigned char *r0 = 0;
  r0 = array;
  printf("r0 = 0x%2X\n", *r0);
  unsigned short *r2 = 0;
  r2 = (unsigned short *)(array + 2);
  printf("r2 = 0x%4X\n", *r2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xed3(%rip),%rax
mov    %rax,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    1172 <main+0x62>
movslq -0x14(%rbp),%rax
lea    -0x1c(%rbp),%rsi
add    %rax,%rsi
movslq -0x14(%rbp),%rax
movzbl -0x1c(%rbp,%rax,1),%edx
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1138 <main+0x28>
movq   $0x0,-0x28(%rbp)
lea    -0x1c(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movzbl (%rax),%esi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x30(%rbp)
lea    -0x1c(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movzwl (%rax),%esi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x123456789abcdef0,%rax
56 34 12
mov    %rax,0x8(%rsp)
lea    0xed5(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
mov    $0xf0,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x9(%rsp),%rsi
movzbl 0x9(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xa(%rsp),%rsi
movzbl 0xa(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xb(%rsp),%rsi
movzbl 0xb(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
movzbl 0xc(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd(%rsp),%rsi
movzbl 0xd(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe(%rsp),%rsi
movzbl 0xe(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf(%rsp),%rsi
movzbl 0xf(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movzbl 0x8(%rsp),%esi
lea    0xe3f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movzwl 0xa(%rsp),%esi
lea    0xe38(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.array = [8 x i8] c"\F0\DE\BC\9AxV4\12"
@.str = [22 x i8] c"addr: %p, val: 0x%2X\0A\00"
@.str.1 = [12 x i8] c"r0 = 0x%2X\0A\00"
@.str.2 = [12 x i8] c"r2 = 0x%4X\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [8 x i8]
%8 = alloca i8*
%9 = alloca i16*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [8 x i8]* %7 to i8*
store i32 0, i32* %6
br label %11
11: ; preds = %24, %2
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 8
br i1 %13, label %14, label %27
14: ; preds = %11
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 %16
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %17, i32 %22)
br label %24
24: ; preds = %14
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %11
27: ; preds = %11
store i8* null, i8** %8
%28 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 0
store i8* %28, i8** %8
%29 = load i8*, i8** %8
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %31)
store i16* null, i16** %9
%33 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 0
%34 = getelementptr inbounds i8, i8* %33, i64 2
%35 = bitcast i8* %34 to i16*
store i16* %35, i16** %9
%36 = load i16*, i16** %9
%37 = load i16, i16* %36
%38 = zext i16 %37 to i32
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %38)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"addr: %p, val: 0x%2X\0A\00"
@.str.1 = [12 x i8] c"r0 = 0x%2X\0A\00"
@.str.2 = [12 x i8] c"r2 = 0x%4X\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to [8 x i8]*
%5 = bitcast i64* %3 to i8*
store i64 1311768467463790320, i64* %3
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i64* %3, i32 240)
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 1
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %9)
%11 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 2
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %11, i32 %13)
%15 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 3
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %15, i32 %17)
%19 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 4
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %19, i32 %21)
%23 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 5
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %23, i32 %25)
%27 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 6
%28 = load i8, i8* %27
%29 = zext i8 %28 to i32
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %27, i32 %29)
%31 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 7
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %31, i32 %33)
%35 = load i8, i8* %5
%36 = zext i8 %35 to i32
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = getelementptr inbounds i8, i8* %5, i64 2
%39 = bitcast i8* %38 to i16*
%40 = load i16, i16* %39
%41 = zext i16 %40 to i32
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %41)
ret i32 0
}