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


x86 assembly (clang, -O0):
<nowarn_mempcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x4,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    0x2ea7(%rip),%rdi
call   1040 <mempcpy@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <sink@plt>
mov    -0x18(%rbp),%rdi
add    $0xfffffffffffffffc,%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <mempcpy@plt>
mov    -0x18(%rbp),%rdi
call   1030 <sink@plt>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
mov    0x2e67(%rip),%rdi
add    $0x1,%rdi
call   1040 <mempcpy@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <sink@plt>
mov    -0x18(%rbp),%rdi
add    $0xfffffffffffffffc,%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <mempcpy@plt>
mov    -0x18(%rbp),%rdi
call   1030 <sink@plt>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
sub    $0x2,%edx
mov    0x2e23(%rip),%rdi
add    $0x2,%rdi
call   1040 <mempcpy@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <sink@plt>
mov    -0x18(%rbp),%rdi
add    $0xfffffffffffffffc,%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <mempcpy@plt>
mov    -0x18(%rbp),%rdi
call   1030 <sink@plt>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
sub    $0x3,%edx
mov    0x2ddf(%rip),%rdi
add    $0x3,%rdi
call   1040 <mempcpy@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <sink@plt>
mov    -0x18(%rbp),%rdi
add    $0xfffffffffffffffc,%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <mempcpy@plt>
mov    -0x18(%rbp),%rdi
call   1030 <sink@plt>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
sub    $0x4,%edx
mov    0x2d9b(%rip),%rdi
add    $0x4,%rdi
call   1040 <mempcpy@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <sink@plt>
mov    -0x18(%rbp),%rdi
add    $0xfffffffffffffffc,%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <mempcpy@plt>
mov    -0x18(%rbp),%rdi
call   1030 <sink@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

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

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