#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 */

/* Variables and functions */
scalar_t__ strlen(char *);
int process_received_packet(char *packet) {
  if (strlen(packet) > 0) {
    char first_byte = packet[0];
    switch (first_byte) {
    case 0x00:
      return 1;
    case 0x01:
      return 1;
    case 0x02:
      return 1;
    case 0x03:
      return 1;
    case 0x04:
      return 1;
    case 0xEE:
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<process_received_packet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jle    11f0 <process_received_packet+0xe0>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
mov    %eax,-0x18(%rbp)
test   %eax,%eax
je     11a3 <process_received_packet+0x93>
jmp    114c <process_received_packet+0x3c>
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
je     11af <process_received_packet+0x9f>
jmp    115d <process_received_packet+0x4d>
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
je     11bb <process_received_packet+0xab>
jmp    116e <process_received_packet+0x5e>
mov    -0x18(%rbp),%eax
sub    $0x3,%eax
je     11c7 <process_received_packet+0xb7>
jmp    117f <process_received_packet+0x6f>
mov    -0x18(%rbp),%eax
sub    $0x4,%eax
je     11d3 <process_received_packet+0xc3>
jmp    1190 <process_received_packet+0x80>
mov    -0x18(%rbp),%eax
sub    $0xee,%eax
je     11df <process_received_packet+0xcf>
jmp    11eb <process_received_packet+0xdb>
movl   $0x1,-0x4(%rbp)
jmp    11f7 <process_received_packet+0xe7>
movl   $0x1,-0x4(%rbp)
jmp    11f7 <process_received_packet+0xe7>
movl   $0x1,-0x4(%rbp)
jmp    11f7 <process_received_packet+0xe7>
movl   $0x1,-0x4(%rbp)
jmp    11f7 <process_received_packet+0xe7>
movl   $0x1,-0x4(%rbp)
jmp    11f7 <process_received_packet+0xe7>
movl   $0x1,-0x4(%rbp)
jmp    11f7 <process_received_packet+0xe7>
jmp    11f0 <process_received_packet+0xe0>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_received_packet>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %rax,%rax
jle    1128 <process_received_packet+0x18>
mov    $0x1,%eax
cmpb   $0x5,(%rbx)
jb     112a <process_received_packet+0x1a>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @process_received_packet(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @strlen(i8* %5)
%7 = icmp sgt i64 %6, 0
br i1 %7, label %8, label %21
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
store i8 %11, i8* %4
%12 = load i8, i8* %4
%13 = sext i8 %12 to i32
switch i32 %13, label %20 [
i32 0, label %14
i32 1, label %15
i32 2, label %16
i32 3, label %17
i32 4, label %18
i32 238, label %19
]
14: ; preds = %8
store i32 1, i32* %2
br label %22
15: ; preds = %8
store i32 1, i32* %2
br label %22
16: ; preds = %8
store i32 1, i32* %2
br label %22
17: ; preds = %8
store i32 1, i32* %2
br label %22
18: ; preds = %8
store i32 1, i32* %2
br label %22
19: ; preds = %8
store i32 1, i32* %2
br label %22
20: ; preds = %8
br label %21
21: ; preds = %20, %1
store i32 0, i32* %2
br label %22
22: ; preds = %21, %19, %18, %17, %16, %15, %14
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @process_received_packet(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = icmp sgt i64 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i8, i8* %0
%6 = icmp ugt i8 %5, 4
br i1 %6, label %7, label %8
7: ; preds = %4, %1
br label %8
8: ; preds = %4, %7
%9 = phi i32 [ 1, %4 ], [ 0, %7 ]
ret i32 %9
}