#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*/ clang_analyzer_eval(int);
char *mempcpy(char *, char *, int);
void mempcpy0() {
  char src[] = {1, 2, 3, 4};
  char dst[5] = {0};
  mempcpy(dst, src, 4);
  clang_analyzer_eval(mempcpy(dst, src, 4) == &dst[4]);
  clang_analyzer_eval(dst[0] != 0);
}


x86 assembly (clang, -O0):
<mempcpy0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xec2(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    -0x9(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1030 <memset@plt>
lea    -0x9(%rbp),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x4,%edx
call   1040 <mempcpy@plt>
lea    -0x9(%rbp),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x4,%edx
call   1040 <mempcpy@plt>
lea    -0x9(%rbp),%rcx
add    $0x4,%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <clang_analyzer_eval@plt>
movsbl -0x9(%rbp),%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mempcpy0>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x4030201,0xc(%rsp)
04
movb   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
lea    0x8(%rsp),%r15
lea    0x4(%rsp),%rbx
lea    0xc(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x4,%edx
call   1030 <mempcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x4,%edx
call   1030 <mempcpy@plt>
xor    %edi,%edi
cmp    %r15,%rax
sete   %dil
call   1040 <clang_analyzer_eval@plt>
xor    %edi,%edi
cmpb   $0x0,0x4(%rsp)
setne  %dil
call   1040 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.mempcpy0.src = [4 x i8] c"\01\02\03\04"
define void @mempcpy0() {
%1 = alloca [4 x i8]
%2 = alloca [5 x i8]
%3 = bitcast [4 x i8]* %1 to i8*
%4 = bitcast [5 x i8]* %2 to i8*
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%7 = call i8* @mempcpy(i8* %5, i8* %6, i32 4)
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%10 = call i8* @mempcpy(i8* %8, i8* %9, i32 4)
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 4
%12 = icmp eq i8* %10, %11
%13 = zext i1 %12 to i32
%14 = call i32 @clang_analyzer_eval(i32 %13)
%15 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
%19 = zext i1 %18 to i32
%20 = call i32 @clang_analyzer_eval(i32 %19)
ret void
}

LLVM IR (-O2):
define void @mempcpy0() {
%1 = alloca i32
%2 = alloca [5 x i8]
%3 = bitcast i32* %1 to i8*
store i32 67305985, i32* %1
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%5 = call i8* @mempcpy(i8* %4, i8* %3, i32 4)
%6 = call i8* @mempcpy(i8* %4, i8* %3, i32 4)
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 4
%8 = icmp eq i8* %6, %7
%9 = zext i1 %8 to i32
%10 = call i32 @clang_analyzer_eval(i32 %9)
%11 = load i8, i8* %4
%12 = icmp ne i8 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @clang_analyzer_eval(i32 %13)
ret void
}