#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*/ puts(char const *);
char *strcpy(char *, char const *);
int main(void) {
  const char *orig = "beast";
  char copy[40] = "Be the best that you can be.";
  char *ps;
  puts(orig);
  puts(copy);
  ps = strcpy(copy + 7, orig);
  puts(copy);
  puts(ps);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xebb(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
mov    -0x10(%rbp),%rdi
call   1040 <puts@plt>
lea    -0x40(%rbp),%rdi
call   1040 <puts@plt>
lea    -0x40(%rbp),%rdi
add    $0x7,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    %rax,-0x48(%rbp)
lea    -0x40(%rbp),%rdi
call   1040 <puts@plt>
mov    -0x48(%rbp),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movaps 0xf02(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xee6(%rip),%xmm0
movaps %xmm0,(%rsp)
movq   $0x0,0x20(%rsp)
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0x7(%rsp),%r14
movl   $0x73616562,0x7(%rsp)
73
movw   $0x74,0xb(%rsp)
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"beast\00"
@__const.main.copy = [40 x i8] c"Be the best that you can be.\00\00\00\00\00\00\00\00\00\00\00\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [40 x i8]
%4 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
%5 = bitcast [40 x i8]* %3 to i8*
%6 = load i8*, i8** %2
%7 = call i32 @puts(i8* %6)
%8 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%9 = call i32 @puts(i8* %8)
%10 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds i8, i8* %10, i64 7
%12 = load i8*, i8** %2
%13 = call i8* @strcpy(i8* %11, i8* %12)
store i8* %13, i8** %4
%14 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%15 = call i32 @puts(i8* %14)
%16 = load i8*, i8** %4
%17 = call i32 @puts(i8* %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"beast\00"
@__const.main.copy = [40 x i8] c"Be the best that you can be.\00\00\00\00\00\00\00\00\00\00\00\00"
define i32 @main() {
%1 = alloca [40 x i8]
%2 = getelementptr inbounds [40 x i8], [40 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @puts(i8* %2)
%5 = getelementptr inbounds [40 x i8], [40 x i8]* %1, i64 0, i64 7
%6 = call i32 @puts(i8* %2)
%7 = call i32 @puts(i8* %5)
ret i32 0
}