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

/* Variables and functions */
int /*<<< orphan*/ FRAMERR(struct NetFrame *, char *, unsigned char const);
int /*<<< orphan*/ squirrel_get_mac_address(struct NetFrame *,
                                            unsigned char const *,
                                            unsigned int);
int /*<<< orphan*/ squirrel_wifi_associate_request(struct Squirrel *,
                                                   struct NetFrame *,
                                                   unsigned char const *,
                                                   unsigned int);
int /*<<< orphan*/ squirrel_wifi_associate_response(struct Squirrel *,
                                                    struct NetFrame *,
                                                    unsigned char const *,
                                                    unsigned int);
int /*<<< orphan*/ squirrel_wifi_authentication(struct Squirrel *,
                                                struct NetFrame *,
                                                unsigned char const *,
                                                unsigned int);
int /*<<< orphan*/ squirrel_wifi_beacon(struct Squirrel *, struct NetFrame *,
                                        unsigned char const *, unsigned int);
int /*<<< orphan*/ squirrel_wifi_ctrl_frame(struct Squirrel *,
                                            struct NetFrame *,
                                            unsigned char const *,
                                            unsigned int);
int /*<<< orphan*/ squirrel_wifi_ctrl_power_save_poll(struct Squirrel *,
                                                      struct NetFrame *,
                                                      unsigned char const *,
                                                      unsigned int);
int /*<<< orphan*/ squirrel_wifi_data(struct Squirrel *, struct NetFrame *,
                                      unsigned char const *, unsigned int);
int /*<<< orphan*/ squirrel_wifi_deauthentication(struct Squirrel *,
                                                  struct NetFrame *,
                                                  unsigned char const *,
                                                  unsigned int);
int /*<<< orphan*/ squirrel_wifi_disassociate(struct Squirrel *,
                                              struct NetFrame *,
                                              unsigned char const *,
                                              unsigned int);
int /*<<< orphan*/ squirrel_wifi_mgmt_action(struct Squirrel *,
                                             struct NetFrame *,
                                             unsigned char const *,
                                             unsigned int);
int /*<<< orphan*/ squirrel_wifi_proberequest(struct Squirrel *,
                                              struct NetFrame *,
                                              unsigned char const *,
                                              unsigned int);
void squirrel_wifi_frame(struct Squirrel *squirrel, struct NetFrame *frame,
                         const unsigned char *px, unsigned length) {
  unsigned version, type, subtype;
  version = px[0] & 3;
  type = (px[0] >> 2) & 3;
  subtype = (px[0] >> 4) & 0xf;
  if (version != 0) {
    FRAMERR(frame, "wifi packet corrupted, version=%d\n", version);
    return;
  }
  squirrel_get_mac_address(frame, px, length);
  switch (((type) << 2) | ((subtype) << 4)) {
  case ((0) << 2) | ((0x0) << 4):
    squirrel_wifi_associate_request(squirrel, frame, px, length);
    break;
  case ((0) << 2) | ((0x1) << 4):
    squirrel_wifi_associate_response(squirrel, frame, px, length);
    break;
  case ((0) << 2) | ((0x2) << 4):
    squirrel_wifi_associate_request(squirrel, frame, px, length);
    break;
  case ((0) << 2) | ((0x3) << 4):
    squirrel_wifi_associate_response(squirrel, frame, px, length);
    break;
  case ((0) << 2) | ((0x4) << 4):
    squirrel_wifi_proberequest(squirrel, frame, px, length);
    break;
  case ((0) << 2) | ((0x5) << 4):
    squirrel_wifi_beacon(squirrel, frame, px, length);
    break;
  case ((0) << 2) | ((0x8) << 4):
    squirrel_wifi_beacon(squirrel, frame, px, length);
    break;
  case ((0) << 2) | ((0xD) << 4):
  case ((0) << 2) | ((0xe) << 4):
    squirrel_wifi_mgmt_action(squirrel, frame, px, length);
    break;
  case ((0) << 2) | ((0x9) << 4):
    FRAMERR(frame, "unknown wifi packet [0x%02x]\n", px[0]);
    break;
  case ((0) << 2) | ((0xa) << 4):
    squirrel_wifi_disassociate(squirrel, frame, px, length);
    break;
  case ((0) << 2) | ((0xb) << 4):
    squirrel_wifi_authentication(squirrel, frame, px, length);
    break;
  case ((0) << 2) | ((0xc) << 4):
    squirrel_wifi_deauthentication(squirrel, frame, px, length);
    break;
  case ((0) << 2) | ((0xf) << 4):
    break;
  case ((2) << 2) | ((0x0) << 4):
  case ((2) << 2) | ((0x4) << 4):
  case ((2) << 2) | ((0x8) << 4):
  case ((2) << 2) | ((0xc) << 4):
    squirrel_wifi_data(squirrel, frame, px, length);
    break;
  case ((1) << 2) | ((0x05) << 4):
    break;
  case ((1) << 2) | ((0x4) << 4):
    break;
  case ((1) << 2) | ((0xa) << 4):
    squirrel_wifi_ctrl_power_save_poll(squirrel, frame, px, length);
    break;
  case ((1) << 2) | ((0xb) << 4):
    squirrel_wifi_ctrl_frame(squirrel, frame, px, length);
    break;
  case ((1) << 2) | ((0xE) << 4):
    squirrel_wifi_ctrl_frame(squirrel, frame, px, length);
    break;
  case ((1) << 2) | ((0x8) << 4):
  case ((1) << 2) | ((0x9) << 4):
    squirrel_wifi_ctrl_frame(squirrel, frame, px, length);
    break;
  case ((1) << 2) | ((0xC) << 4):
  case ((1) << 2) | ((0xD) << 4):
    break;
  default:
    FRAMERR(frame, "unknown wifi packet [0x%02x]\n", px[0]);
  }
}


x86 assembly (clang, -O0):
<squirrel_wifi_frame>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
and    $0x3,%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
sar    $0x2,%eax
and    $0x3,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
sar    $0x4,%eax
and    $0xf,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1239 <squirrel_wifi_frame+0x69>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%eax
lea    0x1198(%rip),%rsi
movzbl %al,%edx
call   10c0 <FRAMERR@plt>
jmp    1453 <squirrel_wifi_frame+0x283>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1050 <squirrel_get_mac_address@plt>
mov    -0x24(%rbp),%eax
shl    $0x2,%eax
mov    -0x28(%rbp),%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0xf0,%eax
ja     143c <squirrel_wifi_frame+0x26c>
mov    -0x30(%rbp),%rax
lea    0xd8d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1090 <squirrel_wifi_associate_request@plt>
jmp    1453 <squirrel_wifi_frame+0x283>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   10d0 <squirrel_wifi_associate_response@plt>
jmp    1453 <squirrel_wifi_frame+0x283>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1090 <squirrel_wifi_associate_request@plt>
jmp    1453 <squirrel_wifi_frame+0x283>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   10d0 <squirrel_wifi_associate_response@plt>
jmp    1453 <squirrel_wifi_frame+0x283>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   10a0 <squirrel_wifi_proberequest@plt>
jmp    1453 <squirrel_wifi_frame+0x283>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   10f0 <squirrel_wifi_beacon@plt>
jmp    1453 <squirrel_wifi_frame+0x283>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   10f0 <squirrel_wifi_beacon@plt>
jmp    1453 <squirrel_wifi_frame+0x283>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   10b0 <squirrel_wifi_mgmt_action@plt>
jmp    1453 <squirrel_wifi_frame+0x283>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
lea    0x1094(%rip),%rsi
movzbl (%rax),%edx
call   10c0 <FRAMERR@plt>
jmp    1453 <squirrel_wifi_frame+0x283>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1040 <squirrel_wifi_disassociate@plt>
jmp    1453 <squirrel_wifi_frame+0x283>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   10e0 <squirrel_wifi_authentication@plt>
jmp    1453 <squirrel_wifi_frame+0x283>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <squirrel_wifi_deauthentication@plt>
jmp    1453 <squirrel_wifi_frame+0x283>
jmp    1453 <squirrel_wifi_frame+0x283>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1070 <squirrel_wifi_data@plt>
jmp    1453 <squirrel_wifi_frame+0x283>
jmp    1453 <squirrel_wifi_frame+0x283>
jmp    1453 <squirrel_wifi_frame+0x283>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1060 <squirrel_wifi_ctrl_power_save_poll@plt>
jmp    1453 <squirrel_wifi_frame+0x283>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1080 <squirrel_wifi_ctrl_frame@plt>
jmp    1453 <squirrel_wifi_frame+0x283>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1080 <squirrel_wifi_ctrl_frame@plt>
jmp    1453 <squirrel_wifi_frame+0x283>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1080 <squirrel_wifi_ctrl_frame@plt>
jmp    1453 <squirrel_wifi_frame+0x283>
jmp    1453 <squirrel_wifi_frame+0x283>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
lea    0xf9c(%rip),%rsi
movzbl (%rax),%edx
call   10c0 <FRAMERR@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<squirrel_wifi_frame>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r12
movzbl (%rdx),%ebp
mov    %ebp,%eax
and    $0x3,%eax
je     11ff <squirrel_wifi_frame+0x2f>
movzbl %al,%edx
lea    0xf05(%rip),%rsi
mov    %r12,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    10c0 <FRAMERR@plt>
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %rdi,%r15
mov    %r12,%rdi
mov    %rdx,%rsi
mov    %ecx,%edx
call   1050 <squirrel_get_mac_address@plt>
shr    $0x2,%ebp
cmp    $0x3c,%ebp
ja     12b7 <squirrel_wifi_frame+0xe7>
lea    0xdd8(%rip),%rax
movslq (%rax,%rbp,4),%rcx
add    %rax,%rcx
jmp    *%rcx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <squirrel_wifi_data@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <squirrel_wifi_ctrl_frame@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1090 <squirrel_wifi_associate_request@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    10d0 <squirrel_wifi_associate_response@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    10f0 <squirrel_wifi_beacon@plt>
movzbl (%rbx),%edx
lea    0xe56(%rip),%rsi
jmp    11ef <squirrel_wifi_frame+0x1f>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    10b0 <squirrel_wifi_mgmt_action@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    10a0 <squirrel_wifi_proberequest@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <squirrel_wifi_disassociate@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <squirrel_wifi_ctrl_power_save_poll@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    10e0 <squirrel_wifi_authentication@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <squirrel_wifi_deauthentication@plt>

LLVM IR (-O0):
%struct.Squirrel = type { i32 }
%struct.NetFrame = type { i32 }
@.str = [35 x i8] c"wifi packet corrupted, version=%d\0A\00"
@.str.1 = [30 x i8] c"unknown wifi packet [0x%02x]\0A\00"
define void @squirrel_wifi_frame(%struct.Squirrel* %0, %struct.NetFrame* %1, i8* %2, i32 %3) {
%5 = alloca %struct.Squirrel*
%6 = alloca %struct.NetFrame*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store %struct.Squirrel* %0, %struct.Squirrel** %5
store %struct.NetFrame* %1, %struct.NetFrame** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%12 = load i8*, i8** %7
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = and i32 %15, 3
store i32 %16, i32* %9
%17 = load i8*, i8** %7
%18 = getelementptr inbounds i8, i8* %17, i64 0
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = ashr i32 %20, 2
%22 = and i32 %21, 3
store i32 %22, i32* %10
%23 = load i8*, i8** %7
%24 = getelementptr inbounds i8, i8* %23, i64 0
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = ashr i32 %26, 4
%28 = and i32 %27, 15
store i32 %28, i32* %11
%29 = load i32, i32* %9
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %4
%32 = load %struct.NetFrame*, %struct.NetFrame** %6
%33 = load i32, i32* %9
%34 = trunc i32 %33 to i8
%35 = call i32 @FRAMERR(%struct.NetFrame* %32, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8 zeroext %34)
br label %158
36: ; preds = %4
%37 = load %struct.NetFrame*, %struct.NetFrame** %6
%38 = load i8*, i8** %7
%39 = load i32, i32* %8
%40 = call i32 @squirrel_get_mac_address(%struct.NetFrame* %37, i8* %38, i32 %39)
%41 = load i32, i32* %10
%42 = shl i32 %41, 2
%43 = load i32, i32* %11
%44 = shl i32 %43, 4
%45 = or i32 %42, %44
switch i32 %45, label %152 [
i32 0, label %46
i32 16, label %52
i32 32, label %58
i32 48, label %64
i32 64, label %70
i32 80, label %76
i32 128, label %82
i32 208, label %88
i32 224, label %88
i32 144, label %94
i32 160, label %100
i32 176, label %106
i32 192, label %112
i32 240, label %118
i32 8, label %119
i32 72, label %119
i32 136, label %119
i32 200, label %119
i32 84, label %125
i32 68, label %126
i32 164, label %127
i32 180, label %133
i32 228, label %139
i32 132, label %145
i32 148, label %145
i32 196, label %151
i32 212, label %151
]
46: ; preds = %36
%47 = load %struct.Squirrel*, %struct.Squirrel** %5
%48 = load %struct.NetFrame*, %struct.NetFrame** %6
%49 = load i8*, i8** %7
%50 = load i32, i32* %8
%51 = call i32 @squirrel_wifi_associate_request(%struct.Squirrel* %47, %struct.NetFrame* %48, i8* %49, i32 %50)
br label %158
52: ; preds = %36
%53 = load %struct.Squirrel*, %struct.Squirrel** %5
%54 = load %struct.NetFrame*, %struct.NetFrame** %6
%55 = load i8*, i8** %7
%56 = load i32, i32* %8
%57 = call i32 @squirrel_wifi_associate_response(%struct.Squirrel* %53, %struct.NetFrame* %54, i8* %55, i32 %56)
br label %158
58: ; preds = %36
%59 = load %struct.Squirrel*, %struct.Squirrel** %5
%60 = load %struct.NetFrame*, %struct.NetFrame** %6
%61 = load i8*, i8** %7
%62 = load i32, i32* %8
%63 = call i32 @squirrel_wifi_associate_request(%struct.Squirrel* %59, %struct.NetFrame* %60, i8* %61, i32 %62)
br label %158
64: ; preds = %36
%65 = load %struct.Squirrel*, %struct.Squirrel** %5
%66 = load %struct.NetFrame*, %struct.NetFrame** %6
%67 = load i8*, i8** %7
%68 = load i32, i32* %8
%69 = call i32 @squirrel_wifi_associate_response(%struct.Squirrel* %65, %struct.NetFrame* %66, i8* %67, i32 %68)
br label %158
70: ; preds = %36
%71 = load %struct.Squirrel*, %struct.Squirrel** %5
%72 = load %struct.NetFrame*, %struct.NetFrame** %6
%73 = load i8*, i8** %7
%74 = load i32, i32* %8
%75 = call i32 @squirrel_wifi_proberequest(%struct.Squirrel* %71, %struct.NetFrame* %72, i8* %73, i32 %74)
br label %158
76: ; preds = %36
%77 = load %struct.Squirrel*, %struct.Squirrel** %5
%78 = load %struct.NetFrame*, %struct.NetFrame** %6
%79 = load i8*, i8** %7
%80 = load i32, i32* %8
%81 = call i32 @squirrel_wifi_beacon(%struct.Squirrel* %77, %struct.NetFrame* %78, i8* %79, i32 %80)
br label %158
82: ; preds = %36
%83 = load %struct.Squirrel*, %struct.Squirrel** %5
%84 = load %struct.NetFrame*, %struct.NetFrame** %6
%85 = load i8*, i8** %7
%86 = load i32, i32* %8
%87 = call i32 @squirrel_wifi_beacon(%struct.Squirrel* %83, %struct.NetFrame* %84, i8* %85, i32 %86)
br label %158
88: ; preds = %36, %36
%89 = load %struct.Squirrel*, %struct.Squirrel** %5
%90 = load %struct.NetFrame*, %struct.NetFrame** %6
%91 = load i8*, i8** %7
%92 = load i32, i32* %8
%93 = call i32 @squirrel_wifi_mgmt_action(%struct.Squirrel* %89, %struct.NetFrame* %90, i8* %91, i32 %92)
br label %158
94: ; preds = %36
%95 = load %struct.NetFrame*, %struct.NetFrame** %6
%96 = load i8*, i8** %7
%97 = getelementptr inbounds i8, i8* %96, i64 0
%98 = load i8, i8* %97
%99 = call i32 @FRAMERR(%struct.NetFrame* %95, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %98)
br label %158
100: ; preds = %36
%101 = load %struct.Squirrel*, %struct.Squirrel** %5
%102 = load %struct.NetFrame*, %struct.NetFrame** %6
%103 = load i8*, i8** %7
%104 = load i32, i32* %8
%105 = call i32 @squirrel_wifi_disassociate(%struct.Squirrel* %101, %struct.NetFrame* %102, i8* %103, i32 %104)
br label %158
106: ; preds = %36
%107 = load %struct.Squirrel*, %struct.Squirrel** %5
%108 = load %struct.NetFrame*, %struct.NetFrame** %6
%109 = load i8*, i8** %7
%110 = load i32, i32* %8
%111 = call i32 @squirrel_wifi_authentication(%struct.Squirrel* %107, %struct.NetFrame* %108, i8* %109, i32 %110)
br label %158
112: ; preds = %36
%113 = load %struct.Squirrel*, %struct.Squirrel** %5
%114 = load %struct.NetFrame*, %struct.NetFrame** %6
%115 = load i8*, i8** %7
%116 = load i32, i32* %8
%117 = call i32 @squirrel_wifi_deauthentication(%struct.Squirrel* %113, %struct.NetFrame* %114, i8* %115, i32 %116)
br label %158
118: ; preds = %36
br label %158
119: ; preds = %36, %36, %36, %36
%120 = load %struct.Squirrel*, %struct.Squirrel** %5
%121 = load %struct.NetFrame*, %struct.NetFrame** %6
%122 = load i8*, i8** %7
%123 = load i32, i32* %8
%124 = call i32 @squirrel_wifi_data(%struct.Squirrel* %120, %struct.NetFrame* %121, i8* %122, i32 %123)
br label %158
125: ; preds = %36
br label %158
126: ; preds = %36
br label %158
127: ; preds = %36
%128 = load %struct.Squirrel*, %struct.Squirrel** %5
%129 = load %struct.NetFrame*, %struct.NetFrame** %6
%130 = load i8*, i8** %7
%131 = load i32, i32* %8
%132 = call i32 @squirrel_wifi_ctrl_power_save_poll(%struct.Squirrel* %128, %struct.NetFrame* %129, i8* %130, i32 %131)
br label %158
133: ; preds = %36
%134 = load %struct.Squirrel*, %struct.Squirrel** %5
%135 = load %struct.NetFrame*, %struct.NetFrame** %6
%136 = load i8*, i8** %7
%137 = load i32, i32* %8
%138 = call i32 @squirrel_wifi_ctrl_frame(%struct.Squirrel* %134, %struct.NetFrame* %135, i8* %136, i32 %137)
br label %158
139: ; preds = %36
%140 = load %struct.Squirrel*, %struct.Squirrel** %5
%141 = load %struct.NetFrame*, %struct.NetFrame** %6
%142 = load i8*, i8** %7
%143 = load i32, i32* %8
%144 = call i32 @squirrel_wifi_ctrl_frame(%struct.Squirrel* %140, %struct.NetFrame* %141, i8* %142, i32 %143)
br label %158
145: ; preds = %36, %36
%146 = load %struct.Squirrel*, %struct.Squirrel** %5
%147 = load %struct.NetFrame*, %struct.NetFrame** %6
%148 = load i8*, i8** %7
%149 = load i32, i32* %8
%150 = call i32 @squirrel_wifi_ctrl_frame(%struct.Squirrel* %146, %struct.NetFrame* %147, i8* %148, i32 %149)
br label %158
151: ; preds = %36, %36
br label %158
152: ; preds = %36
%153 = load %struct.NetFrame*, %struct.NetFrame** %6
%154 = load i8*, i8** %7
%155 = getelementptr inbounds i8, i8* %154, i64 0
%156 = load i8, i8* %155
%157 = call i32 @FRAMERR(%struct.NetFrame* %153, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %156)
br label %158
158: ; preds = %31, %152, %151, %145, %139, %133, %127, %126, %125, %119, %118, %112, %106, %100, %94, %88, %82, %76, %70, %64, %58, %52, %46
ret void
}

LLVM IR (-O2):
%struct.Squirrel = type { i32 }
%struct.NetFrame = type { i32 }
@.str = [35 x i8] c"wifi packet corrupted, version=%d\0A\00"
@.str.1 = [30 x i8] c"unknown wifi packet [0x%02x]\0A\00"
define void @squirrel_wifi_frame(%struct.Squirrel* %0, %struct.NetFrame* %1, i8* %2, i32 %3) {
%5 = load i8, i8* %2
%6 = zext i8 %5 to i32
%7 = and i32 %6, 3
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = trunc i32 %7 to i8
%11 = tail call i32 @FRAMERR(%struct.NetFrame* %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8 zeroext %10)
br label %53
12: ; preds = %4
%13 = tail call i32 @squirrel_get_mac_address(%struct.NetFrame* %1, i8* %2, i32 %3)
%14 = lshr i32 %6, 2
switch i32 %14, label %50 [
i32 0, label %15
i32 4, label %17
i32 8, label %19
i32 12, label %21
i32 16, label %23
i32 20, label %25
i32 32, label %27
i32 52, label %29
i32 56, label %29
i32 36, label %31
i32 40, label %34
i32 44, label %36
i32 48, label %38
i32 60, label %53
i32 2, label %40
i32 18, label %40
i32 34, label %40
i32 50, label %40
i32 21, label %53
i32 17, label %53
i32 41, label %42
i32 45, label %44
i32 57, label %46
i32 33, label %48
i32 37, label %48
i32 49, label %53
i32 53, label %53
]
15: ; preds = %12
%16 = tail call i32 @squirrel_wifi_associate_request(%struct.Squirrel* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %53
17: ; preds = %12
%18 = tail call i32 @squirrel_wifi_associate_response(%struct.Squirrel* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %53
19: ; preds = %12
%20 = tail call i32 @squirrel_wifi_associate_request(%struct.Squirrel* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %53
21: ; preds = %12
%22 = tail call i32 @squirrel_wifi_associate_response(%struct.Squirrel* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %53
23: ; preds = %12
%24 = tail call i32 @squirrel_wifi_proberequest(%struct.Squirrel* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %53
25: ; preds = %12
%26 = tail call i32 @squirrel_wifi_beacon(%struct.Squirrel* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %53
27: ; preds = %12
%28 = tail call i32 @squirrel_wifi_beacon(%struct.Squirrel* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %53
29: ; preds = %12, %12
%30 = tail call i32 @squirrel_wifi_mgmt_action(%struct.Squirrel* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %53
31: ; preds = %12
%32 = load i8, i8* %2
%33 = tail call i32 @FRAMERR(%struct.NetFrame* %1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %32)
br label %53
34: ; preds = %12
%35 = tail call i32 @squirrel_wifi_disassociate(%struct.Squirrel* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %53
36: ; preds = %12
%37 = tail call i32 @squirrel_wifi_authentication(%struct.Squirrel* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %53
38: ; preds = %12
%39 = tail call i32 @squirrel_wifi_deauthentication(%struct.Squirrel* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %53
40: ; preds = %12, %12, %12, %12
%41 = tail call i32 @squirrel_wifi_data(%struct.Squirrel* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %53
42: ; preds = %12
%43 = tail call i32 @squirrel_wifi_ctrl_power_save_poll(%struct.Squirrel* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %53
44: ; preds = %12
%45 = tail call i32 @squirrel_wifi_ctrl_frame(%struct.Squirrel* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %53
46: ; preds = %12
%47 = tail call i32 @squirrel_wifi_ctrl_frame(%struct.Squirrel* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %53
48: ; preds = %12, %12
%49 = tail call i32 @squirrel_wifi_ctrl_frame(%struct.Squirrel* %0, %struct.NetFrame* %1, i8* %2, i32 %3)
br label %53
50: ; preds = %12
%51 = load i8, i8* %2
%52 = tail call i32 @FRAMERR(%struct.NetFrame* %1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %51)
br label %53
53: ; preds = %15, %17, %19, %21, %23, %25, %27, %29, %31, %34, %36, %38, %12, %40, %12, %12, %42, %44, %46, %48, %50, %12, %12, %9
ret void
}