#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 /*<<< orphan*/ uint32_t;

/* Variables and functions */
int searchForBytes(TYPE_1__ const *, int /*<<< orphan*/, TYPE_1__ *, int, int);
int isProbablyCV(const uint8_t *image, uint32_t size) {
  uint8_t signature[2][3] = {{0x9D, 0xFF, 0xF3}, {0x99, 0x00, 0xF4}};
  if (searchForBytes(image, size, signature[0], 3, 1))
    return 1;
  else
    return searchForBytes(image, size, signature[1], 3, 1);
}


x86 assembly (clang, -O0):
<isProbablyCV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1040 <memset@plt>
movl   $0x9d,-0x60(%rbp)
movl   $0xff,-0x5c(%rbp)
movl   $0xf3,-0x58(%rbp)
movl   $0x99,-0x3c(%rbp)
movl   $0xf4,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
lea    -0x60(%rbp),%rdx
mov    $0x3,%ecx
mov    $0x1,%r8d
call   1030 <searchForBytes@plt>
cmp    $0x0,%eax
je     1192 <isProbablyCV+0x72>
movl   $0x1,-0x4(%rbp)
jmp    11b4 <isProbablyCV+0x94>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
lea    -0x60(%rbp),%rdx
add    $0x24,%rdx
mov    $0x3,%ecx
mov    $0x1,%r8d
call   1030 <searchForBytes@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isProbablyCV>:
push   %rbp
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x40(%rsp)
movabs $0xff0000009d,%rax
mov    %rax,(%rsp)
movl   $0xf3,0x8(%rsp)
movl   $0x99,0x24(%rsp)
movl   $0xf4,0x2c(%rsp)
mov    %rsp,%rdx
mov    $0x1,%ebp
mov    $0x3,%ecx
mov    $0x1,%r8d
call   1030 <searchForBytes@plt>
test   %eax,%eax
jne    119c <isProbablyCV+0x8c>
lea    0x24(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14d,%esi
mov    $0x3,%ecx
mov    $0x1,%r8d
call   1030 <searchForBytes@plt>
mov    %eax,%ebp
mov    %ebp,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32, i32, i32 }
define i32 @isProbablyCV(%struct.TYPE_5__* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_5__*
%5 = alloca i32
%6 = alloca [2 x [3 x %struct.TYPE_5__]]
store %struct.TYPE_5__* %0, %struct.TYPE_5__** %4
store i32 %1, i32* %5
%7 = bitcast [2 x [3 x %struct.TYPE_5__]]* %6 to i8*
%8 = bitcast i8* %7 to [2 x [3 x %struct.TYPE_5__]]*
%9 = getelementptr inbounds [2 x [3 x %struct.TYPE_5__]], [2 x [3 x %struct.TYPE_5__]]* %8, i32 0, i32 0
%10 = getelementptr inbounds [3 x %struct.TYPE_5__], [3 x %struct.TYPE_5__]* %9, i32 0, i32 0
%11 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %10, i32 0, i32 0
store i32 157, i32* %11
%12 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %10, i32 0, i32 1
store i32 255, i32* %12
%13 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %10, i32 0, i32 2
store i32 243, i32* %13
%14 = getelementptr inbounds [2 x [3 x %struct.TYPE_5__]], [2 x [3 x %struct.TYPE_5__]]* %8, i32 0, i32 1
%15 = getelementptr inbounds [3 x %struct.TYPE_5__], [3 x %struct.TYPE_5__]* %14, i32 0, i32 0
%16 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %15, i32 0, i32 0
store i32 153, i32* %16
%17 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %15, i32 0, i32 2
store i32 244, i32* %17
%18 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%19 = load i32, i32* %5
%20 = getelementptr inbounds [2 x [3 x %struct.TYPE_5__]], [2 x [3 x %struct.TYPE_5__]]* %6, i64 0, i64 0
%21 = getelementptr inbounds [3 x %struct.TYPE_5__], [3 x %struct.TYPE_5__]* %20, i64 0, i64 0
%22 = call i32 @searchForBytes(%struct.TYPE_5__* %18, i32 %19, %struct.TYPE_5__* %21, i32 3, i32 1)
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %2
store i32 1, i32* %3
br label %31
25: ; preds = %2
%26 = load %struct.TYPE_5__*, %struct.TYPE_5__** %4
%27 = load i32, i32* %5
%28 = getelementptr inbounds [2 x [3 x %struct.TYPE_5__]], [2 x [3 x %struct.TYPE_5__]]* %6, i64 0, i64 1
%29 = getelementptr inbounds [3 x %struct.TYPE_5__], [3 x %struct.TYPE_5__]* %28, i64 0, i64 0
%30 = call i32 @searchForBytes(%struct.TYPE_5__* %26, i32 %27, %struct.TYPE_5__* %29, i32 3, i32 1)
store i32 %30, i32* %3
br label %31
31: ; preds = %25, %24
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32, i32, i32 }
define i32 @isProbablyCV(%struct.TYPE_5__* %0, i32 %1) {
%3 = alloca [2 x [3 x %struct.TYPE_5__]]
%4 = bitcast [2 x [3 x %struct.TYPE_5__]]* %3 to i8*
%5 = getelementptr inbounds [2 x [3 x %struct.TYPE_5__]], [2 x [3 x %struct.TYPE_5__]]* %3, i64 0, i64 0, i64 0, i32 0
store i32 157, i32* %5
%6 = getelementptr inbounds [2 x [3 x %struct.TYPE_5__]], [2 x [3 x %struct.TYPE_5__]]* %3, i64 0, i64 0, i64 0, i32 1
store i32 255, i32* %6
%7 = getelementptr inbounds [2 x [3 x %struct.TYPE_5__]], [2 x [3 x %struct.TYPE_5__]]* %3, i64 0, i64 0, i64 0, i32 2
store i32 243, i32* %7
%8 = getelementptr inbounds [2 x [3 x %struct.TYPE_5__]], [2 x [3 x %struct.TYPE_5__]]* %3, i64 0, i64 1, i64 0, i32 0
store i32 153, i32* %8
%9 = getelementptr inbounds [2 x [3 x %struct.TYPE_5__]], [2 x [3 x %struct.TYPE_5__]]* %3, i64 0, i64 1, i64 0, i32 2
store i32 244, i32* %9
%10 = getelementptr inbounds [2 x [3 x %struct.TYPE_5__]], [2 x [3 x %struct.TYPE_5__]]* %3, i64 0, i64 0, i64 0
%11 = call i32 @searchForBytes(%struct.TYPE_5__* %0, i32 %1, %struct.TYPE_5__* %10, i32 3, i32 1)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = getelementptr inbounds [2 x [3 x %struct.TYPE_5__]], [2 x [3 x %struct.TYPE_5__]]* %3, i64 0, i64 1, i64 0
%15 = call i32 @searchForBytes(%struct.TYPE_5__* %0, i32 %1, %struct.TYPE_5__* %14, i32 3, i32 1)
br label %16
16: ; preds = %2, %13
%17 = phi i32 [ %15, %13 ], [ 1, %2 ]
ret i32 %17
}