#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 *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strlen(char *);
void functionStrCpy() {
  char s1[30] = "Created by";
  char s2[20];
  char s3[] = "fenglin";
  strcpy(s2, s1);
  printf("s2->%lu\n", strlen(s2));
  printf("s2->%s\n", s2);
  strcat(s1, s3);
  printf("s1->%lu\n", strlen(s1));
  printf("s1->%s\n", s1);
}


x86 assembly (clang, -O0):
<functionStrCpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0xeb1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeae(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeab(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xea9(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xea3(%rip),%ax
mov    %ax,-0x4(%rbp)
mov    0xe9a(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rsi
lea    0xe7e(%rip),%rdi
call   1050 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xe77(%rip),%rdi
call   1050 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x48(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rsi
lea    0xe5a(%rip),%rdi
call   1050 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xe53(%rip),%rdi
call   1050 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<functionStrCpy>:
push   %r14
push   %rbx
sub    $0x48,%rsp
movups 0xec0(%rip),%xmm0
movups %xmm0,0x1e(%rsp)
movaps 0xea6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x6e696c676e6566,%rax
mov    %rax,0x8(%rsp)
lea    0x30(%rsp),%rbx
lea    0x10(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xe8c(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
lea    0xe86(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1060 <strcat@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    0xe6a(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
lea    0xe64(%rip),%rdi
mov    %r14,%rsi
call   1050 <printf@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.functionStrCpy.s1 = [30 x i8] c"Created by\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.functionStrCpy.s3 = [8 x i8] c"fenglin\00"
@.str = [9 x i8] c"s2->%lu\0A\00"
@.str.1 = [8 x i8] c"s2->%s\0A\00"
@.str.2 = [9 x i8] c"s1->%lu\0A\00"
@.str.3 = [8 x i8] c"s1->%s\0A\00"
define void @functionStrCpy() {
%1 = alloca [30 x i8]
%2 = alloca [20 x i8]
%3 = alloca [8 x i8]
%4 = bitcast [30 x i8]* %1 to i8*
%5 = bitcast [8 x i8]* %3 to i8*
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%8 = call i32 @strcpy(i8* %6, i8* %7)
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%10 = call i8* @strlen(i8* %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%15 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%16 = call i32 @strcat(i8* %14, i8* %15)
%17 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%18 = call i8* @strlen(i8* %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%21 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %20)
ret void
}

LLVM IR (-O2):
@__const.functionStrCpy.s1 = [30 x i8] c"Created by\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [9 x i8] c"s2->%lu\0A\00"
@.str.1 = [8 x i8] c"s2->%s\0A\00"
@.str.2 = [9 x i8] c"s1->%lu\0A\00"
@.str.3 = [8 x i8] c"s1->%s\0A\00"
define void @functionStrCpy() {
%1 = alloca [30 x i8]
%2 = alloca [20 x i8]
%3 = alloca i64
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%6 = bitcast i64* %3 to i8*
store i64 31078161750844774, i64* %3
%7 = call i32 @strcpy(i8* %5, i8* %4)
%8 = call i8* @strlen(i8* %5)
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%11 = call i32 @strcat(i8* %4, i8* %6)
%12 = call i8* @strlen(i8* %4)
%13 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %4)
ret void
}