#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 */
scalar_t__ clHCA_CheckSum(void const *, int, int /*<<< orphan*/);
int clHCA_isOurFile0(void const *);
int clHCA_isOurFile1(const void *data, unsigned int size) {
  int minsize;
  if (size < 8)
    return -1;
  minsize = clHCA_isOurFile0(data);
  if (minsize < 0 || minsize > size)
    return -1;
  if (clHCA_CheckSum(data, minsize, 0))
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<clHCA_isOurFile1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jae    1145 <clHCA_isOurFile1+0x25>
movl   $0xffffffff,-0x4(%rbp)
jmp    119e <clHCA_isOurFile1+0x7e>
mov    -0x10(%rbp),%rdi
call   1040 <clHCA_isOurFile0@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     1167 <clHCA_isOurFile1+0x47>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jbe    1173 <clHCA_isOurFile1+0x53>
movl   $0xffffffff,-0x4(%rbp)
jmp    119e <clHCA_isOurFile1+0x7e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
xor    %edx,%edx
call   1030 <clHCA_CheckSum@plt>
cmp    $0x0,%rax
je     1197 <clHCA_isOurFile1+0x77>
movl   $0xffffffff,-0x4(%rbp)
jmp    119e <clHCA_isOurFile1+0x7e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clHCA_isOurFile1>:
push   %rbp
push   %r14
push   %rbx
mov    $0xffffffff,%ebx
cmp    $0x8,%esi
jb     1151 <clHCA_isOurFile1+0x31>
mov    %esi,%ebp
mov    %rdi,%r14
call   1040 <clHCA_isOurFile0@plt>
test   %eax,%eax
js     1151 <clHCA_isOurFile1+0x31>
cmp    %ebp,%eax
ja     1151 <clHCA_isOurFile1+0x31>
mov    %r14,%rdi
mov    %eax,%esi
xor    %edx,%edx
call   1030 <clHCA_CheckSum@plt>
neg    %rax
sbb    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @clHCA_isOurFile1(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = icmp ult i32 %7, 8
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 -1, i32* %3
br label %27
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = call i32 @clHCA_isOurFile0(i8* %11)
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %10
%16 = load i32, i32* %6
%17 = load i32, i32* %5
%18 = icmp ugt i32 %16, %17
br i1 %18, label %19, label %20
19: ; preds = %15, %10
store i32 -1, i32* %3
br label %27
20: ; preds = %15
%21 = load i8*, i8** %4
%22 = load i32, i32* %6
%23 = call i64 @clHCA_CheckSum(i8* %21, i32 %22, i32 0)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %20
store i32 -1, i32* %3
br label %27
26: ; preds = %20
store i32 0, i32* %3
br label %27
27: ; preds = %26, %25, %19, %9
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
define i32 @clHCA_isOurFile1(i8* %0, i32 %1) {
%3 = icmp ult i32 %1, 8
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = tail call i32 @clHCA_isOurFile0(i8* %0)
%6 = icmp slt i32 %5, 0
%7 = icmp ugt i32 %5, %1
%8 = or i1 %6, %7
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = tail call i64 @clHCA_CheckSum(i8* %0, i32 %5, i32 0)
%11 = icmp ne i64 %10, 0
%12 = sext i1 %11 to i32
br label %13
13: ; preds = %9, %4, %2
%14 = phi i32 [ -1, %2 ], [ -1, %4 ], [ %12, %9 ]
ret i32 %14
}