#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 */
typedef struct TYPE_5__ TYPE_1__;

/* Type definitions */
struct TYPE_5__ {
  int member_0;
  int member_1;
  int member_2;
};
typedef TYPE_1__ uint8_t;
typedef int uint32_t;

/* Variables and functions */
scalar_t__ searchForBytes(TYPE_1__ const *, int, TYPE_1__ *, int, int);
int isProbablyE7(const uint8_t *image, uint32_t size) {
  uint8_t signature[7][3] = {{0xAD, 0xE2, 0xFF}, {0xAD, 0xE5, 0xFF},
                             {0xAD, 0xE5, 0x1F}, {0xAD, 0xE7, 0x1F},
                             {0x0C, 0xE7, 0x1F}, {0x8D, 0xE7, 0xFF},
                             {0x8D, 0xE7, 0x1F}};
  uint32_t i;
  for (i = 0; i < 7; ++i)
    if (searchForBytes(image, size, signature[i], 3, 1))
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isProbablyE7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xec0(%rip),%rsi
mov    $0xfc,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x114(%rbp)
cmpl   $0x7,-0x114(%rbp)
jge    11bc <isProbablyE7+0x9c>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
movslq -0x114(%rbp),%rax
lea    -0x110(%rbp),%rdx
imul   $0x24,%rax,%rax
add    %rax,%rdx
mov    $0x3,%ecx
mov    $0x1,%r8d
call   1030 <searchForBytes@plt>
cmp    $0x0,%rax
je     11a3 <isProbablyE7+0x83>
movl   $0x1,-0x4(%rbp)
jmp    11c3 <isProbablyE7+0xa3>
jmp    11a8 <isProbablyE7+0x88>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    1154 <isProbablyE7+0x34>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isProbablyE7>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %esi,%r14d
mov    %rdi,%r15
lea    0xec6(%rip),%rsi
mov    %rsp,%rbx
mov    $0xfc,%edx
mov    %rbx,%rdi
call   1040 <memcpy@plt>
mov    $0x1,%ebp
mov    %r15,%rdi
mov    %r14d,%esi
mov    %rbx,%rdx
mov    $0x3,%ecx
mov    $0x1,%r8d
call   1030 <searchForBytes@plt>
test   %rax,%rax
jne    125f <isProbablyE7+0x13f>
lea    0x24(%rsp),%rdx
mov    $0x1,%ebp
mov    %r15,%rdi
mov    %r14d,%esi
mov    $0x3,%ecx
mov    $0x1,%r8d
call   1030 <searchForBytes@plt>
test   %rax,%rax
jne    125f <isProbablyE7+0x13f>
lea    0x48(%rsp),%rdx
mov    $0x1,%ebp
mov    %r15,%rdi
mov    %r14d,%esi
mov    $0x3,%ecx
mov    $0x1,%r8d
call   1030 <searchForBytes@plt>
test   %rax,%rax
jne    125f <isProbablyE7+0x13f>
lea    0x6c(%rsp),%rdx
mov    $0x1,%ebp
mov    %r15,%rdi
mov    %r14d,%esi
mov    $0x3,%ecx
mov    $0x1,%r8d
call   1030 <searchForBytes@plt>
test   %rax,%rax
jne    125f <isProbablyE7+0x13f>
lea    0x90(%rsp),%rdx
mov    $0x1,%ebp
mov    %r15,%rdi
mov    %r14d,%esi
mov    $0x3,%ecx
mov    $0x1,%r8d
call   1030 <searchForBytes@plt>
test   %rax,%rax
jne    125f <isProbablyE7+0x13f>
lea    0xb4(%rsp),%rdx
mov    $0x1,%ebp
mov    %r15,%rdi
mov    %r14d,%esi
mov    $0x3,%ecx
mov    $0x1,%r8d
call   1030 <searchForBytes@plt>
test   %rax,%rax
jne    125f <isProbablyE7+0x13f>
lea    0xd8(%rsp),%rdx
mov    %r15,%rdi
mov    %r14d,%esi
mov    $0x3,%ecx
mov    $0x1,%r8d
call   1030 <searchForBytes@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %ebp,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32, i32, i32 }
@__const.isProbablyE7.signature = [7 x [3 x %struct.TYPE_5__]] [[3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 173, i32 226, i32 255 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer], [3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 173, i32 229, i32 255 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer], [3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 173, i32 229, i32 31 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer], [3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 173, i32 231, i32 31 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer], [3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 12, i32 231, i32 31 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer], [3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 141, i32 231, i32 255 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer], [3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 141, i32 231, i32 31 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer]]
define i32 @isProbablyE7(%struct.TYPE_5__* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_5__*
%5 = alloca i32
%6 = alloca [7 x [3 x %struct.TYPE_5__]]
%7 = alloca i32
store %struct.TYPE_5__* %0, %struct.TYPE_5__** %4
store i32 %1, i32* %5
%8 = bitcast [7 x [3 x %struct.TYPE_5__]]* %6 to i8*
store i32 0, i32* %7
br label %9
9: ; preds = %23, %2
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 7
br i1 %11, label %12, label %26
12: ; preds = %9
%13 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%14 = load i32, i32* %5
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [7 x [3 x %struct.TYPE_5__]], [7 x [3 x %struct.TYPE_5__]]* %6, i64 0, i64 %16
%18 = getelementptr inbounds [3 x %struct.TYPE_5__], [3 x %struct.TYPE_5__]* %17, i64 0, i64 0
%19 = call i64 @searchForBytes(%struct.TYPE_5__* %13, i32 %14, %struct.TYPE_5__* %18, i32 3, i32 1)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %12
store i32 1, i32* %3
br label %27
22: ; preds = %12
br label %23
23: ; preds = %22
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
store i32 %25, i32* %7
br label %9
26: ; preds = %9
store i32 0, i32* %3
br label %27
27: ; preds = %26, %21
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32, i32, i32 }
@__const.isProbablyE7.signature = [7 x [3 x %struct.TYPE_5__]] [[3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 173, i32 226, i32 255 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer], [3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 173, i32 229, i32 255 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer], [3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 173, i32 229, i32 31 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer], [3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 173, i32 231, i32 31 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer], [3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 12, i32 231, i32 31 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer], [3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 141, i32 231, i32 255 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer], [3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 141, i32 231, i32 31 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer]]
define i32 @isProbablyE7(%struct.TYPE_5__* %0, i32 %1) {
%3 = alloca [7 x [3 x %struct.TYPE_5__]]
%4 = bitcast [7 x [3 x %struct.TYPE_5__]]* %3 to i8*
%5 = getelementptr inbounds [7 x [3 x %struct.TYPE_5__]], [7 x [3 x %struct.TYPE_5__]]* %3, i64 0, i64 0, i64 0
%6 = call i64 @searchForBytes(%struct.TYPE_5__* %0, i32 %1, %struct.TYPE_5__* %5, i32 3, i32 1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %33
8: ; preds = %2
%9 = getelementptr inbounds [7 x [3 x %struct.TYPE_5__]], [7 x [3 x %struct.TYPE_5__]]* %3, i64 0, i64 1, i64 0
%10 = call i64 @searchForBytes(%struct.TYPE_5__* %0, i32 %1, %struct.TYPE_5__* %9, i32 3, i32 1)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %33
12: ; preds = %8
%13 = getelementptr inbounds [7 x [3 x %struct.TYPE_5__]], [7 x [3 x %struct.TYPE_5__]]* %3, i64 0, i64 2, i64 0
%14 = call i64 @searchForBytes(%struct.TYPE_5__* %0, i32 %1, %struct.TYPE_5__* %13, i32 3, i32 1)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %33
16: ; preds = %12
%17 = getelementptr inbounds [7 x [3 x %struct.TYPE_5__]], [7 x [3 x %struct.TYPE_5__]]* %3, i64 0, i64 3, i64 0
%18 = call i64 @searchForBytes(%struct.TYPE_5__* %0, i32 %1, %struct.TYPE_5__* %17, i32 3, i32 1)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %33
20: ; preds = %16
%21 = getelementptr inbounds [7 x [3 x %struct.TYPE_5__]], [7 x [3 x %struct.TYPE_5__]]* %3, i64 0, i64 4, i64 0
%22 = call i64 @searchForBytes(%struct.TYPE_5__* %0, i32 %1, %struct.TYPE_5__* %21, i32 3, i32 1)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %33
24: ; preds = %20
%25 = getelementptr inbounds [7 x [3 x %struct.TYPE_5__]], [7 x [3 x %struct.TYPE_5__]]* %3, i64 0, i64 5, i64 0
%26 = call i64 @searchForBytes(%struct.TYPE_5__* %0, i32 %1, %struct.TYPE_5__* %25, i32 3, i32 1)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = getelementptr inbounds [7 x [3 x %struct.TYPE_5__]], [7 x [3 x %struct.TYPE_5__]]* %3, i64 0, i64 6, i64 0
%30 = call i64 @searchForBytes(%struct.TYPE_5__* %0, i32 %1, %struct.TYPE_5__* %29, i32 3, i32 1)
%31 = icmp ne i64 %30, 0
%32 = zext i1 %31 to i32
br label %33
33: ; preds = %28, %24, %20, %16, %12, %8, %2
%34 = phi i32 [ 1, %2 ], [ 1, %8 ], [ 1, %12 ], [ 1, %16 ], [ 1, %20 ], [ 1, %24 ], [ %32, %28 ]
ret i32 %34
}