#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 */
struct NetFrame {
  int dummy;
};
struct Ferret {
  int dummy;
};

/* Variables and functions */
scalar_t__ MATCHES(char *, unsigned char const *, int);
unsigned smellslike_udp_tivoconnect(struct Ferret *ferret,
                                    struct NetFrame *frame,
                                    const unsigned char *px, unsigned length,
                                    unsigned direction) {
  ferret = (ferret);
  frame = (frame);
  direction = (direction);
  if (length > 12) {
    if (MATCHES("tivoconnect=", px, 12)) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<smellslike_udp_tivoconnect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
cmpl   $0xc,-0x24(%rbp)
jbe    117b <smellslike_udp_tivoconnect+0x6b>
mov    -0x20(%rbp),%rsi
lea    0xeaa(%rip),%rdi
mov    $0xc,%edx
call   1030 <MATCHES@plt>
cmp    $0x0,%rax
je     1176 <smellslike_udp_tivoconnect+0x66>
movl   $0x1,-0x4(%rbp)
jmp    1182 <smellslike_udp_tivoconnect+0x72>
jmp    117b <smellslike_udp_tivoconnect+0x6b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smellslike_udp_tivoconnect>:
cmp    $0xd,%ecx
jb     113d <smellslike_udp_tivoconnect+0x2d>
push   %rax
lea    0xee3(%rip),%rdi
mov    %rdx,%rsi
mov    $0xc,%edx
call   1030 <MATCHES@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
lea    0x8(%rsp),%rsp
je     113d <smellslike_udp_tivoconnect+0x2d>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.Ferret = type { i32 }
%struct.NetFrame = type { i32 }
@.str = [13 x i8] c"tivoconnect=\00"
define i32 @smellslike_udp_tivoconnect(%struct.Ferret* %0, %struct.NetFrame* %1, i8* %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca %struct.Ferret*
%8 = alloca %struct.NetFrame*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
store %struct.Ferret* %0, %struct.Ferret** %7
store %struct.NetFrame* %1, %struct.NetFrame** %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
%12 = load %struct.Ferret*, %struct.Ferret** %7
store %struct.Ferret* %12, %struct.Ferret** %7
%13 = load %struct.NetFrame*, %struct.NetFrame** %8
store %struct.NetFrame* %13, %struct.NetFrame** %8
%14 = load i32, i32* %11
store i32 %14, i32* %11
%15 = load i32, i32* %10
%16 = icmp ugt i32 %15, 12
br i1 %16, label %17, label %23
17: ; preds = %5
%18 = load i8*, i8** %9
%19 = call i64 @MATCHES(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %18, i32 12)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 1, i32* %6
br label %24
22: ; preds = %17
br label %23
23: ; preds = %22, %5
store i32 0, i32* %6
br label %24
24: ; preds = %23, %21
%25 = load i32, i32* %6
ret i32 %25
}

LLVM IR (-O2):
%struct.Ferret = type { i32 }
%struct.NetFrame = type { i32 }
@.str = [13 x i8] c"tivoconnect=\00"
define i32 @smellslike_udp_tivoconnect(%struct.Ferret* nocapture readnone %0, %struct.NetFrame* nocapture readnone %1, i8* %2, i32 %3, i32 %4) {
%6 = icmp ugt i32 %3, 12
br i1 %6, label %7, label %10
7: ; preds = %5
%8 = tail call i64 @MATCHES(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %2, i32 12)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7, %5
br label %11
11: ; preds = %7, %10
%12 = phi i32 [ 0, %10 ], [ 1, %7 ]
ret i32 %12
}