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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0xd(%rbp)
mov    0xed6(%rip),%al
mov    %al,-0x9(%rbp)
mov    0xed8(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed5(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xed3(%rip),%eax
mov    %eax,-0x20(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0xd(%rbp),%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    11a3 <main+0x93>
mov    -0x40(%rbp),%rsi
mov    -0x40(%rbp),%rax
mov    (%rax),%edx
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1167 <main+0x57>
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    11e7 <main+0xd7>
mov    -0x38(%rbp),%rsi
mov    -0x38(%rbp),%rax
movsbl (%rax),%edx
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11aa <main+0x9a>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movb   $0x65,0xc(%rsp)
movl   $0x64636261,0x8(%rsp)
64
lea    0xc(%rsp),%r14
mov    0xef1(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xed6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xede(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x64636261,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    0x14(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x18(%rsp),%rsi
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb7(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x11(%rsp),%rsi
movsbl 0x11(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x12(%rsp),%rsi
movsbl 0x12(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x13(%rsp),%rsi
movsbl 0x13(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
movsbl 0x14(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
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 = [62 x i8] c"[integer pointer] points to %p, which contains the char '%c'\0A\00"
@.str.1 = [60 x i8] c"[char pointer] points to %p, which contains the integer %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [5 x i8]
%4 = alloca [5 x i32]
%5 = alloca i8*
%6 = alloca i32*
store i32 0, i32* %1
%7 = bitcast [5 x i8]* %3 to i8*
%8 = bitcast [5 x i32]* %4 to i8*
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 0
%10 = bitcast i32* %9 to i8*
store i8* %10, i8** %5
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%12 = bitcast i8* %11 to i32*
store i32* %12, i32** %6
store i32 0, i32* %2
br label %13
13: ; preds = %23, %0
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 5
br i1 %15, label %16, label %26
16: ; preds = %13
%17 = load i32*, i32** %6
%18 = load i32*, i32** %6
%19 = load i32, i32* %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i32* %17, i32 %19)
%21 = load i32*, i32** %6
%22 = getelementptr inbounds i32, i32* %21, i32 1
store i32* %22, i32** %6
br label %23
23: ; preds = %16
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %13
26: ; preds = %13
store i32 0, i32* %2
br label %27
27: ; preds = %38, %26
%28 = load i32, i32* %2
%29 = icmp slt i32 %28, 5
br i1 %29, label %30, label %41
30: ; preds = %27
%31 = load i8*, i8** %5
%32 = load i8*, i8** %5
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i8* %31, i32 %34)
%36 = load i8*, i8** %5
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %5
br label %38
38: ; preds = %30
%39 = load i32, i32* %2
%40 = add nsw i32 %39, 1
store i32 %40, i32* %2
br label %27
41: ; preds = %27
%42 = load i32, i32* %1
ret i32 %42
}

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 = [62 x i8] c"[integer pointer] points to %p, which contains the char '%c'\0A\00"
@.str.1 = [60 x i8] c"[char pointer] 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 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), [5 x i8]* %1, i32 1684234849)
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 4
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %7
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %8)
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 8
%11 = bitcast i8* %10 to i32*
%12 = load i32, i32* %11
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %12)
%14 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 12
%15 = bitcast i8* %14 to i32*
%16 = load i32, i32* %15
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i8* %14, i32 %16)
%18 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 16
%19 = bitcast i8* %18 to i32*
%20 = load i32, i32* %19
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i8* %18, i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), [5 x i32]* %2, i32 1)
%23 = getelementptr inbounds i8, i8* %4, i64 1
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i8* %23, i32 %25)
%27 = getelementptr inbounds i8, i8* %4, i64 2
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i8* %27, i32 %29)
%31 = getelementptr inbounds i8, i8* %4, i64 3
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i8* %31, i32 %33)
%35 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 1
%36 = bitcast i32* %35 to i8*
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i32* %35, i32 %38)
ret i32 0
}