#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 */
void *memcpy(void *, void const *, unsigned int);
int /*<<< orphan*/ sink(void *);
void nowarn_memcpy(const void *s) {
  extern char cpy_a4[4];
  unsigned n = sizeof cpy_a4;
  void *p = cpy_a4;
  p = memcpy(p, s, n);
  sink(p);
  memcpy(p, s, n);
  sink(p);
  p = cpy_a4 + 1;
  p = memcpy(p, s, n - 1);
  sink(p);
  memcpy(p, s, n - 1);
  sink(p);
  p = cpy_a4 + 2;
  p = memcpy(p, s, n - 2);
  sink(p);
  memcpy(p, s, n - 2);
  sink(p);
  p = cpy_a4 + 3;
  p = memcpy(p, s, n - 3);
  sink(p);
  memcpy(p, s, n - 3);
  sink(p);
  p = cpy_a4 + 4;
  p = memcpy(p, s, n - 4);
  sink(p);
  memcpy(p, s, n - 4);
  sink(p);
}


x86 assembly (clang, -O0):
<nowarn_memcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x4,-0xc(%rbp)
mov    0x2eae(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <memcpy@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <sink@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rdi
call   1040 <sink@plt>
mov    0x2e6d(%rip),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
call   1030 <memcpy@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <sink@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rdi
call   1040 <sink@plt>
mov    0x2e22(%rip),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
sub    $0x2,%edx
call   1030 <memcpy@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <sink@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
sub    $0x2,%edx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rdi
call   1040 <sink@plt>
mov    0x2dd7(%rip),%rax
add    $0x3,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
sub    $0x3,%edx
call   1030 <memcpy@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <sink@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
sub    $0x3,%edx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rdi
call   1040 <sink@plt>
mov    0x2d8c(%rip),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
sub    $0x4,%edx
call   1030 <memcpy@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <sink@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
sub    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rdi
call   1040 <sink@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nowarn_memcpy>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
mov    0x2eb9(%rip),%r14
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <sink@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    %rbx,%rdi
call   1040 <sink@plt>
lea    0x1(%r14),%rdi
mov    %r15,%rsi
mov    $0x3,%edx
call   1030 <memcpy@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <sink@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x3,%edx
call   1030 <memcpy@plt>
mov    %rbx,%rdi
call   1040 <sink@plt>
lea    0x2(%r14),%rdi
mov    %r15,%rsi
mov    $0x2,%edx
call   1030 <memcpy@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <sink@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x2,%edx
call   1030 <memcpy@plt>
mov    %rbx,%rdi
call   1040 <sink@plt>
lea    0x3(%r14),%rdi
mov    %r15,%rsi
mov    $0x1,%edx
call   1030 <memcpy@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <sink@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
call   1030 <memcpy@plt>
mov    %rbx,%rdi
call   1040 <sink@plt>
add    $0x4,%r14
mov    %r14,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1030 <memcpy@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <sink@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1030 <memcpy@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <sink@plt>

LLVM IR (-O0):
@cpy_a4 = external global [4 x i8]
define void @nowarn_memcpy(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
store i32 4, i32* %3
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @cpy_a4, i64 0, i64 0), i8** %4
%5 = load i8*, i8** %4
%6 = load i8*, i8** %2
%7 = load i32, i32* %3
%8 = call i8* @memcpy(i8* %5, i8* %6, i32 %7)
store i8* %8, i8** %4
%9 = load i8*, i8** %4
%10 = call i32 @sink(i8* %9)
%11 = load i8*, i8** %4
%12 = load i8*, i8** %2
%13 = load i32, i32* %3
%14 = call i8* @memcpy(i8* %11, i8* %12, i32 %13)
%15 = load i8*, i8** %4
%16 = call i32 @sink(i8* %15)
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @cpy_a4, i64 0, i64 1), i8** %4
%17 = load i8*, i8** %4
%18 = load i8*, i8** %2
%19 = load i32, i32* %3
%20 = sub i32 %19, 1
%21 = call i8* @memcpy(i8* %17, i8* %18, i32 %20)
store i8* %21, i8** %4
%22 = load i8*, i8** %4
%23 = call i32 @sink(i8* %22)
%24 = load i8*, i8** %4
%25 = load i8*, i8** %2
%26 = load i32, i32* %3
%27 = sub i32 %26, 1
%28 = call i8* @memcpy(i8* %24, i8* %25, i32 %27)
%29 = load i8*, i8** %4
%30 = call i32 @sink(i8* %29)
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @cpy_a4, i64 0, i64 2), i8** %4
%31 = load i8*, i8** %4
%32 = load i8*, i8** %2
%33 = load i32, i32* %3
%34 = sub i32 %33, 2
%35 = call i8* @memcpy(i8* %31, i8* %32, i32 %34)
store i8* %35, i8** %4
%36 = load i8*, i8** %4
%37 = call i32 @sink(i8* %36)
%38 = load i8*, i8** %4
%39 = load i8*, i8** %2
%40 = load i32, i32* %3
%41 = sub i32 %40, 2
%42 = call i8* @memcpy(i8* %38, i8* %39, i32 %41)
%43 = load i8*, i8** %4
%44 = call i32 @sink(i8* %43)
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @cpy_a4, i64 0, i64 3), i8** %4
%45 = load i8*, i8** %4
%46 = load i8*, i8** %2
%47 = load i32, i32* %3
%48 = sub i32 %47, 3
%49 = call i8* @memcpy(i8* %45, i8* %46, i32 %48)
store i8* %49, i8** %4
%50 = load i8*, i8** %4
%51 = call i32 @sink(i8* %50)
%52 = load i8*, i8** %4
%53 = load i8*, i8** %2
%54 = load i32, i32* %3
%55 = sub i32 %54, 3
%56 = call i8* @memcpy(i8* %52, i8* %53, i32 %55)
%57 = load i8*, i8** %4
%58 = call i32 @sink(i8* %57)
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @cpy_a4, i64 1, i64 0), i8** %4
%59 = load i8*, i8** %4
%60 = load i8*, i8** %2
%61 = load i32, i32* %3
%62 = sub i32 %61, 4
%63 = call i8* @memcpy(i8* %59, i8* %60, i32 %62)
store i8* %63, i8** %4
%64 = load i8*, i8** %4
%65 = call i32 @sink(i8* %64)
%66 = load i8*, i8** %4
%67 = load i8*, i8** %2
%68 = load i32, i32* %3
%69 = sub i32 %68, 4
%70 = call i8* @memcpy(i8* %66, i8* %67, i32 %69)
%71 = load i8*, i8** %4
%72 = call i32 @sink(i8* %71)
ret void
}

LLVM IR (-O2):
@cpy_a4 = external global [4 x i8]
define void @nowarn_memcpy(i8* %0) {
%2 = tail call i8* @memcpy(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @cpy_a4, i64 0, i64 0), i8* %0, i32 4)
%3 = tail call i32 @sink(i8* %2)
%4 = tail call i8* @memcpy(i8* %2, i8* %0, i32 4)
%5 = tail call i32 @sink(i8* %2)
%6 = tail call i8* @memcpy(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @cpy_a4, i64 0, i64 1), i8* %0, i32 3)
%7 = tail call i32 @sink(i8* %6)
%8 = tail call i8* @memcpy(i8* %6, i8* %0, i32 3)
%9 = tail call i32 @sink(i8* %6)
%10 = tail call i8* @memcpy(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @cpy_a4, i64 0, i64 2), i8* %0, i32 2)
%11 = tail call i32 @sink(i8* %10)
%12 = tail call i8* @memcpy(i8* %10, i8* %0, i32 2)
%13 = tail call i32 @sink(i8* %10)
%14 = tail call i8* @memcpy(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @cpy_a4, i64 0, i64 3), i8* %0, i32 1)
%15 = tail call i32 @sink(i8* %14)
%16 = tail call i8* @memcpy(i8* %14, i8* %0, i32 1)
%17 = tail call i32 @sink(i8* %14)
%18 = tail call i8* @memcpy(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @cpy_a4, i64 1, i64 0), i8* %0, i32 0)
%19 = tail call i32 @sink(i8* %18)
%20 = tail call i8* @memcpy(i8* %18, i8* %0, i32 0)
%21 = tail call i32 @sink(i8* %18)
ret void
}