#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 isProbablyUA(const uint8_t *image, uint32_t size) {
  uint8_t signature[3][3] = {
      {0x8D, 0x40, 0x02}, {0xAD, 0x40, 0x02}, {0xBD, 0x1F, 0x02}};
  uint32_t i;
  for (i = 0; i < 3; ++i)
    if (searchForBytes(image, size, signature[i], 3, 1))
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isProbablyUA>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xec3(%rip),%rsi
mov    $0x6c,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x84(%rbp)
cmpl   $0x3,-0x84(%rbp)
jge    11b6 <isProbablyUA+0x96>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
movslq -0x84(%rbp),%rax
lea    -0x80(%rbp),%rdx
imul   $0x24,%rax,%rax
add    %rax,%rdx
mov    $0x3,%ecx
mov    $0x1,%r8d
call   1030 <searchForBytes@plt>
cmp    $0x0,%rax
je     119d <isProbablyUA+0x7d>
movl   $0x1,-0x4(%rbp)
jmp    11bd <isProbablyUA+0x9d>
jmp    11a2 <isProbablyUA+0x82>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1151 <isProbablyUA+0x31>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isProbablyUA>:
push   %rbp
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
movups 0xf37(%rip),%xmm0
movups %xmm0,0x5c(%rsp)
movaps 0xf1f(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xf03(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xee7(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeaf(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe93(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdx
mov    $0x1,%ebp
mov    $0x3,%ecx
mov    $0x1,%r8d
call   1030 <searchForBytes@plt>
test   %rax,%rax
jne    11d7 <isProbablyUA+0xc7>
lea    0x24(%rsp),%rdx
mov    $0x1,%ebp
mov    %rbx,%rdi
mov    %r14d,%esi
mov    $0x3,%ecx
mov    $0x1,%r8d
call   1030 <searchForBytes@plt>
test   %rax,%rax
jne    11d7 <isProbablyUA+0xc7>
lea    0x48(%rsp),%rdx
mov    %rbx,%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    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32, i32, i32 }
@__const.isProbablyUA.signature = [3 x [3 x %struct.TYPE_5__]] [[3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 141, i32 64, i32 2 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer], [3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 173, i32 64, i32 2 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer], [3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 189, i32 31, i32 2 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer]]
define i32 @isProbablyUA(%struct.TYPE_5__* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_5__*
%5 = alloca i32
%6 = alloca [3 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 [3 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, 3
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 [3 x [3 x %struct.TYPE_5__]], [3 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.isProbablyUA.signature = [3 x [3 x %struct.TYPE_5__]] [[3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 141, i32 64, i32 2 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer], [3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 173, i32 64, i32 2 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer], [3 x %struct.TYPE_5__] [%struct.TYPE_5__ { i32 189, i32 31, i32 2 }, %struct.TYPE_5__ zeroinitializer, %struct.TYPE_5__ zeroinitializer]]
define i32 @isProbablyUA(%struct.TYPE_5__* %0, i32 %1) {
%3 = alloca [3 x [3 x %struct.TYPE_5__]]
%4 = bitcast [3 x [3 x %struct.TYPE_5__]]* %3 to i8*
%5 = getelementptr inbounds [3 x [3 x %struct.TYPE_5__]], [3 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 %17
8: ; preds = %2
%9 = getelementptr inbounds [3 x [3 x %struct.TYPE_5__]], [3 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 %17
12: ; preds = %8
%13 = getelementptr inbounds [3 x [3 x %struct.TYPE_5__]], [3 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 ne i64 %14, 0
%16 = zext i1 %15 to i32
br label %17
17: ; preds = %12, %8, %2
%18 = phi i32 [ 1, %2 ], [ 1, %8 ], [ %16, %12 ]
ret i32 %18
}