#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 */
int /*<<< orphan*/ FRAMERR(struct NetFrame *, char *, ...);
int /*<<< orphan*/ process_eap_identity(struct Ferret *, struct NetFrame *,
                                        unsigned char const *, unsigned int);
int /*<<< orphan*/ process_leap_challenge_request(struct Ferret *,
                                                  struct NetFrame *,
                                                  unsigned char const *,
                                                  unsigned int, unsigned int);
int /*<<< orphan*/ process_leap_challenge_response(struct Ferret *,
                                                   struct NetFrame *,
                                                   unsigned char const *,
                                                   unsigned int, unsigned int);
int /*<<< orphan*/ process_leap_success_failure(struct Ferret *,
                                                struct NetFrame *, unsigned int,
                                                unsigned int);
void process_eap(struct Ferret *ferret, struct NetFrame *frame,
                 const unsigned char *px, unsigned length) {
  unsigned code;
  unsigned id;
  unsigned remaining;
  unsigned offset = 0;
  unsigned type = 0;
  if (length < 4) {
    FRAMERR(frame, "EAP: truncated\n");
    return;
  }
  code = px[0];
  id = px[1];
  remaining = (*((unsigned char *)(px + 2) + 0) << 8 |
               *((unsigned char *)(px + 2) + 1) << 0);
  if (length < remaining) {
    FRAMERR(frame, "EAP: truncated\n");
  }
  if (length > remaining)
    length = remaining;
  offset += 4;
  if (code == 1 || code == 2) {
    if (length < offset + 1) {
      FRAMERR(frame, "EAP: truncated\n");
    }
    type = px[offset];
    offset++;
  }
  switch (code) {
  case 1:
    switch (type) {
    case 1:
      process_eap_identity(ferret, frame, px + offset, length - offset);
      break;
    case 17:
      process_leap_challenge_request(ferret, frame, px + offset,
                                     length - offset, id);
      break;
    default:
      FRAMERR(frame, "EAP: unknown request %d\n", type);
    }
    break;
  case 2:
    switch (type) {
    case 1:
      process_eap_identity(ferret, frame, px + offset, length - offset);
      break;
    case 17:
      process_leap_challenge_response(ferret, frame, px + offset,
                                      length - offset, id);
      break;
    default:
      FRAMERR(frame, "EAP: unknown request %d\n", px[offset]);
    }
    break;
  case 3:
  case 4:
    process_leap_success_failure(ferret, frame, id, code);
    break;
  default:
    FRAMERR(frame, "EAP: unknown code %d\n", code);
  }
}


x86 assembly (clang, -O0):
<process_eap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jae    1196 <process_eap+0x46>
mov    -0x10(%rbp),%rdi
lea    0xe76(%rip),%rsi
mov    $0x0,%al
call   1060 <FRAMERR@plt>
jmp    13c9 <process_eap+0x279>
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movzbl 0x1(%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
movzbl 0x2(%rax),%eax
shl    $0x8,%eax
mov    -0x18(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
shl    $0x0,%ecx
or     %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jae    11e4 <process_eap+0x94>
mov    -0x10(%rbp),%rdi
lea    0xe23(%rip),%rsi
mov    $0x0,%al
call   1060 <FRAMERR@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jbe    11f6 <process_eap+0xa6>
mov    -0x28(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x1,-0x20(%rbp)
je     1213 <process_eap+0xc3>
cmpl   $0x2,-0x20(%rbp)
jne    124d <process_eap+0xfd>
mov    -0x1c(%rbp),%eax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jae    1236 <process_eap+0xe6>
mov    -0x10(%rbp),%rdi
lea    0xdd1(%rip),%rsi
mov    $0x0,%al
call   1060 <FRAMERR@plt>
mov    -0x18(%rbp),%rax
mov    -0x2c(%rbp),%ecx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x34(%rbp)
sub    $0x1,%eax
je     1286 <process_eap+0x136>
jmp    1261 <process_eap+0x111>
mov    -0x34(%rbp),%eax
sub    $0x2,%eax
je     130d <process_eap+0x1bd>
jmp    1272 <process_eap+0x122>
mov    -0x34(%rbp),%eax
add    $0xfffffffd,%eax
sub    $0x2,%eax
jb     139c <process_eap+0x24c>
jmp    13b4 <process_eap+0x264>
mov    -0x30(%rbp),%eax
mov    %eax,-0x38(%rbp)
sub    $0x1,%eax
je     12ab <process_eap+0x15b>
jmp    129a <process_eap+0x14a>
mov    -0x38(%rbp),%eax
sub    $0x11,%eax
je     12cd <process_eap+0x17d>
jmp    12f3 <process_eap+0x1a3>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x2c(%rbp),%eax
add    %rax,%rdx
mov    -0x1c(%rbp),%ecx
sub    -0x2c(%rbp),%ecx
call   1070 <process_eap_identity@plt>
jmp    1308 <process_eap+0x1b8>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x2c(%rbp),%eax
add    %rax,%rdx
mov    -0x1c(%rbp),%ecx
sub    -0x2c(%rbp),%ecx
mov    -0x24(%rbp),%r8d
call   1050 <process_leap_challenge_request@plt>
jmp    1308 <process_eap+0x1b8>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%edx
lea    0xd0f(%rip),%rsi
mov    $0x0,%al
call   1060 <FRAMERR@plt>
jmp    13c9 <process_eap+0x279>
mov    -0x30(%rbp),%eax
mov    %eax,-0x3c(%rbp)
sub    $0x1,%eax
je     1332 <process_eap+0x1e2>
jmp    1321 <process_eap+0x1d1>
mov    -0x3c(%rbp),%eax
sub    $0x11,%eax
je     1354 <process_eap+0x204>
jmp    137a <process_eap+0x22a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x2c(%rbp),%eax
add    %rax,%rdx
mov    -0x1c(%rbp),%ecx
sub    -0x2c(%rbp),%ecx
call   1070 <process_eap_identity@plt>
jmp    1397 <process_eap+0x247>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x2c(%rbp),%eax
add    %rax,%rdx
mov    -0x1c(%rbp),%ecx
sub    -0x2c(%rbp),%ecx
mov    -0x24(%rbp),%r8d
call   1040 <process_leap_challenge_response@plt>
jmp    1397 <process_eap+0x247>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    -0x2c(%rbp),%ecx
movzbl (%rax,%rcx,1),%edx
lea    0xc80(%rip),%rsi
mov    $0x0,%al
call   1060 <FRAMERR@plt>
jmp    13c9 <process_eap+0x279>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1030 <process_leap_success_failure@plt>
jmp    13c9 <process_eap+0x279>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%edx
lea    0xc67(%rip),%rsi
mov    $0x0,%al
call   1060 <FRAMERR@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_eap>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r9
cmp    $0x3,%ecx
ja     1182 <process_eap+0x32>
lea    0xe96(%rip),%rsi
mov    %r9,%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <FRAMERR@plt>
mov    %ecx,%ebp
mov    %rdx,%r13
movzbl (%rdx),%ebx
movzbl 0x1(%rdx),%r15d
movzwl 0x2(%rdx),%r12d
shl    $0x10,%r12d
bswap  %r12d
cmp    %ecx,%r12d
jbe    11bf <process_eap+0x6f>
lea    0xe59(%rip),%rsi
mov    %rdi,(%rsp)
mov    %r9,%rdi
xor    %eax,%eax
mov    %r9,%r14
call   1060 <FRAMERR@plt>
mov    %r14,%r9
mov    (%rsp),%rdi
cmp    %ebp,%r12d
cmovb  %r12d,%ebp
lea    -0x1(%rbx),%eax
cmp    $0x1,%al
ja     11fb <process_eap+0xab>
cmp    $0x4,%ebp
ja     11ef <process_eap+0x9f>
lea    0xe27(%rip),%rsi
mov    %rdi,%r14
mov    %r9,%rdi
xor    %eax,%eax
mov    %r9,%r12
call   1060 <FRAMERR@plt>
mov    %r12,%r9
mov    %r14,%rdi
movzbl 0x4(%r13),%edx
mov    $0x5,%eax
jmp    1202 <process_eap+0xb2>
xor    %edx,%edx
mov    $0x4,%eax
lea    -0x3(%rbx),%ecx
cmp    $0x2,%cl
jb     1223 <process_eap+0xd3>
cmp    $0x2,%bl
je     123e <process_eap+0xee>
cmp    $0x1,%bl
jne    126a <process_eap+0x11a>
cmp    $0x11,%dl
je     1278 <process_eap+0x128>
cmp    $0x1,%dl
je     1248 <process_eap+0xf8>
jmp    12ca <process_eap+0x17a>
mov    %r9,%rsi
mov    %r15d,%edx
mov    %ebx,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <process_leap_success_failure@plt>
cmp    $0x11,%dl
je     129d <process_eap+0x14d>
cmp    $0x1,%dl
jne    12c2 <process_eap+0x172>
mov    %eax,%ecx
add    %rcx,%r13
sub    %eax,%ebp
mov    %r9,%rsi
mov    %r13,%rdx
mov    %ebp,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <process_eap_identity@plt>
lea    0xdb8(%rip),%rsi
mov    %r9,%rdi
mov    %ebx,%edx
jmp    12d4 <process_eap+0x184>
mov    %eax,%ecx
add    %rcx,%r13
sub    %eax,%ebp
mov    %r9,%rsi
mov    %r13,%rdx
mov    %ebp,%ecx
mov    %r15d,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <process_leap_challenge_request@plt>
mov    %eax,%ecx
add    %rcx,%r13
sub    %eax,%ebp
mov    %r9,%rsi
mov    %r13,%rdx
mov    %ebp,%ecx
mov    %r15d,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <process_leap_challenge_response@plt>
mov    %eax,%eax
movzbl 0x0(%r13,%rax,1),%edx
lea    0xd3f(%rip),%rsi
mov    %r9,%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <FRAMERR@plt>

LLVM IR (-O0):
%struct.Ferret = type { i32 }
%struct.NetFrame = type { i32 }
@.str = [16 x i8] c"EAP: truncated\0A\00"
@.str.1 = [25 x i8] c"EAP: unknown request %d\0A\00"
@.str.2 = [22 x i8] c"EAP: unknown code %d\0A\00"
define void @process_eap(%struct.Ferret* %0, %struct.NetFrame* %1, i8* %2, i32 %3) {
%5 = alloca %struct.Ferret*
%6 = alloca %struct.NetFrame*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store %struct.Ferret* %0, %struct.Ferret** %5
store %struct.NetFrame* %1, %struct.NetFrame** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
store i32 0, i32* %12
store i32 0, i32* %13
%14 = load i32, i32* %8
%15 = icmp ult i32 %14, 4
br i1 %15, label %16, label %19
16: ; preds = %4
%17 = load %struct.NetFrame*, %struct.NetFrame** %6
%18 = call i32 (%struct.NetFrame*, i8*, ...) @FRAMERR(%struct.NetFrame* %17, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %155
19: ; preds = %4
%20 = load i8*, i8** %7
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
store i32 %23, i32* %9
%24 = load i8*, i8** %7
%25 = getelementptr inbounds i8, i8* %24, i64 1
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
store i32 %27, i32* %10
%28 = load i8*, i8** %7
%29 = getelementptr inbounds i8, i8* %28, i64 2
%30 = getelementptr inbounds i8, i8* %29, i64 0
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
%33 = shl i32 %32, 8
%34 = load i8*, i8** %7
%35 = getelementptr inbounds i8, i8* %34, i64 2
%36 = getelementptr inbounds i8, i8* %35, i64 1
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = shl i32 %38, 0
%40 = or i32 %33, %39
store i32 %40, i32* %11
%41 = load i32, i32* %8
%42 = load i32, i32* %11
%43 = icmp ult i32 %41, %42
br i1 %43, label %44, label %47
44: ; preds = %19
%45 = load %struct.NetFrame*, %struct.NetFrame** %6
%46 = call i32 (%struct.NetFrame*, i8*, ...) @FRAMERR(%struct.NetFrame* %45, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %47
47: ; preds = %44, %19
%48 = load i32, i32* %8
%49 = load i32, i32* %11
%50 = icmp ugt i32 %48, %49
br i1 %50, label %51, label %53
51: ; preds = %47
%52 = load i32, i32* %11
store i32 %52, i32* %8
br label %53
53: ; preds = %51, %47
%54 = load i32, i32* %12
%55 = add i32 %54, 4
store i32 %55, i32* %12
%56 = load i32, i32* %9
%57 = icmp eq i32 %56, 1
br i1 %57, label %61, label %58
58: ; preds = %53
%59 = load i32, i32* %9
%60 = icmp eq i32 %59, 2
br i1 %60, label %61, label %78
61: ; preds = %58, %53
%62 = load i32, i32* %8
%63 = load i32, i32* %12
%64 = add i32 %63, 1
%65 = icmp ult i32 %62, %64
br i1 %65, label %66, label %69
66: ; preds = %61
%67 = load %struct.NetFrame*, %struct.NetFrame** %6
%68 = call i32 (%struct.NetFrame*, i8*, ...) @FRAMERR(%struct.NetFrame* %67, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %69
69: ; preds = %66, %61
%70 = load i8*, i8** %7
%71 = load i32, i32* %12
%72 = zext i32 %71 to i64
%73 = getelementptr inbounds i8, i8* %70, i64 %72
%74 = load i8, i8* %73
%75 = zext i8 %74 to i32
store i32 %75, i32* %13
%76 = load i32, i32* %12
%77 = add i32 %76, 1
store i32 %77, i32* %12
br label %78
78: ; preds = %69, %58
%79 = load i32, i32* %9
switch i32 %79, label %151 [
i32 1, label %80
i32 2, label %110
i32 3, label %145
i32 4, label %145
]
80: ; preds = %78
%81 = load i32, i32* %13
switch i32 %81, label %105 [
i32 1, label %82
i32 17, label %93
]
82: ; preds = %80
%83 = load %struct.Ferret*, %struct.Ferret** %5
%84 = load %struct.NetFrame*, %struct.NetFrame** %6
%85 = load i8*, i8** %7
%86 = load i32, i32* %12
%87 = zext i32 %86 to i64
%88 = getelementptr inbounds i8, i8* %85, i64 %87
%89 = load i32, i32* %8
%90 = load i32, i32* %12
%91 = sub i32 %89, %90
%92 = call i32 @process_eap_identity(%struct.Ferret* %83, %struct.NetFrame* %84, i8* %88, i32 %91)
br label %109
93: ; preds = %80
%94 = load %struct.Ferret*, %struct.Ferret** %5
%95 = load %struct.NetFrame*, %struct.NetFrame** %6
%96 = load i8*, i8** %7
%97 = load i32, i32* %12
%98 = zext i32 %97 to i64
%99 = getelementptr inbounds i8, i8* %96, i64 %98
%100 = load i32, i32* %8
%101 = load i32, i32* %12
%102 = sub i32 %100, %101
%103 = load i32, i32* %10
%104 = call i32 @process_leap_challenge_request(%struct.Ferret* %94, %struct.NetFrame* %95, i8* %99, i32 %102, i32 %103)
br label %109
105: ; preds = %80
%106 = load %struct.NetFrame*, %struct.NetFrame** %6
%107 = load i32, i32* %13
%108 = call i32 (%struct.NetFrame*, i8*, ...) @FRAMERR(%struct.NetFrame* %106, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %107)
br label %109
109: ; preds = %105, %93, %82
br label %155
110: ; preds = %78
%111 = load i32, i32* %13
switch i32 %111, label %135 [
i32 1, label %112
i32 17, label %123
]
112: ; preds = %110
%113 = load %struct.Ferret*, %struct.Ferret** %5
%114 = load %struct.NetFrame*, %struct.NetFrame** %6
%115 = load i8*, i8** %7
%116 = load i32, i32* %12
%117 = zext i32 %116 to i64
%118 = getelementptr inbounds i8, i8* %115, i64 %117
%119 = load i32, i32* %8
%120 = load i32, i32* %12
%121 = sub i32 %119, %120
%122 = call i32 @process_eap_identity(%struct.Ferret* %113, %struct.NetFrame* %114, i8* %118, i32 %121)
br label %144
123: ; preds = %110
%124 = load %struct.Ferret*, %struct.Ferret** %5
%125 = load %struct.NetFrame*, %struct.NetFrame** %6
%126 = load i8*, i8** %7
%127 = load i32, i32* %12
%128 = zext i32 %127 to i64
%129 = getelementptr inbounds i8, i8* %126, i64 %128
%130 = load i32, i32* %8
%131 = load i32, i32* %12
%132 = sub i32 %130, %131
%133 = load i32, i32* %10
%134 = call i32 @process_leap_challenge_response(%struct.Ferret* %124, %struct.NetFrame* %125, i8* %129, i32 %132, i32 %133)
br label %144
135: ; preds = %110
%136 = load %struct.NetFrame*, %struct.NetFrame** %6
%137 = load i8*, i8** %7
%138 = load i32, i32* %12
%139 = zext i32 %138 to i64
%140 = getelementptr inbounds i8, i8* %137, i64 %139
%141 = load i8, i8* %140
%142 = zext i8 %141 to i32
%143 = call i32 (%struct.NetFrame*, i8*, ...) @FRAMERR(%struct.NetFrame* %136, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %142)
br label %144
144: ; preds = %135, %123, %112
br label %155
145: ; preds = %78, %78
%146 = load %struct.Ferret*, %struct.Ferret** %5
%147 = load %struct.NetFrame*, %struct.NetFrame** %6
%148 = load i32, i32* %10
%149 = load i32, i32* %9
%150 = call i32 @process_leap_success_failure(%struct.Ferret* %146, %struct.NetFrame* %147, i32 %148, i32 %149)
br label %155
151: ; preds = %78
%152 = load %struct.NetFrame*, %struct.NetFrame** %6
%153 = load i32, i32* %9
%154 = call i32 (%struct.NetFrame*, i8*, ...) @FRAMERR(%struct.NetFrame* %152, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %153)
br label %155
155: ; preds = %16, %151, %145, %144, %109
ret void
}

LLVM IR (-O2):
%struct.Ferret = type { i32 }
%struct.NetFrame = type { i32 }
@.str = [16 x i8] c"EAP: truncated\0A\00"
@.str.1 = [25 x i8] c"EAP: unknown request %d\0A\00"
@.str.2 = [22 x i8] c"EAP: unknown code %d\0A\00"
define void @process_eap(%struct.Ferret* %0, %struct.NetFrame* %1, i8* %2, i32 %3) {
%5 = icmp ult i32 %3, 4
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 (%struct.NetFrame*, i8*, ...) @FRAMERR(%struct.NetFrame* %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %77
8: ; preds = %4
%9 = load i8, i8* %2
%10 = zext i8 %9 to i32
%11 = getelementptr inbounds i8, i8* %2, i64 1
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = getelementptr inbounds i8, i8* %2, i64 2
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = shl nuw nsw i32 %16, 8
%18 = getelementptr inbounds i8, i8* %2, i64 3
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = or i32 %17, %20
%22 = icmp ugt i32 %21, %3
br i1 %22, label %23, label %25
23: ; preds = %8
%24 = tail call i32 (%struct.NetFrame*, i8*, ...) @FRAMERR(%struct.NetFrame* %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %25
25: ; preds = %23, %8
%26 = icmp ult i32 %21, %3
%27 = select i1 %26, i32 %21, i32 %3
%28 = add i8 %9, -1
%29 = icmp ult i8 %28, 2
br i1 %29, label %30, label %38
30: ; preds = %25
%31 = icmp ult i32 %27, 5
br i1 %31, label %32, label %34
32: ; preds = %30
%33 = tail call i32 (%struct.NetFrame*, i8*, ...) @FRAMERR(%struct.NetFrame* %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %34
34: ; preds = %32, %30
%35 = getelementptr inbounds i8, i8* %2, i64 4
%36 = load i8, i8* %35
%37 = zext i8 %36 to i32
br label %38
38: ; preds = %25, %34
%39 = phi i32 [ 5, %34 ], [ 4, %25 ]
%40 = phi i32 [ %37, %34 ], [ 0, %25 ]
switch i8 %9, label %75 [
i8 1, label %41
i8 2, label %55
i8 3, label %73
i8 4, label %73
]
41: ; preds = %38
%42 = trunc i32 %40 to i8
switch i8 %42, label %53 [
i8 1, label %43
i8 17, label %48
]
43: ; preds = %41
%44 = zext i32 %39 to i64
%45 = getelementptr inbounds i8, i8* %2, i64 %44
%46 = sub nsw i32 %27, %39
%47 = tail call i32 @process_eap_identity(%struct.Ferret* %0, %struct.NetFrame* %1, i8* %45, i32 %46)
br label %77
48: ; preds = %41
%49 = zext i32 %39 to i64
%50 = getelementptr inbounds i8, i8* %2, i64 %49
%51 = sub nsw i32 %27, %39
%52 = tail call i32 @process_leap_challenge_request(%struct.Ferret* %0, %struct.NetFrame* %1, i8* %50, i32 %51, i32 %13)
br label %77
53: ; preds = %41
%54 = tail call i32 (%struct.NetFrame*, i8*, ...) @FRAMERR(%struct.NetFrame* %1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %40)
br label %77
55: ; preds = %38
%56 = trunc i32 %40 to i8
switch i8 %56, label %67 [
i8 1, label %57
i8 17, label %62
]
57: ; preds = %55
%58 = zext i32 %39 to i64
%59 = getelementptr inbounds i8, i8* %2, i64 %58
%60 = sub nsw i32 %27, %39
%61 = tail call i32 @process_eap_identity(%struct.Ferret* %0, %struct.NetFrame* %1, i8* %59, i32 %60)
br label %77
62: ; preds = %55
%63 = zext i32 %39 to i64
%64 = getelementptr inbounds i8, i8* %2, i64 %63
%65 = sub nsw i32 %27, %39
%66 = tail call i32 @process_leap_challenge_response(%struct.Ferret* %0, %struct.NetFrame* %1, i8* %64, i32 %65, i32 %13)
br label %77
67: ; preds = %55
%68 = zext i32 %39 to i64
%69 = getelementptr inbounds i8, i8* %2, i64 %68
%70 = load i8, i8* %69
%71 = zext i8 %70 to i32
%72 = tail call i32 (%struct.NetFrame*, i8*, ...) @FRAMERR(%struct.NetFrame* %1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %71)
br label %77
73: ; preds = %38, %38
%74 = tail call i32 @process_leap_success_failure(%struct.Ferret* %0, %struct.NetFrame* %1, i32 %13, i32 %10)
br label %77
75: ; preds = %38
%76 = tail call i32 (%struct.NetFrame*, i8*, ...) @FRAMERR(%struct.NetFrame* %1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %10)
br label %77
77: ; preds = %73, %75, %53, %48, %43, %67, %62, %57, %6
ret void
}