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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%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    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x9(%rbp),%rax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x5,-0x34(%rbp)
jge    11a4 <main+0x94>
mov    -0x30(%rbp),%rsi
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
lea    0xea2(%rip),%rdi
movsbl %al,%edx
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1167 <main+0x57>
movl   $0x0,-0x38(%rbp)
cmpl   $0x5,-0x38(%rbp)
jge    11e6 <main+0xd6>
mov    -0x28(%rbp),%rsi
mov    -0x28(%rbp),%rax
lea    0xe9e(%rip),%rdi
movsbl (%rax),%edx
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x28(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11ab <main+0x9b>
xor    %eax,%eax
add    $0x40,%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>
lea    0xeb6(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
movsbl 0x14(%rsp),%edx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x18(%rsp),%rsi
movsbl 0x18(%rsp),%edx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x1c(%rsp),%rsi
movsbl 0x1c(%rsp),%edx
mov    %rbx,%rdi
call   1030 <printf@plt>
movsbl 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 = [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 [5 x i8]
%3 = alloca [5 x i32]
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [5 x i8]* %2 to i8*
%9 = bitcast [5 x i32]* %3 to i8*
%10 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%11 = bitcast i32* %10 to i8*
store i8* %11, i8** %4
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%13 = bitcast i8* %12 to i32*
store i32* %13, i32** %5
store i32 0, i32* %6
br label %14
14: ; preds = %28, %0
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 5
br i1 %16, label %17, label %31
17: ; preds = %14
%18 = load i32*, i32** %5
%19 = bitcast i32* %18 to i8*
%20 = load i32*, i32** %5
%21 = load i32, i32* %20
%22 = trunc i32 %21 to i8
%23 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i8* %19, i8 signext %22)
%24 = load i32*, i32** %5
%25 = bitcast i32* %24 to i8*
%26 = getelementptr inbounds i8, i8* %25, i64 1
%27 = bitcast i8* %26 to i32*
store i32* %27, i32** %5
br label %28
28: ; preds = %17
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %14
31: ; preds = %14
store i32 0, i32* %7
br label %32
32: ; preds = %44, %31
%33 = load i32, i32* %7
%34 = icmp slt i32 %33, 5
br i1 %34, label %35, label %47
35: ; preds = %32
%36 = load i8*, i8** %4
%37 = load i8*, i8** %4
%38 = load i8, i8* %37
%39 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i8* %36, i8 signext %38)
%40 = load i8*, i8** %4
%41 = bitcast i8* %40 to i32*
%42 = getelementptr inbounds i32, i32* %41, i64 1
%43 = bitcast i32* %42 to i8*
store i8* %43, i8** %4
br label %44
44: ; preds = %35
%45 = load i32, i32* %7
%46 = add nsw i32 %45, 1
store i32 %46, i32* %7
br label %32
47: ; preds = %32
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 = [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 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%6 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext 97)
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 1
%8 = bitcast i8* %7 to i32*
%9 = load i32, i32* %8
%10 = trunc i32 %9 to i8
%11 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i8* %7, i8 signext %10)
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 2
%13 = bitcast i8* %12 to i32*
%14 = load i32, i32* %13
%15 = trunc i32 %14 to i8
%16 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i8* %12, i8 signext %15)
%17 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 3
%18 = bitcast i8* %17 to i32*
%19 = load i32, i32* %18
%20 = trunc i32 %19 to i8
%21 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i8* %17, i8 signext %20)
%22 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 4
%23 = bitcast i8* %22 to i32*
%24 = load i32, i32* %23
%25 = trunc i32 %24 to i8
%26 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i8* %22, i8 signext %25)
%27 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i8* %4, i8 signext 1)
%28 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 1
%29 = bitcast i32* %28 to i8*
%30 = load i8, i8* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i8* %29, i8 signext %30)
%32 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 2
%33 = bitcast i32* %32 to i8*
%34 = load i8, i8* %33
%35 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i8* %33, i8 signext %34)
%36 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 3
%37 = bitcast i32* %36 to i8*
%38 = load i8, i8* %37
%39 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i8* %37, i8 signext %38)
%40 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 4
%41 = bitcast i32* %40 to i8*
%42 = load i8, i8* %41
%43 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i8* %41, i8 signext %42)
ret i32 0
}