#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 *, void *, int);
int main() {
  char char_array[5] = {'a', 'b', 'c', 'd', 'e'};
  int int_array[5] = {1, 2, 3, 4, 5};
  unsigned long hacky_nonpointer;
  hacky_nonpointer = (unsigned long)char_array;
  for (int i = 0; i < 5; ++i) {
    printf("[hacky_nonpointer] points to %p, which contains the char '%c'\n",
           (void *)hacky_nonpointer, *((char *)hacky_nonpointer));
    hacky_nonpointer = hacky_nonpointer + sizeof(char);
  }
  hacky_nonpointer = (unsigned long)int_array;
  for (int i = 0; i < 5; ++i) {
    printf("[hacky_nonpointer] points to %p, which contains the integer %d\n",
           (void *)hacky_nonpointer, *((int *)hacky_nonpointer));
    hacky_nonpointer = hacky_nonpointer + sizeof(int);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xed6(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xed8(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed5(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed3(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x9(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x5,-0x2c(%rbp)
jge    119a <main+0x8a>
mov    -0x28(%rbp),%rsi
mov    -0x28(%rbp),%rax
movsbl (%rax),%edx
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    115f <main+0x4f>
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x30(%rbp)
cmpl   $0x5,-0x30(%rbp)
jge    11e3 <main+0xd3>
mov    -0x28(%rbp),%rsi
mov    -0x28(%rbp),%rax
mov    (%rax),%edx
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11a9 <main+0x99>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
movb   $0x65,0xc(%rsp)
movl   $0x64636261,0x8(%rsp)
64
lea    0xc(%rsp),%r15
mov    0xeef(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x20(%rsp),%r14
lea    0xed7(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x61,%edx
call   1030 <printf@plt>
lea    0x9(%rsp),%rsi
movsbl 0x9(%rsp),%edx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xa(%rsp),%rsi
movsbl 0xa(%rsp),%edx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xb(%rsp),%rsi
movsbl 0xb(%rsp),%edx
mov    %rbx,%rdi
call   1030 <printf@plt>
movsbl 0xc(%rsp),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
mov    0x10(%rsp),%edx
lea    0xeb3(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    0x14(%rsp),%edx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x18(%rsp),%rsi
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x1c(%rsp),%rsi
mov    0x1c(%rsp),%edx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x20(%rsp),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.char_array = [5 x i8] c"abcde"
@__const.main.int_array = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@.str = [63 x i8] c"[hacky_nonpointer] points to %p, which contains the char '%c'\0A\00"
@.str.1 = [64 x i8] c"[hacky_nonpointer] points to %p, which contains the integer %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i8]
%3 = alloca [5 x i32]
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [5 x i8]* %2 to i8*
%8 = bitcast [5 x i32]* %3 to i8*
%9 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%10 = ptrtoint i8* %9 to i64
store i64 %10, i64* %4
store i32 0, i32* %5
br label %11
11: ; preds = %24, %0
%12 = load i32, i32* %5
%13 = icmp slt i32 %12, 5
br i1 %13, label %14, label %27
14: ; preds = %11
%15 = load i64, i64* %4
%16 = inttoptr i64 %15 to i8*
%17 = load i64, i64* %4
%18 = inttoptr i64 %17 to i8*
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i8* %16, i32 %20)
%22 = load i64, i64* %4
%23 = add i64 %22, 1
store i64 %23, i64* %4
br label %24
24: ; preds = %14
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %11
27: ; preds = %11
%28 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%29 = ptrtoint i32* %28 to i64
store i64 %29, i64* %4
store i32 0, i32* %6
br label %30
30: ; preds = %42, %27
%31 = load i32, i32* %6
%32 = icmp slt i32 %31, 5
br i1 %32, label %33, label %45
33: ; preds = %30
%34 = load i64, i64* %4
%35 = inttoptr i64 %34 to i8*
%36 = load i64, i64* %4
%37 = inttoptr i64 %36 to i32*
%38 = load i32, i32* %37
%39 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i8* %35, i32 %38)
%40 = load i64, i64* %4
%41 = add i64 %40, 4
store i64 %41, i64* %4
br label %42
42: ; preds = %33
%43 = load i32, i32* %6
%44 = add nsw i32 %43, 1
store i32 %44, i32* %6
br label %30
45: ; preds = %30
ret i32 0
}

LLVM IR (-O2):
@__const.main.char_array = [5 x i8] c"abcde"
@__const.main.int_array = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@.str = [63 x i8] c"[hacky_nonpointer] points to %p, which contains the char '%c'\0A\00"
@.str.1 = [64 x i8] c"[hacky_nonpointer] points to %p, which contains the integer %d\0A\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = alloca [5 x i32]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%4 = bitcast [5 x i32]* %2 to i8*
%5 = ptrtoint [5 x i8]* %1 to i64
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %8)
%10 = add i64 %5, 1
%11 = inttoptr i64 %10 to i8*
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i8* %11, i32 %13)
%15 = add i64 %5, 2
%16 = inttoptr i64 %15 to i8*
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i8* %16, i32 %18)
%20 = add i64 %5, 3
%21 = inttoptr i64 %20 to i8*
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i8* %21, i32 %23)
%25 = add i64 %5, 4
%26 = inttoptr i64 %25 to i8*
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i8* %26, i32 %28)
%30 = ptrtoint [5 x i32]* %2 to i64
%31 = bitcast [5 x i32]* %2 to i8*
%32 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%33 = load i32, i32* %32
%34 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i8* %31, i32 %33)
%35 = or i64 %30, 4
%36 = inttoptr i64 %35 to i8*
%37 = inttoptr i64 %35 to i32*
%38 = load i32, i32* %37
%39 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i8* %36, i32 %38)
%40 = or i64 %30, 8
%41 = inttoptr i64 %40 to i8*
%42 = inttoptr i64 %40 to i32*
%43 = load i32, i32* %42
%44 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i8* %41, i32 %43)
%45 = or i64 %30, 12
%46 = inttoptr i64 %45 to i8*
%47 = inttoptr i64 %45 to i32*
%48 = load i32, i32* %47
%49 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i8* %46, i32 %48)
%50 = add i64 %30, 16
%51 = inttoptr i64 %50 to i8*
%52 = inttoptr i64 %50 to i32*
%53 = load i32, i32* %52
%54 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i8* %51, i32 %53)
ret i32 0
}