#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;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
  char_pointer = int_array;
  int_pointer = char_array;
#pragma GCC diagnostic pop
  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_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_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    $0x4,%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    $0x1,%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   %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    $0x61,%edx
call   1030 <printf@plt>
movsbl 0xc(%rsp),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
movsbl 0x10(%rsp),%edx
mov    %rbx,%rdi
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    0xebd(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <printf@plt>
lea    0x11(%rsp),%rsi
movsbl 0x11(%rsp),%edx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x12(%rsp),%rsi
movsbl 0x12(%rsp),%edx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x13(%rsp),%rsi
movsbl 0x13(%rsp),%edx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
movsbl 0x14(%rsp),%edx
mov    %rbx,%rdi
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 [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 = %26, %0
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 5
br i1 %16, label %17, label %29
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 = getelementptr inbounds i32, i32* %24, i64 1
store i32* %25, i32** %5
br label %26
26: ; preds = %17
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %14
29: ; preds = %14
store i32 0, i32* %7
br label %30
30: ; preds = %40, %29
%31 = load i32, i32* %7
%32 = icmp slt i32 %31, 5
br i1 %32, label %33, label %43
33: ; preds = %30
%34 = load i8*, i8** %4
%35 = load i8*, i8** %4
%36 = load i8, i8* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i8* %34, i8 signext %36)
%38 = load i8*, i8** %4
%39 = getelementptr inbounds i8, i8* %38, i64 1
store i8* %39, i8** %4
br label %40
40: ; preds = %33
%41 = load i32, i32* %7
%42 = add nsw i32 %41, 1
store i32 %42, i32* %7
br label %30
43: ; 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 = [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 4
%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 8
%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 12
%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 16
%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 i8, i8* %4, i64 1
%29 = load i8, i8* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i8* %28, i8 signext %29)
%31 = getelementptr inbounds i8, i8* %4, i64 2
%32 = load i8, i8* %31
%33 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i8* %31, i8 signext %32)
%34 = getelementptr inbounds i8, i8* %4, i64 3
%35 = load i8, i8* %34
%36 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i8* %34, i8 signext %35)
%37 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 1
%38 = bitcast i32* %37 to i8*
%39 = load i8, i8* %38
%40 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), i8* %38, i8 signext %39)
ret i32 0
}