int search_ares(const unsigned char *payload, const int plen, int payload_len) {
  if (payload[1] == 0 && (plen - payload[0]) == 3) {
    switch (payload[2]) {
    case 0x5a:
      if (plen == 6 && payload[5] == 0x05)
        return ((13 * 100) + 1);
      break;
    case 0x09:
      if (plen >= 14 && plen <= 34)
        return ((13 * 100) + 1);
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<search_ares>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movzbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    11b4 <search_ares+0xb4>
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
movzbl (%rcx),%ecx
sub    %ecx,%eax
cmp    $0x3,%eax
jne    11b4 <search_ares+0xb4>
mov    -0x10(%rbp),%rax
movzbl 0x2(%rax),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x9,%eax
je     118a <search_ares+0x8a>
jmp    114d <search_ares+0x4d>
mov    -0x1c(%rbp),%eax
sub    $0x5a,%eax
jne    11af <search_ares+0xaf>
jmp    115e <search_ares+0x5e>
cmpl   $0x6,-0x14(%rbp)
jne    1185 <search_ares+0x85>
mov    -0x10(%rbp),%rax
movzbl 0x5(%rax),%eax
cmp    $0x5,%eax
jne    1185 <search_ares+0x85>
movl   $0x515,-0x4(%rbp)
jmp    11bb <search_ares+0xbb>
jmp    11af <search_ares+0xaf>
cmpl   $0xe,-0x14(%rbp)
jl     11aa <search_ares+0xaa>
cmpl   $0x22,-0x14(%rbp)
jg     11aa <search_ares+0xaa>
movl   $0x515,-0x4(%rbp)
jmp    11bb <search_ares+0xbb>
jmp    11af <search_ares+0xaf>
jmp    11b4 <search_ares+0xb4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<search_ares>:
cmpb   $0x0,0x1(%rdi)
jne    113c <search_ares+0x3c>
movzbl (%rdi),%eax
mov    %esi,%ecx
sub    %eax,%ecx
cmp    $0x3,%ecx
jne    113c <search_ares+0x3c>
mov    0x2(%rdi),%al
cmp    $0x9,%al
je     112f <search_ares+0x2f>
cmp    $0x5a,%al
jne    113c <search_ares+0x3c>
cmp    $0x6,%esi
jne    113c <search_ares+0x3c>
mov    $0x515,%eax
cmpb   $0x5,0x5(%rdi)
jne    113c <search_ares+0x3c>
jmp    113e <search_ares+0x3e>
add    $0xfffffff2,%esi
mov    $0x515,%eax
cmp    $0x15,%esi
jb     113e <search_ares+0x3e>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @search_ares(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i8*, i8** %5
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %46
13: ; preds = %3
%14 = load i32, i32* %6
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = sub nsw i32 %14, %18
%20 = icmp eq i32 %19, 3
br i1 %20, label %21, label %46
21: ; preds = %13
%22 = load i8*, i8** %5
%23 = getelementptr inbounds i8, i8* %22, i64 2
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
switch i32 %25, label %45 [
i32 90, label %26
i32 9, label %37
]
26: ; preds = %21
%27 = load i32, i32* %6
%28 = icmp eq i32 %27, 6
br i1 %28, label %29, label %36
29: ; preds = %26
%30 = load i8*, i8** %5
%31 = getelementptr inbounds i8, i8* %30, i64 5
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
%34 = icmp eq i32 %33, 5
br i1 %34, label %35, label %36
35: ; preds = %29
store i32 1301, i32* %4
br label %47
36: ; preds = %29, %26
br label %45
37: ; preds = %21
%38 = load i32, i32* %6
%39 = icmp sge i32 %38, 14
br i1 %39, label %40, label %44
40: ; preds = %37
%41 = load i32, i32* %6
%42 = icmp sle i32 %41, 34
br i1 %42, label %43, label %44
43: ; preds = %40
store i32 1301, i32* %4
br label %47
44: ; preds = %40, %37
br label %45
45: ; preds = %21, %44, %36
br label %46
46: ; preds = %45, %13, %3
store i32 0, i32* %4
br label %47
47: ; preds = %46, %43, %35
%48 = load i32, i32* %4
ret i32 %48
}

LLVM IR (-O2):
define i32 @search_ares(i8* nocapture %0, i32 %1, i32 %2) {
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %24
7: ; preds = %3
%8 = load i8, i8* %0
%9 = zext i8 %8 to i32
%10 = sub nsw i32 %1, %9
%11 = icmp eq i32 %10, 3
br i1 %11, label %12, label %24
12: ; preds = %7
%13 = getelementptr inbounds i8, i8* %0, i64 2
%14 = load i8, i8* %13
switch i8 %14, label %24 [
i8 90, label %15
i8 9, label %21
]
15: ; preds = %12
%16 = icmp eq i32 %1, 6
br i1 %16, label %17, label %24
17: ; preds = %15
%18 = getelementptr inbounds i8, i8* %0, i64 5
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 5
br i1 %20, label %25, label %24
21: ; preds = %12
%22 = add i32 %1, -14
%23 = icmp ult i32 %22, 21
br i1 %23, label %25, label %24
24: ; preds = %12, %17, %15, %21, %7, %3
br label %25
25: ; preds = %21, %17, %24
%26 = phi i32 [ 0, %24 ], [ 1301, %17 ], [ 1301, %21 ]
ret i32 %26
}