#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*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main() {
  char str1[12] = "Hello";
  char str2[12] = "World";
  char str3[12] = "";
  int len;
  strcpy(str3, str1);
  printf("strcpy( str3, str1) :  %s\n", str3);
  strcat(str1, str2);
  printf("strcat( str1, str2):   %s\n", str1);
  len = strlen(str1);
  printf("strlen(str1) :  %d\n", len);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe9a(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xe98(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xe92(%rip),%rax
mov    %rax,-0x1c(%rbp)
mov    0xe90(%rip),%eax
mov    %eax,-0x14(%rbp)
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1060 <memset@plt>
lea    -0x28(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x28(%rbp),%rsi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1070 <strcat@plt>
lea    -0x10(%rbp),%rsi
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movabs $0x6f6c6c6548,%rax
mov    %rax,0x28(%rsp)
movl   $0x0,0x30(%rsp)
movabs $0x646c726f57,%rax
mov    %rax,0x18(%rsp)
movl   $0x0,0x20(%rsp)
movl   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%r14
lea    0x28(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xe76(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
lea    0xe73(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xe75(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.str1 = [12 x i8] c"Hello\00\00\00\00\00\00\00"
@__const.main.str2 = [12 x i8] c"World\00\00\00\00\00\00\00"
@.str = [27 x i8] c"strcpy( str3, str1) : %s\0A\00"
@.str.1 = [27 x i8] c"strcat( str1, str2): %s\0A\00"
@.str.2 = [20 x i8] c"strlen(str1) : %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [12 x i8]
%3 = alloca [12 x i8]
%4 = alloca [12 x i8]
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [12 x i8]* %2 to i8*
%7 = bitcast [12 x i8]* %3 to i8*
%8 = bitcast [12 x i8]* %4 to i8*
%9 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%11 = call i32 @strcpy(i8* %9, i8* %10)
%12 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%15 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%16 = call i32 @strcat(i8* %14, i8* %15)
%17 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%20 = call i32 @strlen(i8* %19)
store i32 %20, i32* %5
%21 = load i32, i32* %5
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %21)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str1 = [12 x i8] c"Hello\00\00\00\00\00\00\00"
@__const.main.str2 = [12 x i8] c"World\00\00\00\00\00\00\00"
@.str = [27 x i8] c"strcpy( str3, str1) : %s\0A\00"
@.str.1 = [27 x i8] c"strcat( str1, str2): %s\0A\00"
@.str.2 = [20 x i8] c"strlen(str1) : %d\0A\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = alloca [12 x i8]
%3 = alloca [12 x i8]
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%7 = call i32 @strcpy(i8* %6, i8* %4)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %6)
%9 = call i32 @strcat(i8* %4, i8* %5)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%11 = call i32 @strlen(i8* %4)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %11)
ret i32 0
}