#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*/ Assert_failure(char *, int, char *);
void *Bits_memcpyNoDebug(void *, void const *, size_t);
void *Bits_memcpyDebug(void *out, const void *in, size_t length, char *file,
                       int line) {
  const char *inc = in;
  const char *outc = out;
  if (outc >= inc && outc < inc + length) {
    Assert_failure(file, line, "memcpy() pointers alias each other");
  }
  return Bits_memcpyNoDebug(out, in, length);
}


x86 assembly (clang, -O0):
<Bits_memcpyDebug>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x30(%rbp),%rax
jb     1182 <Bits_memcpyDebug+0x62>
mov    -0x38(%rbp),%rax
mov    -0x30(%rbp),%rcx
add    -0x18(%rbp),%rcx
cmp    %rcx,%rax
jae    1182 <Bits_memcpyDebug+0x62>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
lea    0xe83(%rip),%rdx
call   1030 <Assert_failure@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <Bits_memcpyNoDebug@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Bits_memcpyDebug>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
cmp    %rsi,%rdi
jb     114e <Bits_memcpyDebug+0x2e>
lea    (%r15,%r14,1),%rax
cmp    %rbx,%rax
jbe    114e <Bits_memcpyDebug+0x2e>
lea    0xebd(%rip),%rdx
mov    %rcx,%rdi
mov    %r8d,%esi
call   1030 <Assert_failure@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <Bits_memcpyNoDebug@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"memcpy() pointers alias each other\00"
define i8* @Bits_memcpyDebug(i8* %0, i8* %1, i64 %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i64 %2, i64* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%13 = load i8*, i8** %7
store i8* %13, i8** %11
%14 = load i8*, i8** %6
store i8* %14, i8** %12
%15 = load i8*, i8** %12
%16 = load i8*, i8** %11
%17 = icmp uge i8* %15, %16
br i1 %17, label %18, label %28
18: ; preds = %5
%19 = load i8*, i8** %12
%20 = load i8*, i8** %11
%21 = load i64, i64* %8
%22 = getelementptr inbounds i8, i8* %20, i64 %21
%23 = icmp ult i8* %19, %22
br i1 %23, label %24, label %28
24: ; preds = %18
%25 = load i8*, i8** %9
%26 = load i32, i32* %10
%27 = call i32 @Assert_failure(i8* %25, i32 %26, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %28
28: ; preds = %24, %18, %5
%29 = load i8*, i8** %6
%30 = load i8*, i8** %7
%31 = load i64, i64* %8
%32 = call i8* @Bits_memcpyNoDebug(i8* %29, i8* %30, i64 %31)
ret i8* %32
}

LLVM IR (-O2):
@.str = [35 x i8] c"memcpy() pointers alias each other\00"
define i8* @Bits_memcpyDebug(i8* %0, i8* %1, i64 %2, i8* %3, i32 %4) {
%6 = icmp uge i8* %0, %1
%7 = getelementptr inbounds i8, i8* %1, i64 %2
%8 = icmp ugt i8* %7, %0
%9 = select i1 %6, i1 %8, i1 false
br i1 %9, label %10, label %12
10: ; preds = %5
%11 = tail call i32 @Assert_failure(i8* %3, i32 %4, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %5
%13 = tail call i8* @Bits_memcpyNoDebug(i8* %0, i8* %1, i64 %2)
ret i8* %13
}