#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*/ memcpy1(char *, char *, int);
int /*<<< orphan*/ memcpy2(char *, char *, int);
int /*<<< orphan*/ print(char *);
int /*<<< orphan*/ printf(char *);
int main() {
  char v[] = {2, 3, 4, 5, 6};
  char w[5];
  char u[5];
  memcpy1(w, v, 5);
  printf("w: ");
  print(w);
  memcpy2(u, v, 5);
  printf("u: ");
  print(u);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeab(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xea6(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0xe(%rbp),%rdi
lea    -0x9(%rbp),%rsi
mov    $0x5,%edx
call   1060 <memcpy1@plt>
lea    0xe8b(%rip),%rdi
call   1040 <printf@plt>
lea    -0xe(%rbp),%rdi
call   1050 <print@plt>
lea    -0x13(%rbp),%rdi
lea    -0x9(%rbp),%rsi
mov    $0x5,%edx
call   1030 <memcpy2@plt>
lea    0xe68(%rip),%rdi
call   1040 <printf@plt>
lea    -0x13(%rbp),%rdi
call   1050 <print@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movb   $0x6,0xc(%rsp)
movl   $0x5040302,0x8(%rsp)
05
lea    0x13(%rsp),%rbx
lea    0x8(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
call   1060 <memcpy1@plt>
lea    0xe90(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <print@plt>
lea    0xe(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
call   1030 <memcpy2@plt>
lea    0xe6b(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <print@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.v = [5 x i8] c"\02\03\04\05\06"
@.str = [4 x i8] c"w: \00"
@.str.1 = [4 x i8] c"u: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i8]
%3 = alloca [5 x i8]
%4 = alloca [5 x i8]
store i32 0, i32* %1
%5 = bitcast [5 x i8]* %2 to i8*
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%8 = call i32 @memcpy1(i8* %6, i8* %7, i32 5)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%11 = call i32 @print(i8* %10)
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%13 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%14 = call i32 @memcpy2(i8* %12, i8* %13, i32 5)
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%16 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%17 = call i32 @print(i8* %16)
ret i32 0
}

LLVM IR (-O2):
@__const.main.v = [5 x i8] c"\02\03\04\05\06"
@.str = [4 x i8] c"w: \00"
@.str.1 = [4 x i8] c"u: \00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = alloca [5 x i8]
%3 = alloca [5 x i8]
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%7 = call i32 @memcpy1(i8* %5, i8* %4, i32 5)
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @print(i8* %5)
%10 = call i32 @memcpy2(i8* %6, i8* %4, i32 5)
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @print(i8* %6)
ret i32 0
}