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

/* Variables and functions */
int /*<<< orphan*/ FRAMERR(struct NetFrame *, char *, unsigned char const);
int /*<<< orphan*/ process_wifi_associate_request(struct Seaper *,
                                                  struct NetFrame *,
                                                  unsigned char const *,
                                                  unsigned int);
int /*<<< orphan*/ process_wifi_beacon(struct Seaper *, struct NetFrame *,
                                       unsigned char const *, unsigned int);
int /*<<< orphan*/ process_wifi_data(struct Seaper *, struct NetFrame *,
                                     unsigned char const *, unsigned int);
int /*<<< orphan*/ process_wifi_deauthentication(struct Seaper *,
                                                 struct NetFrame *,
                                                 unsigned char const *,
                                                 unsigned int);
int /*<<< orphan*/ process_wifi_disassociate_request(struct Seaper *,
                                                     struct NetFrame *,
                                                     unsigned char const *,
                                                     unsigned int);
int /*<<< orphan*/ process_wifi_probe(struct Seaper *, struct NetFrame *,
                                      unsigned char const *, unsigned int);
int /*<<< orphan*/ process_wifi_proberesponse(struct Seaper *,
                                              struct NetFrame *,
                                              unsigned char const *,
                                              unsigned int);
void process_wifi_frame(struct Seaper *seap, struct NetFrame *frame,
                        const unsigned char *px, unsigned length) {
  switch (px[0]) {
  case 0x00:
    process_wifi_associate_request(seap, frame, px, length);
    break;
  case 0xa0:
    process_wifi_disassociate_request(seap, frame, px, length);
    break;
  case 0xc0:
    process_wifi_deauthentication(seap, frame, px, length);
    break;
  case 0x10:
    break;
  case 0xD4:
    break;
  case 0x80:
    process_wifi_beacon(seap, frame, px, length);
    break;
  case 0x40:
    process_wifi_probe(seap, frame, px, length);
    break;
  case 0x50:
    process_wifi_proberesponse(seap, frame, px, length);
    break;
  case 0x08:
    if (px[1] & 0x40)
      break;
    process_wifi_data(seap, frame, px, length);
    break;
  case 0x88:
    if (px[1] & 0x40)
      break;
    process_wifi_data(seap, frame, px, length);
    break;
  case 0x48:
    break;
  case 0xb0:
    break;
  case 0xb4:
    break;
  case 0xC4:
    break;
  case 0x30:
    break;
  case 0xc8:
    break;
  case 0xa4:
    break;
  case 0x20:
    break;
  default:
    FRAMERR(frame, "unknown wifi packet [0x%02x]\n", px[0]);
  }
}


x86 assembly (clang, -O0):
<process_wifi_frame>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x20(%rbp)
test   %eax,%eax
je     12e3 <process_wifi_frame+0x163>
jmp    11ae <process_wifi_frame+0x2e>
mov    -0x20(%rbp),%eax
sub    $0x8,%eax
je     1383 <process_wifi_frame+0x203>
jmp    11bf <process_wifi_frame+0x3f>
mov    -0x20(%rbp),%eax
sub    $0x10,%eax
je     132e <process_wifi_frame+0x1ae>
jmp    11d0 <process_wifi_frame+0x50>
mov    -0x20(%rbp),%eax
sub    $0x20,%eax
je     140a <process_wifi_frame+0x28a>
jmp    11e1 <process_wifi_frame+0x61>
mov    -0x20(%rbp),%eax
sub    $0x30,%eax
je     13fb <process_wifi_frame+0x27b>
jmp    11f2 <process_wifi_frame+0x72>
mov    -0x20(%rbp),%eax
sub    $0x40,%eax
je     1351 <process_wifi_frame+0x1d1>
jmp    1203 <process_wifi_frame+0x83>
mov    -0x20(%rbp),%eax
sub    $0x48,%eax
je     13e7 <process_wifi_frame+0x267>
jmp    1214 <process_wifi_frame+0x94>
mov    -0x20(%rbp),%eax
sub    $0x50,%eax
je     136a <process_wifi_frame+0x1ea>
jmp    1225 <process_wifi_frame+0xa5>
mov    -0x20(%rbp),%eax
sub    $0x80,%eax
je     1338 <process_wifi_frame+0x1b8>
jmp    1238 <process_wifi_frame+0xb8>
mov    -0x20(%rbp),%eax
sub    $0x88,%eax
je     13b5 <process_wifi_frame+0x235>
jmp    124b <process_wifi_frame+0xcb>
mov    -0x20(%rbp),%eax
sub    $0xa0,%eax
je     12fc <process_wifi_frame+0x17c>
jmp    125e <process_wifi_frame+0xde>
mov    -0x20(%rbp),%eax
sub    $0xa4,%eax
je     1405 <process_wifi_frame+0x285>
jmp    1271 <process_wifi_frame+0xf1>
mov    -0x20(%rbp),%eax
sub    $0xb0,%eax
je     13ec <process_wifi_frame+0x26c>
jmp    1284 <process_wifi_frame+0x104>
mov    -0x20(%rbp),%eax
sub    $0xb4,%eax
je     13f1 <process_wifi_frame+0x271>
jmp    1297 <process_wifi_frame+0x117>
mov    -0x20(%rbp),%eax
sub    $0xc0,%eax
je     1315 <process_wifi_frame+0x195>
jmp    12aa <process_wifi_frame+0x12a>
mov    -0x20(%rbp),%eax
sub    $0xc4,%eax
je     13f6 <process_wifi_frame+0x276>
jmp    12bd <process_wifi_frame+0x13d>
mov    -0x20(%rbp),%eax
sub    $0xc8,%eax
je     1400 <process_wifi_frame+0x280>
jmp    12d0 <process_wifi_frame+0x150>
mov    -0x20(%rbp),%eax
sub    $0xd4,%eax
je     1333 <process_wifi_frame+0x1b3>
jmp    140f <process_wifi_frame+0x28f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1090 <process_wifi_associate_request@plt>
jmp    1426 <process_wifi_frame+0x2a6>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <process_wifi_disassociate_request@plt>
jmp    1426 <process_wifi_frame+0x2a6>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1060 <process_wifi_deauthentication@plt>
jmp    1426 <process_wifi_frame+0x2a6>
jmp    1426 <process_wifi_frame+0x2a6>
jmp    1426 <process_wifi_frame+0x2a6>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1050 <process_wifi_beacon@plt>
jmp    1426 <process_wifi_frame+0x2a6>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1070 <process_wifi_probe@plt>
jmp    1426 <process_wifi_frame+0x2a6>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1040 <process_wifi_proberesponse@plt>
jmp    1426 <process_wifi_frame+0x2a6>
mov    -0x18(%rbp),%rax
movzbl 0x1(%rax),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     139c <process_wifi_frame+0x21c>
jmp    1426 <process_wifi_frame+0x2a6>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   10a0 <process_wifi_data@plt>
jmp    1426 <process_wifi_frame+0x2a6>
mov    -0x18(%rbp),%rax
movzbl 0x1(%rax),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     13ce <process_wifi_frame+0x24e>
jmp    1426 <process_wifi_frame+0x2a6>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   10a0 <process_wifi_data@plt>
jmp    1426 <process_wifi_frame+0x2a6>
jmp    1426 <process_wifi_frame+0x2a6>
jmp    1426 <process_wifi_frame+0x2a6>
jmp    1426 <process_wifi_frame+0x2a6>
jmp    1426 <process_wifi_frame+0x2a6>
jmp    1426 <process_wifi_frame+0x2a6>
jmp    1426 <process_wifi_frame+0x2a6>
jmp    1426 <process_wifi_frame+0x2a6>
jmp    1426 <process_wifi_frame+0x2a6>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
lea    0xbe2(%rip),%rsi
movzbl (%rax),%edx
call   1080 <FRAMERR@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_wifi_frame>:
mov    (%rdx),%r8b
lea    -0x80(%r8),%eax
cmp    $0x54,%al
ja     11a3 <process_wifi_frame+0x23>
movzbl %al,%eax
lea    0xe6b(%rip),%r9
movslq (%r9,%rax,4),%rax
add    %r9,%rax
jmp    *%rax
jmp    1050 <process_wifi_beacon@plt>
cmp    $0x20,%r8b
jbe    11c9 <process_wifi_frame+0x49>
lea    -0x30(%r8),%eax
cmp    $0x20,%al
ja     1203 <process_wifi_frame+0x83>
movzbl %al,%eax
lea    0x101d(%rip),%r9
movslq (%r9,%rax,4),%rax
add    %r9,%rax
jmp    *%rax
jmp    1070 <process_wifi_probe@plt>
movzbl %r8b,%eax
lea    0xf80(%rip),%r9
movslq (%r9,%rax,4),%rax
add    %r9,%rax
jmp    *%rax
jmp    1090 <process_wifi_associate_request@plt>
testb  $0x40,0x1(%rdx)
jne    11f8 <process_wifi_frame+0x78>
jmp    10a0 <process_wifi_data@plt>
testb  $0x40,0x1(%rdx)
jne    11f8 <process_wifi_frame+0x78>
jmp    10a0 <process_wifi_data@plt>
ret
jmp    1030 <process_wifi_disassociate_request@plt>
jmp    1060 <process_wifi_deauthentication@plt>
movzbl %r8b,%edx
lea    0x104e(%rip),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1080 <FRAMERR@plt>
jmp    1040 <process_wifi_proberesponse@plt>

LLVM IR (-O0):
%struct.Seaper = type { i32 }
%struct.NetFrame = type { i32 }
@.str = [30 x i8] c"unknown wifi packet [0x%02x]\0A\00"
define void @process_wifi_frame(%struct.Seaper* %0, %struct.NetFrame* %1, i8* %2, i32 %3) {
%5 = alloca %struct.Seaper*
%6 = alloca %struct.NetFrame*
%7 = alloca i8*
%8 = alloca i32
store %struct.Seaper* %0, %struct.Seaper** %5
store %struct.NetFrame* %1, %struct.NetFrame** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %7
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
switch i32 %12, label %87 [
i32 0, label %13
i32 160, label %19
i32 192, label %25
i32 16, label %31
i32 212, label %32
i32 128, label %33
i32 64, label %39
i32 80, label %45
i32 8, label %51
i32 136, label %65
i32 72, label %79
i32 176, label %80
i32 180, label %81
i32 196, label %82
i32 48, label %83
i32 200, label %84
i32 164, label %85
i32 32, label %86
]
13: ; preds = %4
%14 = load %struct.Seaper*, %struct.Seaper** %5
%15 = load %struct.NetFrame*, %struct.NetFrame** %6
%16 = load i8*, i8** %7
%17 = load i32, i32* %8
%18 = call i32 @process_wifi_associate_request(%struct.Seaper* %14, %struct.NetFrame* %15, i8* %16, i32 %17)
br label %93
19: ; preds = %4
%20 = load %struct.Seaper*, %struct.Seaper** %5
%21 = load %struct.NetFrame*, %struct.NetFrame** %6
%22 = load i8*, i8** %7
%23 = load i32, i32* %8
%24 = call i32 @process_wifi_disassociate_request(%struct.Seaper* %20, %struct.NetFrame* %21, i8* %22, i32 %23)
br label %93
25: ; preds = %4
%26 = load %struct.Seaper*, %struct.Seaper** %5
%27 = load %struct.NetFrame*, %struct.NetFrame** %6
%28 = load i8*, i8** %7
%29 = load i32, i32* %8
%30 = call i32 @process_wifi_deauthentication(%struct.Seaper* %26, %struct.NetFrame* %27, i8* %28, i32 %29)
br label %93
31: ; preds = %4
br label %93
32: ; preds = %4
br label %93
33: ; preds = %4
%34 = load %struct.Seaper*, %struct.Seaper** %5
%35 = load %struct.NetFrame*, %struct.NetFrame** %6
%36 = load i8*, i8** %7
%37 = load i32, i32* %8
%38 = call i32 @process_wifi_beacon(%struct.Seaper* %34, %struct.NetFrame* %35, i8* %36, i32 %37)
br label %93
39: ; preds = %4
%40 = load %struct.Seaper*, %struct.Seaper** %5
%41 = load %struct.NetFrame*, %struct.NetFrame** %6
%42 = load i8*, i8** %7
%43 = load i32, i32* %8
%44 = call i32 @process_wifi_probe(%struct.Seaper* %40, %struct.NetFrame* %41, i8* %42, i32 %43)
br label %93
45: ; preds = %4
%46 = load %struct.Seaper*, %struct.Seaper** %5
%47 = load %struct.NetFrame*, %struct.NetFrame** %6
%48 = load i8*, i8** %7
%49 = load i32, i32* %8
%50 = call i32 @process_wifi_proberesponse(%struct.Seaper* %46, %struct.NetFrame* %47, i8* %48, i32 %49)
br label %93
51: ; preds = %4
%52 = load i8*, i8** %7
%53 = getelementptr inbounds i8, i8* %52, i64 1
%54 = load i8, i8* %53
%55 = zext i8 %54 to i32
%56 = and i32 %55, 64
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %59
58: ; preds = %51
br label %93
59: ; preds = %51
%60 = load %struct.Seaper*, %struct.Seaper** %5
%61 = load %struct.NetFrame*, %struct.NetFrame** %6
%62 = load i8*, i8** %7
%63 = load i32, i32* %8
%64 = call i32 @process_wifi_data(%struct.Seaper* %60, %struct.NetFrame* %61, i8* %62, i32 %63)
br label %93
65: ; preds = %4
%66 = load i8*, i8** %7
%67 = getelementptr inbounds i8, i8* %66, i64 1
%68 = load i8, i8* %67
%69 = zext i8 %68 to i32
%70 = and i32 %69, 64
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %73
72: ; preds = %65
br label %93
73: ; preds = %65
%74 = load %struct.Seaper*, %struct.Seaper** %5
%75 = load %struct.NetFrame*, %struct.NetFrame** %6
%76 = load i8*, i8** %7
%77 = load i32, i32* %8
%78 = call i32 @process_wifi_data(%struct.Seaper* %74, %struct.NetFrame* %75, i8* %76, i32 %77)
br label %93
79: ; preds = %4
br label %93
80: ; preds = %4
br label %93
81: ; preds = %4
br label %93
82: ; preds = %4
br label %93
83: ; preds = %4
br label %93
84: ; preds = %4
br label %93
85: ; preds = %4
br label %93
86: ; preds = %4
br label %93
87: ; preds = %4
%88 = load %struct.NetFrame*, %struct.NetFrame** %6
%89 = load i8*, i8** %7
%90 = getelementptr inbounds i8, i8* %89, i64 0
%91 = load i8, i8* %90
%92 = call i32 @FRAMERR(%struct.NetFrame* %88, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8 zeroext %91)
br label %93
93: ; preds = %87, %86, %85, %84, %83, %82, %81, %80, %79, %73, %72, %59, %58, %45, %39, %33, %32, %31, %25, %19, %13
ret void
}

LLVM IR (-O2):
%struct.Seaper = type { i32 }
%struct.NetFrame = type { i32 }
@.str = [30 x i8] c"unknown wifi packet [0x%02x]\0A\00"
define void @process_wifi_frame(%struct.Seaper* %0, %struct.NetFrame* %1, i8* %2, i32 %3) {
%5 = load i8, i8* %2
switch i8 %5, label %32 [
i8 0, label %6
i8 -96, label %8
i8 -64, label %10
i8 16, label %34
i8 -44, label %34
i8 -128, label %12
i8 64, label %14
i8 80, label %16
i8 8, label %18
i8 -120, label %25
i8 72, label %34
i8 -80, label %34
i8 -76, label %34
i8 -60, label %34
i8 48, label %34
i8 -56, label %34
i8 -92, label %34
i8 32, label %34
]
6: ; preds = %4
%7 = tail call i32 @process_wifi_associate_request(%struct.Seaper* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %34
8: ; preds = %4
%9 = tail call i32 @process_wifi_disassociate_request(%struct.Seaper* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %34
10: ; preds = %4
%11 = tail call i32 @process_wifi_deauthentication(%struct.Seaper* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %34
12: ; preds = %4
%13 = tail call i32 @process_wifi_beacon(%struct.Seaper* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %34
14: ; preds = %4
%15 = tail call i32 @process_wifi_probe(%struct.Seaper* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %34
16: ; preds = %4
%17 = tail call i32 @process_wifi_proberesponse(%struct.Seaper* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %34
18: ; preds = %4
%19 = getelementptr inbounds i8, i8* %2, i64 1
%20 = load i8, i8* %19
%21 = and i8 %20, 64
%22 = icmp eq i8 %21, 0
br i1 %22, label %23, label %34
23: ; preds = %18
%24 = tail call i32 @process_wifi_data(%struct.Seaper* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %34
25: ; preds = %4
%26 = getelementptr inbounds i8, i8* %2, i64 1
%27 = load i8, i8* %26
%28 = and i8 %27, 64
%29 = icmp eq i8 %28, 0
br i1 %29, label %30, label %34
30: ; preds = %25
%31 = tail call i32 @process_wifi_data(%struct.Seaper* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %34
32: ; preds = %4
%33 = tail call i32 @FRAMERR(%struct.NetFrame* %1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8 zeroext %5)
br label %34
34: ; preds = %25, %18, %32, %4, %4, %4, %4, %4, %4, %4, %4, %4, %4, %30, %23, %16, %14, %12, %10, %8, %6
ret void
}