#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 /*<<< orphan*/ puts(char *);
char *strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  char str[] = "Hello C";
  char str2[50] = "Hello World";
  printf("%s\n", str);
  printf("%s\n", str2);
  char *str3 = strcat(str2, str);
  printf("%s\n", str2);
  printf("%s\n", str3);
  str3 = "hi everyone";
  printf("%s\n", str3);
  printf("%s\n", str2);
  str2[2] = 'L';
  str[2] = 'L';
  str[0] = 'h';
  printf("%s\n", str2);
  printf("%s\n", str);
  char *str4 = "hi world";
  printf("%c\n", str4[0]);
  printf("%s\n", str4);
  char str5[80];
  strcpy(str5, "these ");
  strcat(str5, "strings ");
  strcat(str5, "are ");
  strcat(str5, "concatenated.");
  puts(str5);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe97(%rip),%rax
mov    %rax,-0xc(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xed8(%rip),%rsi
mov    $0x32,%edx
call   1060 <memcpy@plt>
lea    -0xc(%rbp),%rsi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <strcat@plt>
mov    %rax,-0x48(%rbp)
lea    -0x40(%rbp),%rsi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x48(%rbp),%rsi
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe2a(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rsi
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movb   $0x4c,-0x3e(%rbp)
movb   $0x4c,-0xa(%rbp)
movb   $0x68,-0xc(%rbp)
lea    -0x40(%rbp),%rsi
lea    0xde7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xc(%rbp),%rsi
lea    0xdd5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdd7(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
movsbl (%rax),%esi
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x50(%rbp),%rsi
lea    0xda3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xa0(%rbp),%rdi
lea    0xdab(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0xa0(%rbp),%rdi
lea    0xd9f(%rip),%rsi
call   1070 <strcat@plt>
lea    -0xa0(%rbp),%rdi
lea    0xd95(%rip),%rsi
call   1070 <strcat@plt>
lea    -0xa0(%rbp),%rdi
lea    0xd87(%rip),%rsi
call   1070 <strcat@plt>
lea    -0xa0(%rbp),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xa8,%rsp
movabs $0x43206f6c6c6548,%rax
mov    %rax,0x8(%rsp)
movaps 0xeb0(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe94(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe78(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movw   $0x0,0x40(%rsp)
lea    0x8(%rsp),%r14
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <strcat@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xe62(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
movb   $0x4c,0x12(%rsp)
movb   $0x4c,0xa(%rsp)
movb   $0x68,0x8(%rsp)
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0xe44(%rip),%rdi
mov    $0x68,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe28(%rip),%rdi
call   1040 <puts@plt>
lea    0xe29(%rip),%rsi
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
movabs $0x2073676e69727473,%rcx
67 73 20
mov    %rcx,0x50(%rsp,%rax,1)
movb   $0x0,0x58(%rsp,%rax,1)
mov    %rbx,%rdi
call   1050 <strlen@plt>
movl   $0x20657261,0x50(%rsp,%rax,1)
20
movb   $0x0,0x54(%rsp,%rax,1)
mov    %rbx,%rdi
call   1050 <strlen@plt>
movabs $0x6e657461636e6f63,%rcx
74 65 6e
mov    %rcx,0x50(%rsp,%rax,1)
movabs $0x2e646574616e65,%rcx
mov    %rcx,0x56(%rsp,%rax,1)
mov    %rbx,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.str = [8 x i8] c"Hello C\00"
@__const.main.str2 = [50 x i8] c"Hello World\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\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [12 x i8] c"hi everyone\00"
@.str.2 = [9 x i8] c"hi world\00"
@.str.3 = [4 x i8] c"%c\0A\00"
@.str.4 = [7 x i8] c"these \00"
@.str.5 = [9 x i8] c"strings \00"
@.str.6 = [5 x i8] c"are \00"
@.str.7 = [14 x i8] c"concatenated.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i8]
%3 = alloca [50 x i8]
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [80 x i8]
store i32 0, i32* %1
%7 = bitcast [8 x i8]* %2 to i8*
%8 = bitcast [50 x i8]* %3 to i8*
%9 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%14 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%15 = call i8* @strcat(i8* %13, i8* %14)
store i8* %15, i8** %4
%16 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i8*, i8** %4
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %18)
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %4
%20 = load i8*, i8** %4
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 2
store i8 76, i8* %24
%25 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 2
store i8 76, i8* %25
%26 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
store i8 104, i8* %26
%27 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %27)
%29 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %29)
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8** %5
%31 = load i8*, i8** %5
%32 = getelementptr inbounds i8, i8* %31, i64 0
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %34)
%36 = load i8*, i8** %5
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %36)
%38 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%39 = call i32 @strcpy(i8* %38, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%40 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%41 = call i8* @strcat(i8* %40, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%42 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%43 = call i8* @strcat(i8* %42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%44 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%45 = call i8* @strcat(i8* %44, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%46 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%47 = call i32 @puts(i8* %46)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str2 = [50 x i8] c"Hello World\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\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str.1 = [12 x i8] c"hi everyone\00"
@.str.2 = [9 x i8] c"hi world\00"
@.str.3 = [4 x i8] c"%c\0A\00"
@.str.4 = [7 x i8] c"these \00"
@.str.5 = [9 x i8] c"strings \00"
@.str.6 = [5 x i8] c"are \00"
@.str.7 = [14 x i8] c"concatenated.\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to [8 x i8]*
%3 = alloca [50 x i8]
%4 = alloca [80 x i8]
%5 = bitcast i64* %1 to i8*
store i64 18894486372115784, i64* %1
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%7 = call i32 @puts(i8* %5)
%8 = call i32 @puts(i8* %6)
%9 = call i8* @strcat(i8* %6, i8* %5)
%10 = call i32 @puts(i8* %6)
%11 = call i32 @puts(i8* %6)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @puts(i8* %6)
%14 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 2
store i8 76, i8* %14
%15 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 2
store i8 76, i8* %15
store i8 104, i8* %5
%16 = call i32 @puts(i8* %6)
%17 = call i32 @puts(i8* %5)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 104)
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%20 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%21 = call i32 @strcpy(i8* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%22 = call i64 @strlen(i8* %20)
%23 = getelementptr [80 x i8], [80 x i8]* %4, i64 0, i64 %22
%24 = call i64 @strlen(i8* %20)
%25 = getelementptr [80 x i8], [80 x i8]* %4, i64 0, i64 %24
%26 = call i64 @strlen(i8* %20)
%27 = getelementptr [80 x i8], [80 x i8]* %4, i64 0, i64 %26
%28 = call i32 @puts(i8* %20)
ret i32 0
}