#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 *, char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  char Kid1[12] = "Katie";
  char Kid2[7] = "Maddie";
  char Kid3[7] = "Andrew";
  char Hero1[7] = "Batman";
  char Hero2[34] = "Spiderman";
  char Hero3[25] = "The Incredible Hulk";
  Kid1[0] = 'K';
  Kid1[1] = 'a';
  Kid1[2] = 't';
  Kid1[3] = 'i';
  Kid1[4] = 'e';
  Kid1[5] = '\0';
  strcpy(Hero3, "The Incredible Hulk");
  printf("%s\'s favorite hero is %s.\n", Kid1, Hero1);
  printf("%s\'s favorite hero is %s.\n", Kid2, Hero2);
  printf("%s\'s favorite hero is %s.\n", Kid3, Hero3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xeb8(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xf00(%rip),%eax
mov    %eax,-0x17(%rbp)
mov    0xefa(%rip),%ax
mov    %ax,-0x13(%rbp)
mov    0xef2(%rip),%al
mov    %al,-0x11(%rbp)
mov    0xeea(%rip),%eax
mov    %eax,-0x1e(%rbp)
mov    0xee4(%rip),%ax
mov    %ax,-0x1a(%rbp)
mov    0xedc(%rip),%al
mov    %al,-0x18(%rbp)
mov    0xed4(%rip),%eax
mov    %eax,-0x25(%rbp)
mov    0xece(%rip),%ax
mov    %ax,-0x21(%rbp)
mov    0xec6(%rip),%al
mov    %al,-0x1f(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xe5b(%rip),%rsi
mov    $0x22,%edx
call   1050 <memcpy@plt>
mov    0xe7a(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xe77(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xe74(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xe72(%rip),%al
mov    %al,-0x58(%rbp)
movb   $0x4b,-0x10(%rbp)
movb   $0x61,-0xf(%rbp)
movb   $0x74,-0xe(%rbp)
movb   $0x69,-0xd(%rbp)
movb   $0x65,-0xc(%rbp)
movb   $0x0,-0xb(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xe62(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x10(%rbp),%rsi
lea    -0x25(%rbp),%rdx
lea    0xe62(%rip),%rdi
call   1040 <printf@plt>
lea    -0x17(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    0xe4e(%rip),%rdi
call   1040 <printf@plt>
lea    -0x1e(%rbp),%rsi
lea    -0x70(%rbp),%rdx
lea    0xe3a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x78,%rsp
movabs $0x656974614b,%rax
mov    %rax,0x20(%rsp)
movl   $0x0,0x28(%rsp)
movl   $0x656964,0x1b(%rsp)
movl   $0x6464614d,0x18(%rsp)
64
movl   $0x776572,0x13(%rsp)
movl   $0x72646e41,0x10(%rsp)
72
movl   $0x6e616d,0xb(%rsp)
movl   $0x6d746142,0x8(%rsp)
6d
movaps 0xeab(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xe8f(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movw   $0x0,0x70(%rsp)
movups 0xeb5(%rip),%xmm0
movups %xmm0,0x39(%rsp)
movaps 0xea0(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movl   $0x6974614b,0x20(%rsp)
69
movw   $0x65,0x24(%rsp)
lea    0xeb3(%rip),%rsi
lea    0x30(%rsp),%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
lea    0xeb3(%rip),%rbx
lea    0x20(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1040 <printf@plt>
lea    0x18(%rsp),%rsi
lea    0x50(%rsp),%rdx
mov    %rbx,%rdi
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.Kid1 = [12 x i8] c"Katie\00\00\00\00\00\00\00"
@__const.main.Kid2 = [7 x i8] c"Maddie\00"
@__const.main.Kid3 = [7 x i8] c"Andrew\00"
@__const.main.Hero1 = [7 x i8] c"Batman\00"
@__const.main.Hero2 = [34 x i8] c"Spiderman\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.Hero3 = [25 x i8] c"The Incredible Hulk\00\00\00\00\00\00"
@.str = [20 x i8] c"The Incredible Hulk\00"
@.str.1 = [27 x i8] c"%s's favorite hero is %s.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [12 x i8]
%3 = alloca [7 x i8]
%4 = alloca [7 x i8]
%5 = alloca [7 x i8]
%6 = alloca [34 x i8]
%7 = alloca [25 x i8]
store i32 0, i32* %1
%8 = bitcast [12 x i8]* %2 to i8*
%9 = bitcast [7 x i8]* %3 to i8*
%10 = bitcast [7 x i8]* %4 to i8*
%11 = bitcast [7 x i8]* %5 to i8*
%12 = bitcast [34 x i8]* %6 to i8*
%13 = bitcast [25 x i8]* %7 to i8*
%14 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
store i8 75, i8* %14
%15 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 1
store i8 97, i8* %15
%16 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 2
store i8 116, i8* %16
%17 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 3
store i8 105, i8* %17
%18 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 4
store i8 101, i8* %18
%19 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 5
store i8 0, i8* %19
%20 = getelementptr inbounds [25 x i8], [25 x i8]* %7, i64 0, i64 0
%21 = call i32 @strcpy(i8* %20, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%22 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%23 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%24 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %22, i8* %23)
%25 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%26 = getelementptr inbounds [34 x i8], [34 x i8]* %6, i64 0, i64 0
%27 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %25, i8* %26)
%28 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
%29 = getelementptr inbounds [25 x i8], [25 x i8]* %7, i64 0, i64 0
%30 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %28, i8* %29)
ret i32 0
}

LLVM IR (-O2):
@__const.main.Kid1 = [12 x i8] c"Katie\00\00\00\00\00\00\00"
@__const.main.Kid2 = [7 x i8] c"Maddie\00"
@__const.main.Kid3 = [7 x i8] c"Andrew\00"
@__const.main.Hero1 = [7 x i8] c"Batman\00"
@__const.main.Hero2 = [34 x i8] c"Spiderman\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.Hero3 = [25 x i8] c"The Incredible Hulk\00\00\00\00\00\00"
@.str = [20 x i8] c"The Incredible Hulk\00"
@.str.1 = [27 x i8] c"%s's favorite hero is %s.\0A\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = alloca [7 x i8]
%3 = alloca [7 x i8]
%4 = alloca [7 x i8]
%5 = alloca [34 x i8]
%6 = alloca [25 x i8]
%7 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [34 x i8], [34 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 0
store i8 75, i8* %7
%13 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 1
store i8 97, i8* %13
%14 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 2
store i8 116, i8* %14
%15 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 3
store i8 105, i8* %15
%16 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 4
store i8 101, i8* %16
%17 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 5
store i8 0, i8* %17
%18 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %7, i8* %10)
%20 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %8, i8* %11)
%21 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* %12)
ret i32 0
}