#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 */
char *get_next_token(char *, char **);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
scalar_t__ strtoul(char *, char **, int);
void get_next_protorange(char *src, char **cptr, unsigned int *proto1,
                         unsigned int *proto2, int *parse_result,
                         char **badtokenptr) {
  char toktmp[5];
  char prototmp1[5];
  char prototmp2[5];
  char *cerr_ptr;
  static char bad_token[5];
  unsigned int tmp;
  memset(toktmp, 0, 5);
  memset(prototmp1, 0, 5);
  memset(prototmp2, 0, 5);
  memset(bad_token, 0, 5);
  strncpy(prototmp1, get_next_token(src, cptr), 5);
  if (prototmp1[0] == '\0') {
    *parse_result = 5;
    return;
  }
  strncpy(toktmp, get_next_token(src, cptr), 5);
  *parse_result = 0;
  switch (toktmp[0]) {
  case '-':
    strncpy(prototmp2, get_next_token(src, cptr), 5);
    if (prototmp2[0] == '\0') {
      *parse_result = 2;
      strcpy(bad_token, "-");
      *badtokenptr = bad_token;
      break;
    }
    *proto2 = (unsigned int)strtoul(prototmp2, &cerr_ptr, 10);
    if (*cerr_ptr != '\0') {
      *parse_result = 2;
      strncpy(bad_token, prototmp2, 5);
      *badtokenptr = bad_token;
    } else {
      if (*proto2 > 255) {
        strncpy(bad_token, prototmp2, 5);
        *badtokenptr = bad_token;
        *parse_result = 4;
      }
      strncpy(toktmp, get_next_token(src, cptr), 5);
      if (toktmp[0] != '\0' && toktmp[0] != ',') {
        *parse_result = 1;
        strncpy(bad_token, toktmp, 5);
        *badtokenptr = bad_token;
      }
    }
    break;
  case ',':
  case '\0':
    *proto2 = 0;
    break;
  default:
    *parse_result = 1;
    strncpy(bad_token, toktmp, 5);
    *badtokenptr = bad_token;
    break;
  }
  if (*parse_result != 0)
    return;
  *proto1 = (unsigned int)strtoul(prototmp1, &cerr_ptr, 10);
  if (*cerr_ptr != '\0') {
    *parse_result = 2;
    strncpy(bad_token, prototmp1, 5);
    *badtokenptr = bad_token;
  } else if (*proto1 > 255) {
    *parse_result = 4;
    strncpy(bad_token, prototmp1, 5);
    *badtokenptr = bad_token;
  } else
    *badtokenptr = NULL;
  if (*proto2 != 0 && *proto1 > *proto2) {
    tmp = *proto1;
    *proto1 = *proto2;
    *proto2 = tmp;
  }
}


x86 assembly (clang, -O0):
<get_next_protorange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
lea    -0x35(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1050 <memset@plt>
lea    -0x3a(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1050 <memset@plt>
lea    -0x3f(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1050 <memset@plt>
lea    0x2ea2(%rip),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1050 <memset@plt>
lea    -0x3a(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <get_next_token@plt>
mov    -0x58(%rbp),%rdi
mov    %rax,%rsi
mov    $0x5,%edx
call   1030 <strncpy@plt>
movsbl -0x3a(%rbp),%eax
cmp    $0x0,%eax
jne    11f5 <get_next_protorange+0xa5>
mov    -0x28(%rbp),%rax
movl   $0x5,(%rax)
jmp    14ff <get_next_protorange+0x3af>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <get_next_token@plt>
mov    %rax,%rsi
lea    -0x35(%rbp),%rdi
mov    $0x5,%edx
call   1030 <strncpy@plt>
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
movsbl -0x35(%rbp),%eax
mov    %eax,-0x5c(%rbp)
test   %eax,%eax
je     13c6 <get_next_protorange+0x276>
jmp    1231 <get_next_protorange+0xe1>
mov    -0x5c(%rbp),%eax
sub    $0x2c,%eax
je     13c6 <get_next_protorange+0x276>
jmp    1242 <get_next_protorange+0xf2>
mov    -0x5c(%rbp),%eax
sub    $0x2d,%eax
jne    13d5 <get_next_protorange+0x285>
jmp    1253 <get_next_protorange+0x103>
lea    -0x3f(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <get_next_token@plt>
mov    -0x68(%rbp),%rdi
mov    %rax,%rsi
mov    $0x5,%edx
call   1030 <strncpy@plt>
movsbl -0x3f(%rbp),%eax
cmp    $0x0,%eax
jne    12b6 <get_next_protorange+0x166>
mov    -0x28(%rbp),%rax
movl   $0x2,(%rax)
lea    0x2db2(%rip),%rdi
lea    0xd62(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x30(%rbp),%rax
lea    0x2d9b(%rip),%rcx
mov    %rcx,(%rax)
jmp    1402 <get_next_protorange+0x2b2>
lea    -0x3f(%rbp),%rdi
lea    -0x48(%rbp),%rsi
mov    $0xa,%edx
call   1070 <strtoul@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1312 <get_next_protorange+0x1c2>
mov    -0x28(%rbp),%rax
movl   $0x2,(%rax)
lea    -0x3f(%rbp),%rsi
lea    0x2d54(%rip),%rdi
mov    $0x5,%edx
call   1030 <strncpy@plt>
mov    -0x30(%rbp),%rax
lea    0x2d3f(%rip),%rcx
mov    %rcx,(%rax)
jmp    13c1 <get_next_protorange+0x271>
mov    -0x20(%rbp),%rax
cmpl   $0xff,(%rax)
jbe    134f <get_next_protorange+0x1ff>
lea    -0x3f(%rbp),%rsi
lea    0x2d1c(%rip),%rdi
mov    $0x5,%edx
call   1030 <strncpy@plt>
mov    -0x30(%rbp),%rax
lea    0x2d07(%rip),%rcx
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x4,(%rax)
lea    -0x35(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <get_next_token@plt>
mov    -0x70(%rbp),%rdi
mov    %rax,%rsi
mov    $0x5,%edx
call   1030 <strncpy@plt>
movsbl -0x35(%rbp),%eax
cmp    $0x0,%eax
je     13bc <get_next_protorange+0x26c>
movsbl -0x35(%rbp),%eax
cmp    $0x2c,%eax
je     13bc <get_next_protorange+0x26c>
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
lea    -0x35(%rbp),%rsi
lea    0x2ca5(%rip),%rdi
mov    $0x5,%edx
call   1030 <strncpy@plt>
mov    -0x30(%rbp),%rax
lea    0x2c90(%rip),%rcx
mov    %rcx,(%rax)
jmp    13c1 <get_next_protorange+0x271>
jmp    1402 <get_next_protorange+0x2b2>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
jmp    1402 <get_next_protorange+0x2b2>
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
lea    -0x35(%rbp),%rsi
lea    0x2c5f(%rip),%rdi
mov    $0x5,%edx
call   1030 <strncpy@plt>
mov    -0x30(%rbp),%rax
lea    0x2c4a(%rip),%rcx
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
cmpl   $0x0,(%rax)
je     1414 <get_next_protorange+0x2c4>
jmp    14ff <get_next_protorange+0x3af>
lea    -0x3a(%rbp),%rdi
lea    -0x48(%rbp),%rsi
mov    $0xa,%edx
call   1070 <strtoul@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1470 <get_next_protorange+0x320>
mov    -0x28(%rbp),%rax
movl   $0x2,(%rax)
lea    -0x3a(%rbp),%rsi
lea    0x2bf6(%rip),%rdi
mov    $0x5,%edx
call   1030 <strncpy@plt>
mov    -0x30(%rbp),%rax
lea    0x2be1(%rip),%rcx
mov    %rcx,(%rax)
jmp    14c2 <get_next_protorange+0x372>
mov    -0x18(%rbp),%rax
cmpl   $0xff,(%rax)
jbe    14b2 <get_next_protorange+0x362>
mov    -0x28(%rbp),%rax
movl   $0x4,(%rax)
lea    -0x3a(%rbp),%rsi
lea    0x2bb4(%rip),%rdi
mov    $0x5,%edx
call   1030 <strncpy@plt>
mov    -0x30(%rbp),%rax
lea    0x2b9f(%rip),%rcx
mov    %rcx,(%rax)
jmp    14bd <get_next_protorange+0x36d>
mov    -0x30(%rbp),%rax
movq   $0x0,(%rax)
jmp    14c2 <get_next_protorange+0x372>
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
je     14ff <get_next_protorange+0x3af>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jbe    14ff <get_next_protorange+0x3af>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4c(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_next_protorange>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,0x18(%rsp)
mov    %r8,%r13
mov    %rcx,%r12
mov    %rdx,0x28(%rsp)
mov    %rsi,%rbp
mov    %rdi,%r14
lea    0xe(%rsp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1050 <memset@plt>
lea    0x23(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1050 <memset@plt>
lea    0x13(%rsp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1050 <memset@plt>
lea    0x2e98(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1050 <memset@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1060 <get_next_token@plt>
mov    %r15,%rdi
mov    %rax,%rsi
mov    $0x5,%edx
call   1030 <strncpy@plt>
cmpb   $0x0,0x23(%rsp)
je     127a <get_next_protorange+0x12a>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1060 <get_next_token@plt>
lea    0xe(%rsp),%rdi
mov    %rax,%rsi
mov    $0x5,%edx
call   1030 <strncpy@plt>
movl   $0x0,0x0(%r13)
movsbl 0xe(%rsp),%eax
test   %eax,%eax
je     1287 <get_next_protorange+0x137>
cmp    $0x2c,%eax
je     1287 <get_next_protorange+0x137>
cmp    $0x2d,%eax
jne    12ff <get_next_protorange+0x1af>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1060 <get_next_token@plt>
lea    0x13(%rsp),%rdi
mov    %rax,%rsi
mov    $0x5,%edx
call   1030 <strncpy@plt>
cmpb   $0x0,0x13(%rsp)
je     1294 <get_next_protorange+0x144>
lea    0x13(%rsp),%rdi
lea    0x30(%rsp),%rsi
mov    $0xa,%edx
call   1070 <strtoul@plt>
mov    %eax,(%r12)
mov    0x30(%rsp),%rcx
cmpb   $0x0,(%rcx)
je     12ad <get_next_protorange+0x15d>
movl   $0x2,0x0(%r13)
lea    0x13(%rsp),%rsi
jmp    130c <get_next_protorange+0x1bc>
movl   $0x5,0x0(%r13)
jmp    1328 <get_next_protorange+0x1d8>
movl   $0x0,(%r12)
jmp    1321 <get_next_protorange+0x1d1>
movl   $0x2,0x0(%r13)
lea    0xd5d(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcpy@plt>
jmp    1319 <get_next_protorange+0x1c9>
cmp    $0x100,%eax
jb     12d6 <get_next_protorange+0x186>
lea    0x13(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <strncpy@plt>
mov    0x18(%rsp),%rax
mov    %rbx,(%rax)
movl   $0x4,0x0(%r13)
mov    %r14,%rdi
mov    %rbp,%rsi
call   1060 <get_next_token@plt>
lea    0xe(%rsp),%rdi
mov    %rax,%rsi
mov    $0x5,%edx
call   1030 <strncpy@plt>
mov    0xe(%rsp),%al
test   %al,%al
je     1321 <get_next_protorange+0x1d1>
cmp    $0x2c,%al
je     1321 <get_next_protorange+0x1d1>
movl   $0x1,0x0(%r13)
lea    0xe(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <strncpy@plt>
mov    0x18(%rsp),%rax
mov    %rbx,(%rax)
cmpl   $0x0,0x0(%r13)
je     1337 <get_next_protorange+0x1e7>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x23(%rsp),%rdi
lea    0x30(%rsp),%rsi
mov    $0xa,%edx
call   1070 <strtoul@plt>
mov    0x28(%rsp),%rcx
mov    %eax,(%rcx)
mov    0x30(%rsp),%rdx
mov    $0x2,%ecx
cmpb   $0x0,(%rdx)
jne    136d <get_next_protorange+0x21d>
mov    $0x4,%ecx
cmp    $0x100,%eax
jb     13ae <get_next_protorange+0x25e>
mov    %ecx,0x0(%r13)
lea    0x23(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <strncpy@plt>
mov    0x18(%rsp),%rax
mov    %rbx,(%rax)
mov    (%r12),%eax
test   %eax,%eax
je     1328 <get_next_protorange+0x1d8>
mov    0x28(%rsp),%rcx
mov    (%rcx),%ecx
cmp    %eax,%ecx
jbe    1328 <get_next_protorange+0x1d8>
mov    0x28(%rsp),%rdx
mov    %eax,(%rdx)
mov    %ecx,(%r12)
jmp    1328 <get_next_protorange+0x1d8>
xor    %ebx,%ebx
jmp    1383 <get_next_protorange+0x233>

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

LLVM IR (-O2):
@get_next_protorange.bad_token = internal global [5 x i8] zeroinitializer
@.str = [2 x i8] c"-\00"
define void @get_next_protorange(i8* %0, i8** %1, i32* nocapture %2, i32* nocapture %3, i32* nocapture %4, i8** nocapture writeonly %5) {
%7 = alloca [5 x i8]
%8 = alloca [5 x i8]
%9 = alloca [5 x i8]
%10 = alloca i8*
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 0
%13 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%14 = bitcast i8** %10 to i8*
%15 = call i32 @memset(i8* %11, i32 0, i32 5)
%16 = call i32 @memset(i8* %12, i32 0, i32 5)
%17 = call i32 @memset(i8* %13, i32 0, i32 5)
%18 = call i32 @memset(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @get_next_protorange.bad_token, i64 0, i64 0), i32 0, i32 5)
%19 = call i8* @get_next_token(i8* %0, i8** %1)
%20 = call i32 @strncpy(i8* %12, i8* %19, i32 5)
%21 = load i8, i8* %12
%22 = icmp eq i8 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %6
store i32 5, i32* %4
br label %79
24: ; preds = %6
%25 = call i8* @get_next_token(i8* %0, i8** %1)
%26 = call i32 @strncpy(i8* %11, i8* %25, i32 5)
store i32 0, i32* %4
%27 = load i8, i8* %11
%28 = sext i8 %27 to i32
switch i32 %28, label %55 [
i32 45, label %29
i32 44, label %54
i32 0, label %54
]
29: ; preds = %24
%30 = call i8* @get_next_token(i8* %0, i8** %1)
%31 = call i32 @strncpy(i8* %13, i8* %30, i32 5)
%32 = load i8, i8* %13
%33 = icmp eq i8 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %29
store i32 2, i32* %4
%35 = call i32 @strcpy(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @get_next_protorange.bad_token, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @get_next_protorange.bad_token, i64 0, i64 0), i8** %5
br label %57
36: ; preds = %29
%37 = call i64 @strtoul(i8* %13, i8** %10, i32 10)
%38 = trunc i64 %37 to i32
store i32 %38, i32* %3
%39 = load i8*, i8** %10
%40 = load i8, i8* %39
%41 = icmp eq i8 %40, 0
br i1 %41, label %44, label %42
42: ; preds = %36
store i32 2, i32* %4
%43 = call i32 @strncpy(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @get_next_protorange.bad_token, i64 0, i64 0), i8* %13, i32 5)
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @get_next_protorange.bad_token, i64 0, i64 0), i8** %5
br label %57
44: ; preds = %36
%45 = icmp ugt i32 %38, 255
br i1 %45, label %46, label %48
46: ; preds = %44
%47 = call i32 @strncpy(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @get_next_protorange.bad_token, i64 0, i64 0), i8* %13, i32 5)
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @get_next_protorange.bad_token, i64 0, i64 0), i8** %5
store i32 4, i32* %4
br label %48
48: ; preds = %46, %44
%49 = call i8* @get_next_token(i8* %0, i8** %1)
%50 = call i32 @strncpy(i8* %11, i8* %49, i32 5)
%51 = load i8, i8* %11
switch i8 %51, label %52 [
i8 44, label %57
i8 0, label %57
]
52: ; preds = %48
store i32 1, i32* %4
%53 = call i32 @strncpy(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @get_next_protorange.bad_token, i64 0, i64 0), i8* %11, i32 5)
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @get_next_protorange.bad_token, i64 0, i64 0), i8** %5
br label %57
54: ; preds = %24, %24
store i32 0, i32* %3
br label %57
55: ; preds = %24
store i32 1, i32* %4
%56 = call i32 @strncpy(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @get_next_protorange.bad_token, i64 0, i64 0), i8* %11, i32 5)
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @get_next_protorange.bad_token, i64 0, i64 0), i8** %5
br label %57
57: ; preds = %48, %48, %42, %52, %55, %54, %34
%58 = load i32, i32* %4
%59 = icmp eq i32 %58, 0
br i1 %59, label %60, label %79
60: ; preds = %57
%61 = call i64 @strtoul(i8* %12, i8** %10, i32 10)
%62 = trunc i64 %61 to i32
store i32 %62, i32* %2
%63 = load i8*, i8** %10
%64 = load i8, i8* %63
%65 = icmp eq i8 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %60
%67 = icmp ugt i32 %62, 255
br i1 %67, label %68, label %71
68: ; preds = %66, %60
%69 = phi i32 [ 2, %60 ], [ 4, %66 ]
store i32 %69, i32* %4
%70 = call i32 @strncpy(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @get_next_protorange.bad_token, i64 0, i64 0), i8* %12, i32 5)
br label %71
71: ; preds = %68, %66
%72 = phi i8* [ null, %66 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @get_next_protorange.bad_token, i64 0, i64 0), %68 ]
store i8* %72, i8** %5
%73 = load i32, i32* %3
%74 = icmp eq i32 %73, 0
br i1 %74, label %79, label %75
75: ; preds = %71
%76 = load i32, i32* %2
%77 = icmp ugt i32 %76, %73
br i1 %77, label %78, label %79
78: ; preds = %75
store i32 %73, i32* %2
store i32 %76, i32* %3
br label %79
79: ; preds = %71, %75, %78, %57, %23
ret void
}