#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*/ memcpy_1(char *, char *);
int /*<<< orphan*/ memcpy_2(char *, char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int main() {
  char string_1[] = "Hey";
  char string_2[] = "Bye";
  char string_3[] = "Sam";
  char string_4[] = "Liz";
  printf("memcpy_1:\n\tBefore:\n\t\tstring_1 = [%s]\n\t\tstring_2 = [%s]\n",
         string_1, string_2);
  memcpy_1(string_1, string_2);
  printf("\tAfter:\n\t\tstring_1 = [%s]\n\t\tstring_2 = [%s]\n", string_1,
         string_2);
  printf("memcpy_2:\n\tBefore:\n\t\tstring_3 = [%s]\n\t\tstring_4 = [%s]\n",
         string_3, string_4);
  memcpy_2(string_3, string_4);
  printf("\tAfter:\n\t\tstring_3 = [%s]\n\t\tstring_4 = [%s]\n", string_3,
         string_4);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xebb(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xeb6(%rip),%eax
mov    %eax,-0xc(%rbp)
mov    0xeb1(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xeac(%rip),%eax
mov    %eax,-0x14(%rbp)
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <memcpy_1@plt>
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <memcpy_2@plt>
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movl   $0x796548,0x14(%rsp)
movl   $0x657942,0x10(%rsp)
movl   $0x6d6153,0xc(%rsp)
movl   $0x7a694c,0x8(%rsp)
lea    0xea2(%rip),%rdi
lea    0x14(%rsp),%rbx
lea    0x10(%rsp),%r14
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <memcpy_1@plt>
lea    0xeb3(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    0xc(%rsp),%rbx
lea    0x8(%rsp),%r14
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <memcpy_2@plt>
lea    0xedf(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.string_1 = [4 x i8] c"Hey\00"
@__const.main.string_2 = [4 x i8] c"Bye\00"
@__const.main.string_3 = [4 x i8] c"Sam\00"
@__const.main.string_4 = [4 x i8] c"Liz\00"
@.str = [56 x i8] c"memcpy_1:\0A\09Before:\0A\09\09string_1 = [%s]\0A\09\09string_2 = [%s]\0A\00"
@.str.1 = [45 x i8] c"\09After:\0A\09\09string_1 = [%s]\0A\09\09string_2 = [%s]\0A\00"
@.str.2 = [56 x i8] c"memcpy_2:\0A\09Before:\0A\09\09string_3 = [%s]\0A\09\09string_4 = [%s]\0A\00"
@.str.3 = [45 x i8] c"\09After:\0A\09\09string_3 = [%s]\0A\09\09string_4 = [%s]\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
%3 = alloca [4 x i8]
%4 = alloca [4 x i8]
%5 = alloca [4 x i8]
store i32 0, i32* %1
%6 = bitcast [4 x i8]* %2 to i8*
%7 = bitcast [4 x i8]* %3 to i8*
%8 = bitcast [4 x i8]* %4 to i8*
%9 = bitcast [4 x i8]* %5 to i8*
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %11)
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%15 = call i32 @memcpy_1(i8* %13, i8* %14)
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%18 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %16, i8* %17)
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%21 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0), i8* %19, i8* %20)
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%23 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%24 = call i32 @memcpy_2(i8* %22, i8* %23)
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%26 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%27 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i8* %25, i8* %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [56 x i8] c"memcpy_1:\0A\09Before:\0A\09\09string_1 = [%s]\0A\09\09string_2 = [%s]\0A\00"
@.str.1 = [45 x i8] c"\09After:\0A\09\09string_1 = [%s]\0A\09\09string_2 = [%s]\0A\00"
@.str.2 = [56 x i8] c"memcpy_2:\0A\09Before:\0A\09\09string_3 = [%s]\0A\09\09string_4 = [%s]\0A\00"
@.str.3 = [45 x i8] c"\09After:\0A\09\09string_3 = [%s]\0A\09\09string_4 = [%s]\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
store i32 7955784, i32* %1
%6 = bitcast i32* %2 to i8*
store i32 6650178, i32* %2
%7 = bitcast i32* %3 to i8*
store i32 7168339, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 8022348, i32* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
%10 = call i32 @memcpy_1(i8* %5, i8* %6)
%11 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %5, i8* %6)
%12 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0), i8* %7, i8* %8)
%13 = call i32 @memcpy_2(i8* %7, i8* %8)
%14 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i8* %7, i8* %8)
ret i32 0
}