#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 scalar_t__ off_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ data_matches(char const *, scalar_t__, unsigned int,
                                unsigned int, scalar_t__, scalar_t__,
                                scalar_t__, scalar_t__);
int /*<<< orphan*/ printf(char *, char const *, scalar_t__, scalar_t__);
void data_check(const char *namestr, off_t regionoffset, unsigned code,
                unsigned seq, off_t zerostart, off_t len, off_t checkstart,
                off_t checklen) {
  assert(zerostart >= 0);
  assert(zerostart <= len);
  if (!data_matches(namestr, regionoffset, code, seq, zerostart, len,
                    checkstart, checklen)) {
    printf("ERROR: file %s range %lld-%lld contains garbage\n", namestr,
           regionoffset + checkstart, regionoffset + checkstart + checklen);
  }
}


x86 assembly (clang, -O0):
<data_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <data_matches@plt>
cmp    $0x0,%eax
jne    11d6 <data_check+0xa6>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
add    0x10(%rbp),%rdx
mov    -0x10(%rbp),%rcx
add    0x10(%rbp),%rcx
add    0x18(%rbp),%rcx
lea    0xe2f(%rip),%rdi
call   1040 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<data_check>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%r12
mov    %r8,%rbp
mov    %ecx,0xc(%rsp)
mov    %edx,0x8(%rsp)
mov    %rsi,%rbx
mov    %rdi,%r14
mov    0x58(%rsp),%r15
mov    0x50(%rsp),%r13
mov    %r8,%rdi
shr    $0x3f,%rdi
xor    $0x1,%edi
call   1050 <assert@plt>
xor    %edi,%edi
cmp    %r12,%rbp
setle  %dil
call   1050 <assert@plt>
mov    %r14,0x10(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    %rbp,%r8
mov    %r12,%r9
push   %r15
push   %r13
call   1030 <data_matches@plt>
add    $0x10,%rsp
test   %eax,%eax
je     11b2 <data_check+0x82>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
add    %rbx,%r13
add    %r13,%r15
lea    0xe41(%rip),%rdi
mov    0x10(%rsp),%rsi
mov    %r13,%rdx
mov    %r15,%rcx
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"ERROR: file %s range %lld-%lld contains garbage\0A\00"
define void @data_check(i8* %0, i64 %1, i32 %2, i32 %3, i64 %4, i64 %5, i64 %6, i64 %7) {
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
store i8* %0, i8** %9
store i64 %1, i64* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i64 %4, i64* %13
store i64 %5, i64* %14
store i64 %6, i64* %15
store i64 %7, i64* %16
%17 = load i64, i64* %13
%18 = icmp sge i64 %17, 0
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = load i64, i64* %13
%22 = load i64, i64* %14
%23 = icmp sle i64 %21, %22
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = load i8*, i8** %9
%27 = load i64, i64* %10
%28 = load i32, i32* %11
%29 = load i32, i32* %12
%30 = load i64, i64* %13
%31 = load i64, i64* %14
%32 = load i64, i64* %15
%33 = load i64, i64* %16
%34 = call i32 @data_matches(i8* %26, i64 %27, i32 %28, i32 %29, i64 %30, i64 %31, i64 %32, i64 %33)
%35 = icmp ne i32 %34, 0
br i1 %35, label %47, label %36
36: ; preds = %8
%37 = load i8*, i8** %9
%38 = load i64, i64* %10
%39 = load i64, i64* %15
%40 = add nsw i64 %38, %39
%41 = load i64, i64* %10
%42 = load i64, i64* %15
%43 = add nsw i64 %41, %42
%44 = load i64, i64* %16
%45 = add nsw i64 %43, %44
%46 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %37, i64 %40, i64 %45)
br label %47
47: ; preds = %36, %8
ret void
}

LLVM IR (-O2):
@.str = [49 x i8] c"ERROR: file %s range %lld-%lld contains garbage\0A\00"
define void @data_check(i8* %0, i64 %1, i32 %2, i32 %3, i64 %4, i64 %5, i64 %6, i64 %7) {
%9 = lshr i64 %4, 63
%10 = trunc i64 %9 to i32
%11 = xor i32 %10, 1
%12 = tail call i32 @assert(i32 %11)
%13 = icmp sle i64 %4, %5
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
%16 = tail call i32 @data_matches(i8* %0, i64 %1, i32 %2, i32 %3, i64 %4, i64 %5, i64 %6, i64 %7)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %8
%19 = add nsw i64 %6, %1
%20 = add nsw i64 %19, %7
%21 = tail call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i8* %0, i64 %19, i64 %20)
br label %22
22: ; preds = %18, %8
ret void
}