#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*/ exit(int);
scalar_t__ overlap(void *, void *, size_t);
int /*<<< orphan*/ printf(char *);
void verify_overlap3(void *r1, void *r2, void *r3, size_t len) {
  if (overlap(r1, r2, len) || overlap(r1, r3, len) || overlap(r2, r3, len)) {
    printf("Memory regions overlap!\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<verify_overlap3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <overlap@plt>
cmp    $0x0,%rax
jne    1199 <verify_overlap3+0x69>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <overlap@plt>
cmp    $0x0,%rax
jne    1199 <verify_overlap3+0x69>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <overlap@plt>
cmp    $0x0,%rax
je     11af <verify_overlap3+0x7f>
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_overlap3>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r12
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %rcx,%rdx
call   1040 <overlap@plt>
test   %rax,%rax
jne    1183 <verify_overlap3+0x53>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1040 <overlap@plt>
test   %rax,%rax
jne    1183 <verify_overlap3+0x53>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1040 <overlap@plt>
test   %rax,%rax
jne    1183 <verify_overlap3+0x53>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xe76(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Memory regions overlap!\0A\00"
define void @verify_overlap3(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i64, i64* %8
%12 = call i64 @overlap(i8* %9, i8* %10, i64 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %26, label %14
14: ; preds = %4
%15 = load i8*, i8** %5
%16 = load i8*, i8** %7
%17 = load i64, i64* %8
%18 = call i64 @overlap(i8* %15, i8* %16, i64 %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %26, label %20
20: ; preds = %14
%21 = load i8*, i8** %6
%22 = load i8*, i8** %7
%23 = load i64, i64* %8
%24 = call i64 @overlap(i8* %21, i8* %22, i64 %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %20, %14, %4
%27 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%28 = call i32 @exit(i32 1)
unreachable
29: ; preds = %20
ret void
}

LLVM IR (-O2):
@str = [24 x i8] c"Memory regions overlap!\00"
define void @verify_overlap3(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = tail call i64 @overlap(i8* %0, i8* %1, i64 %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = tail call i64 @overlap(i8* %0, i8* %2, i64 %3)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = tail call i64 @overlap(i8* %1, i8* %2, i64 %3)
%12 = icmp eq i64 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %10, %7, %4
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %10
ret void
}