#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 */
typedef int /*<<< orphan*/ src;
typedef int /*<<< orphan*/ dst;
typedef int /*<<< orphan*/ _dst;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ memcmp(char *, char *, int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char const *const);
void test_memcpy(const char *const from) {
  char dst[128], src[128], _dst[128], _src[128];
  strcpy(src, from);
  strcpy(_src, from);
  memset(dst, 0, sizeof(dst));
  memset(_dst, 0, sizeof(_dst));
  memcpy(dst, src, sizeof(dst));
  memcpy(_dst, _src, sizeof(_dst));
  do {
    if (!(memcmp(src, _src, sizeof(src))))
      do {
        fprintf(stderr, "FAILED (line %d) ", 73);
        fprintf(stderr, "%s", "memcmp(src, _src, sizeof(src))");
        fprintf(stderr, "\n");
        exit(1);
      } while (0);
  } while (0);
  do {
    if (!(memcmp(dst, _dst, sizeof(dst))))
      do {
        fprintf(stderr, "FAILED (line %d) ", 74);
        fprintf(stderr, "%s", "memcmp(dst, _dst, sizeof(dst))");
        fprintf(stderr, "\n");
        exit(1);
      } while (0);
  } while (0);
}


x86 assembly (clang, -O0):
<test_memcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x210(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
lea    -0x190(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
lea    -0x90(%rbp),%rdi
lea    -0x110(%rbp),%rsi
mov    $0x80,%edx
call   1070 <memcpy@plt>
lea    -0x190(%rbp),%rdi
lea    -0x210(%rbp),%rsi
mov    $0x80,%edx
call   1070 <memcpy@plt>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
mov    $0x80,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%eax
jne    1266 <test_memcpy+0x106>
jmp    120b <test_memcpy+0xab>
mov    0x2dce(%rip),%rax
mov    (%rax),%edi
lea    0xde5(%rip),%rsi
mov    $0x49,%edx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2db2(%rip),%rax
mov    (%rax),%edi
lea    0xddb(%rip),%rsi
lea    0xdd7(%rip),%rdx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d94(%rip),%rax
mov    (%rax),%edi
lea    0xddf(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
jmp    126b <test_memcpy+0x10b>
jmp    1270 <test_memcpy+0x110>
lea    -0x90(%rbp),%rdi
lea    -0x190(%rbp),%rsi
mov    $0x80,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%eax
jne    12f1 <test_memcpy+0x191>
jmp    1296 <test_memcpy+0x136>
mov    0x2d43(%rip),%rax
mov    (%rax),%edi
lea    0xd5a(%rip),%rsi
mov    $0x4a,%edx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d27(%rip),%rax
mov    (%rax),%edi
lea    0xd50(%rip),%rsi
lea    0xd6d(%rip),%rdx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2d09(%rip),%rax
mov    (%rax),%edi
lea    0xd54(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
jmp    12f6 <test_memcpy+0x196>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_memcpy>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x208,%rsp
mov    %rdi,%rbx
lea    0x180(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0x100(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0x80(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    $0x80,%edx
call   1070 <memcpy@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x80,%edx
call   1070 <memcpy@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x80,%edx
call   1050 <memcmp@plt>
test   %eax,%eax
je     121c <test_memcpy+0xbc>
lea    0x80(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x80,%edx
call   1050 <memcmp@plt>
test   %eax,%eax
je     124a <test_memcpy+0xea>
add    $0x208,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    0x2dbd(%rip),%rbx
mov    (%rbx),%edi
lea    0xdd4(%rip),%rsi
mov    $0x49,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%rbx),%edi
lea    0xdd1(%rip),%rsi
lea    0xdcd(%rip),%rdx
jmp    1276 <test_memcpy+0x116>
mov    0x2d8f(%rip),%rbx
mov    (%rbx),%edi
lea    0xda6(%rip),%rsi
mov    $0x4a,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%rbx),%edi
lea    0xda3(%rip),%rsi
lea    0xdc0(%rip),%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%rbx),%edi
lea    0xdae(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"FAILED (line %d) \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [31 x i8] c"memcmp(src, _src, sizeof(src))\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [31 x i8] c"memcmp(dst, _dst, sizeof(dst))\00"
define void @test_memcpy(i8* %0) {
%2 = alloca i8*
%3 = alloca [128 x i8]
%4 = alloca [128 x i8]
%5 = alloca [128 x i8]
%6 = alloca [128 x i8]
store i8* %0, i8** %2
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%8 = load i8*, i8** %2
%9 = call i32 @strcpy(i8* %7, i8* %8)
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%11 = load i8*, i8** %2
%12 = call i32 @strcpy(i8* %10, i8* %11)
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%14 = call i32 @memset(i8* %13, i32 0, i32 128)
%15 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%16 = call i32 @memset(i8* %15, i32 0, i32 128)
%17 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%19 = call i32 @memcpy(i8* %17, i8* %18, i32 128)
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%21 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%22 = call i32 @memcpy(i8* %20, i8* %21, i32 128)
br label %23
23: ; preds = %1
%24 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%25 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%26 = call i32 @memcmp(i8* %24, i8* %25, i32 128)
%27 = icmp ne i32 %26, 0
br i1 %27, label %38, label %28
28: ; preds = %23
br label %29
29: ; preds = %28
%30 = load i32, i32* @stderr
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 73)
%32 = load i32, i32* @stderr
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%34 = load i32, i32* @stderr
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%36 = call i32 @exit(i32 1)
unreachable
37: ; No predecessors!
br label %38
38: ; preds = %37, %23
br label %39
39: ; preds = %38
br label %40
40: ; preds = %39
%41 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%42 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%43 = call i32 @memcmp(i8* %41, i8* %42, i32 128)
%44 = icmp ne i32 %43, 0
br i1 %44, label %55, label %45
45: ; preds = %40
br label %46
46: ; preds = %45
%47 = load i32, i32* @stderr
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 74)
%49 = load i32, i32* @stderr
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%51 = load i32, i32* @stderr
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%53 = call i32 @exit(i32 1)
unreachable
54: ; No predecessors!
br label %55
55: ; preds = %54, %40
br label %56
56: ; preds = %55
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"FAILED (line %d) \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [31 x i8] c"memcmp(src, _src, sizeof(src))\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [31 x i8] c"memcmp(dst, _dst, sizeof(dst))\00"
define void @test_memcpy(i8* %0) {
%2 = alloca [128 x i8]
%3 = alloca [128 x i8]
%4 = alloca [128 x i8]
%5 = alloca [128 x i8]
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%10 = call i32 @strcpy(i8* %7, i8* %0)
%11 = call i32 @strcpy(i8* %9, i8* %0)
%12 = call i32 @memset(i8* %6, i32 0, i32 128)
%13 = call i32 @memset(i8* %8, i32 0, i32 128)
%14 = call i32 @memcpy(i8* %6, i8* %7, i32 128)
%15 = call i32 @memcpy(i8* %8, i8* %9, i32 128)
%16 = call i32 @memcmp(i8* %7, i8* %9, i32 128)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %1
%19 = load i32, i32* @stderr
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 73)
%21 = load i32, i32* @stderr
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%23 = load i32, i32* @stderr
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %1
%27 = call i32 @memcmp(i8* %6, i8* %8, i32 128)
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %37
29: ; preds = %26
%30 = load i32, i32* @stderr
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 74)
%32 = load i32, i32* @stderr
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%34 = load i32, i32* @stderr
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %26
ret void
}