#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 tc_u32_sel {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ NEXT_ARG();
scalar_t__ matches(char *, char *);
int pack_key16(struct tc_u32_sel *, int, int, int, int /*<<< orphan*/);
int parse_ip_addr(int *, char ***, struct tc_u32_sel *, int);
int parse_u16(int *, char ***, struct tc_u32_sel *, int, int /*<<< orphan*/);
int parse_u8(int *, char ***, struct tc_u32_sel *, int, int);
scalar_t__ strcmp(char *, char *);
int parse_ip(int *argc_p, char ***argv_p, struct tc_u32_sel *sel) {
  int res = -1;
  int argc = *argc_p;
  char **argv = *argv_p;
  if (argc < 2)
    return -1;
  if (strcmp(*argv, "src") == 0) {
    NEXT_ARG();
    res = parse_ip_addr(&argc, &argv, sel, 12);
    goto done;
  }
  if (strcmp(*argv, "dst") == 0) {
    NEXT_ARG();
    res = parse_ip_addr(&argc, &argv, sel, 16);
    goto done;
  }
  if (strcmp(*argv, "tos") == 0 || matches(*argv, "dsfield") == 0) {
    NEXT_ARG();
    res = parse_u8(&argc, &argv, sel, 1, 0);
    goto done;
  }
  if (strcmp(*argv, "ihl") == 0) {
    NEXT_ARG();
    res = parse_u8(&argc, &argv, sel, 0, 0);
    goto done;
  }
  if (strcmp(*argv, "protocol") == 0) {
    NEXT_ARG();
    res = parse_u8(&argc, &argv, sel, 9, 0);
    goto done;
  }
  if (matches(*argv, "precedence") == 0) {
    NEXT_ARG();
    res = parse_u8(&argc, &argv, sel, 1, 0);
    goto done;
  }
  if (strcmp(*argv, "nofrag") == 0) {
    argc--;
    argv++;
    res = pack_key16(sel, 0, 0x3FFF, 6, 0);
    goto done;
  }
  if (strcmp(*argv, "firstfrag") == 0) {
    argc--;
    argv++;
    res = pack_key16(sel, 0, 0x1FFF, 6, 0);
    goto done;
  }
  if (strcmp(*argv, "df") == 0) {
    argc--;
    argv++;
    res = pack_key16(sel, 0x4000, 0x4000, 6, 0);
    goto done;
  }
  if (strcmp(*argv, "mf") == 0) {
    argc--;
    argv++;
    res = pack_key16(sel, 0x2000, 0x2000, 6, 0);
    goto done;
  }
  if (strcmp(*argv, "dport") == 0) {
    NEXT_ARG();
    res = parse_u16(&argc, &argv, sel, 22, 0);
    goto done;
  }
  if (strcmp(*argv, "sport") == 0) {
    NEXT_ARG();
    res = parse_u16(&argc, &argv, sel, 20, 0);
    goto done;
  }
  if (strcmp(*argv, "icmp_type") == 0) {
    NEXT_ARG();
    res = parse_u8(&argc, &argv, sel, 20, 0);
    goto done;
  }
  if (strcmp(*argv, "icmp_code") == 0) {
    NEXT_ARG();
    res = parse_u8(&argc, &argv, sel, 20, 1);
    goto done;
  }
  return -1;
done:
  *argc_p = argc;
  *argv_p = argv;
  return res;
}


x86 assembly (clang, -O0):
<parse_ip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0xffffffff,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
cmpl   $0x2,-0x28(%rbp)
jge    11b5 <parse_ip+0x45>
movl   $0xffffffff,-0x4(%rbp)
jmp    15ef <parse_ip+0x47f>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xe3d(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    11f7 <parse_ip+0x87>
mov    $0x0,%al
call   1080 <NEXT_ARG@plt>
mov    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0xc,%ecx
call   1060 <parse_ip_addr@plt>
mov    %eax,-0x24(%rbp)
jmp    15d5 <parse_ip+0x465>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xdff(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1239 <parse_ip+0xc9>
mov    $0x0,%al
call   1080 <NEXT_ARG@plt>
mov    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x10,%ecx
call   1060 <parse_ip_addr@plt>
mov    %eax,-0x24(%rbp)
jmp    15d5 <parse_ip+0x465>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xdc1(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     1273 <parse_ip+0x103>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xda8(%rip),%rsi
call   1040 <matches@plt>
cmp    $0x0,%rax
jne    129b <parse_ip+0x12b>
mov    $0x0,%al
call   1080 <NEXT_ARG@plt>
mov    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x1,%ecx
xor    %r8d,%r8d
call   1090 <parse_u8@plt>
mov    %eax,-0x24(%rbp)
jmp    15d5 <parse_ip+0x465>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xd6b(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    12de <parse_ip+0x16e>
mov    $0x0,%al
call   1080 <NEXT_ARG@plt>
mov    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
xor    %r8d,%r8d
mov    %r8d,%ecx
call   1090 <parse_u8@plt>
mov    %eax,-0x24(%rbp)
jmp    15d5 <parse_ip+0x465>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xd2c(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1323 <parse_ip+0x1b3>
mov    $0x0,%al
call   1080 <NEXT_ARG@plt>
mov    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x9,%ecx
xor    %r8d,%r8d
call   1090 <parse_u8@plt>
mov    %eax,-0x24(%rbp)
jmp    15d5 <parse_ip+0x465>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xcf0(%rip),%rsi
call   1040 <matches@plt>
cmp    $0x0,%rax
jne    1368 <parse_ip+0x1f8>
mov    $0x0,%al
call   1080 <NEXT_ARG@plt>
mov    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x1,%ecx
xor    %r8d,%r8d
call   1090 <parse_u8@plt>
mov    %eax,-0x24(%rbp)
jmp    15d5 <parse_ip+0x465>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xcb6(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    13bb <parse_ip+0x24b>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
xor    %r8d,%r8d
mov    $0x3fff,%edx
mov    $0x6,%ecx
mov    %r8d,%esi
call   1050 <pack_key16@plt>
mov    %eax,-0x24(%rbp)
jmp    15d5 <parse_ip+0x465>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xc6a(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    140e <parse_ip+0x29e>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
xor    %r8d,%r8d
mov    $0x1fff,%edx
mov    $0x6,%ecx
mov    %r8d,%esi
call   1050 <pack_key16@plt>
mov    %eax,-0x24(%rbp)
jmp    15d5 <parse_ip+0x465>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xc21(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1460 <parse_ip+0x2f0>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x4000,%edx
mov    $0x6,%ecx
xor    %r8d,%r8d
mov    %edx,%esi
call   1050 <pack_key16@plt>
mov    %eax,-0x24(%rbp)
jmp    15d5 <parse_ip+0x465>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xbd2(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    14b2 <parse_ip+0x342>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x2000,%edx
mov    $0x6,%ecx
xor    %r8d,%r8d
mov    %edx,%esi
call   1050 <pack_key16@plt>
mov    %eax,-0x24(%rbp)
jmp    15d5 <parse_ip+0x465>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xb83(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    14f7 <parse_ip+0x387>
mov    $0x0,%al
call   1080 <NEXT_ARG@plt>
mov    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x16,%ecx
xor    %r8d,%r8d
call   1030 <parse_u16@plt>
mov    %eax,-0x24(%rbp)
jmp    15d5 <parse_ip+0x465>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xb44(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    153c <parse_ip+0x3cc>
mov    $0x0,%al
call   1080 <NEXT_ARG@plt>
mov    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x14,%ecx
xor    %r8d,%r8d
call   1030 <parse_u16@plt>
mov    %eax,-0x24(%rbp)
jmp    15d5 <parse_ip+0x465>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xb05(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    1581 <parse_ip+0x411>
mov    $0x0,%al
call   1080 <NEXT_ARG@plt>
mov    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x14,%ecx
xor    %r8d,%r8d
call   1090 <parse_u8@plt>
mov    %eax,-0x24(%rbp)
jmp    15d5 <parse_ip+0x465>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xaca(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    15c9 <parse_ip+0x459>
mov    $0x0,%al
call   1080 <NEXT_ARG@plt>
mov    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x14,%ecx
mov    $0x1,%r8d
call   1090 <parse_u8@plt>
mov    %eax,-0x24(%rbp)
jmp    15d5 <parse_ip+0x465>
movl   $0xffffffff,-0x4(%rbp)
jmp    15ef <parse_ip+0x47f>
mov    -0x28(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x30(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_ip>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    (%rdi),%ebp
mov    %ebp,0xc(%rsp)
mov    (%rsi),%rbx
mov    %rbx,0x10(%rsp)
mov    $0xffffffff,%r13d
cmp    $0x2,%ebp
jl     139c <parse_ip+0x22c>
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%r12
mov    (%rbx),%rdi
lea    0xe52(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     132d <parse_ip+0x1bd>
mov    (%rbx),%rdi
lea    0xe3e(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     136b <parse_ip+0x1fb>
mov    (%rbx),%rdi
lea    0xe2a(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1348 <parse_ip+0x1d8>
mov    (%rbx),%rdi
lea    0xe16(%rip),%rsi
call   1040 <matches@plt>
test   %rax,%rax
je     1348 <parse_ip+0x1d8>
mov    (%rbx),%rdi
lea    0xe06(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     13ae <parse_ip+0x23e>
mov    (%rbx),%rdi
lea    0xdf2(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     13c6 <parse_ip+0x256>
mov    (%rbx),%rdi
lea    0xde3(%rip),%rsi
call   1040 <matches@plt>
test   %rax,%rax
je     1348 <parse_ip+0x1d8>
mov    (%rbx),%rdi
lea    0xdd6(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     13e1 <parse_ip+0x271>
mov    (%rbx),%rdi
lea    0xdc5(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     13fd <parse_ip+0x28d>
mov    (%rbx),%rdi
lea    0xdb7(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1419 <parse_ip+0x2a9>
mov    (%rbx),%rdi
lea    0xda2(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1438 <parse_ip+0x2c8>
mov    (%rbx),%rdi
lea    0xd8d(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1467 <parse_ip+0x2f7>
mov    (%rbx),%rdi
lea    0xd7b(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1482 <parse_ip+0x312>
mov    (%rbx),%rdi
lea    0xd69(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     14a8 <parse_ip+0x338>
mov    (%rbx),%rdi
lea    0xd5b(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    139c <parse_ip+0x22c>
xor    %eax,%eax
call   1080 <NEXT_ARG@plt>
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %r15,%rdx
mov    $0x14,%ecx
mov    $0x1,%r8d
jmp    1364 <parse_ip+0x1f4>
xor    %eax,%eax
call   1080 <NEXT_ARG@plt>
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %r15,%rdx
mov    $0xc,%ecx
jmp    1384 <parse_ip+0x214>
xor    %eax,%eax
call   1080 <NEXT_ARG@plt>
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %r15,%rdx
mov    $0x1,%ecx
xor    %r8d,%r8d
call   1090 <parse_u8@plt>
jmp    1389 <parse_ip+0x219>
xor    %eax,%eax
call   1080 <NEXT_ARG@plt>
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %r15,%rdx
mov    $0x10,%ecx
call   1060 <parse_ip_addr@plt>
mov    %eax,%r13d
mov    0xc(%rsp),%eax
mov    %eax,(%r12)
mov    0x10(%rsp),%rax
mov    %rax,(%r14)
mov    %r13d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1080 <NEXT_ARG@plt>
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %r15,%rdx
xor    %ecx,%ecx
jmp    1361 <parse_ip+0x1f1>
xor    %eax,%eax
call   1080 <NEXT_ARG@plt>
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %r15,%rdx
mov    $0x9,%ecx
jmp    1361 <parse_ip+0x1f1>
add    $0xffffffff,%ebp
mov    %ebp,0xc(%rsp)
add    $0x8,%rbx
mov    %rbx,0x10(%rsp)
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x3fff,%edx
jmp    1455 <parse_ip+0x2e5>
add    $0xffffffff,%ebp
mov    %ebp,0xc(%rsp)
add    $0x8,%rbx
mov    %rbx,0x10(%rsp)
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x1fff,%edx
jmp    1455 <parse_ip+0x2e5>
add    $0xffffffff,%ebp
mov    %ebp,0xc(%rsp)
add    $0x8,%rbx
mov    %rbx,0x10(%rsp)
mov    %r15,%rdi
mov    $0x4000,%esi
mov    $0x4000,%edx
jmp    1455 <parse_ip+0x2e5>
add    $0xffffffff,%ebp
mov    %ebp,0xc(%rsp)
add    $0x8,%rbx
mov    %rbx,0x10(%rsp)
mov    %r15,%rdi
mov    $0x2000,%esi
mov    $0x2000,%edx
mov    $0x6,%ecx
xor    %r8d,%r8d
call   1050 <pack_key16@plt>
jmp    1389 <parse_ip+0x219>
xor    %eax,%eax
call   1080 <NEXT_ARG@plt>
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %r15,%rdx
mov    $0x16,%ecx
jmp    149b <parse_ip+0x32b>
xor    %eax,%eax
call   1080 <NEXT_ARG@plt>
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %r15,%rdx
mov    $0x14,%ecx
xor    %r8d,%r8d
call   1030 <parse_u16@plt>
jmp    1389 <parse_ip+0x219>
xor    %eax,%eax
call   1080 <NEXT_ARG@plt>
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %r15,%rdx
mov    $0x14,%ecx
jmp    1361 <parse_ip+0x1f1>

LLVM IR (-O0):
%struct.tc_u32_sel = type { i32 }
@.str = [4 x i8] c"src\00"
@.str.1 = [4 x i8] c"dst\00"
@.str.2 = [4 x i8] c"tos\00"
@.str.3 = [8 x i8] c"dsfield\00"
@.str.4 = [4 x i8] c"ihl\00"
@.str.5 = [9 x i8] c"protocol\00"
@.str.6 = [11 x i8] c"precedence\00"
@.str.7 = [7 x i8] c"nofrag\00"
@.str.8 = [10 x i8] c"firstfrag\00"
@.str.9 = [3 x i8] c"df\00"
@.str.10 = [3 x i8] c"mf\00"
@.str.11 = [6 x i8] c"dport\00"
@.str.12 = [6 x i8] c"sport\00"
@.str.13 = [10 x i8] c"icmp_type\00"
@.str.14 = [10 x i8] c"icmp_code\00"
define i32 @parse_ip(i32* %0, i8*** %1, %struct.tc_u32_sel* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8***
%7 = alloca %struct.tc_u32_sel*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8**
store i32* %0, i32** %5
store i8*** %1, i8**** %6
store %struct.tc_u32_sel* %2, %struct.tc_u32_sel** %7
store i32 -1, i32* %8
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
store i32 %12, i32* %9
%13 = load i8***, i8**** %6
%14 = load i8**, i8*** %13
store i8** %14, i8*** %10
%15 = load i32, i32* %9
%16 = icmp slt i32 %15, 2
br i1 %16, label %17, label %18
17: ; preds = %3
store i32 -1, i32* %4
br label %168
18: ; preds = %3
%19 = load i8**, i8*** %10
%20 = load i8*, i8** %19
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %18
%24 = call i32 (...) @NEXT_ARG()
%25 = load %struct.tc_u32_sel*, %struct.tc_u32_sel** %7
%26 = call i32 @parse_ip_addr(i32* %9, i8*** %10, %struct.tc_u32_sel* %25, i32 12)
store i32 %26, i32* %8
br label %162
27: ; preds = %18
%28 = load i8**, i8*** %10
%29 = load i8*, i8** %28
%30 = call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %27
%33 = call i32 (...) @NEXT_ARG()
%34 = load %struct.tc_u32_sel*, %struct.tc_u32_sel** %7
%35 = call i32 @parse_ip_addr(i32* %9, i8*** %10, %struct.tc_u32_sel* %34, i32 16)
store i32 %35, i32* %8
br label %162
36: ; preds = %27
%37 = load i8**, i8*** %10
%38 = load i8*, i8** %37
%39 = call i64 @strcmp(i8* %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %46, label %41
41: ; preds = %36
%42 = load i8**, i8*** %10
%43 = load i8*, i8** %42
%44 = call i64 @matches(i8* %43, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %41, %36
%47 = call i32 (...) @NEXT_ARG()
%48 = load %struct.tc_u32_sel*, %struct.tc_u32_sel** %7
%49 = call i32 @parse_u8(i32* %9, i8*** %10, %struct.tc_u32_sel* %48, i32 1, i32 0)
store i32 %49, i32* %8
br label %162
50: ; preds = %41
%51 = load i8**, i8*** %10
%52 = load i8*, i8** %51
%53 = call i64 @strcmp(i8* %52, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %59
55: ; preds = %50
%56 = call i32 (...) @NEXT_ARG()
%57 = load %struct.tc_u32_sel*, %struct.tc_u32_sel** %7
%58 = call i32 @parse_u8(i32* %9, i8*** %10, %struct.tc_u32_sel* %57, i32 0, i32 0)
store i32 %58, i32* %8
br label %162
59: ; preds = %50
%60 = load i8**, i8*** %10
%61 = load i8*, i8** %60
%62 = call i64 @strcmp(i8* %61, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %68
64: ; preds = %59
%65 = call i32 (...) @NEXT_ARG()
%66 = load %struct.tc_u32_sel*, %struct.tc_u32_sel** %7
%67 = call i32 @parse_u8(i32* %9, i8*** %10, %struct.tc_u32_sel* %66, i32 9, i32 0)
store i32 %67, i32* %8
br label %162
68: ; preds = %59
%69 = load i8**, i8*** %10
%70 = load i8*, i8** %69
%71 = call i64 @matches(i8* %70, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%72 = icmp eq i64 %71, 0
br i1 %72, label %73, label %77
73: ; preds = %68
%74 = call i32 (...) @NEXT_ARG()
%75 = load %struct.tc_u32_sel*, %struct.tc_u32_sel** %7
%76 = call i32 @parse_u8(i32* %9, i8*** %10, %struct.tc_u32_sel* %75, i32 1, i32 0)
store i32 %76, i32* %8
br label %162
77: ; preds = %68
%78 = load i8**, i8*** %10
%79 = load i8*, i8** %78
%80 = call i64 @strcmp(i8* %79, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%81 = icmp eq i64 %80, 0
br i1 %81, label %82, label %89
82: ; preds = %77
%83 = load i32, i32* %9
%84 = add nsw i32 %83, -1
store i32 %84, i32* %9
%85 = load i8**, i8*** %10
%86 = getelementptr inbounds i8*, i8** %85, i32 1
store i8** %86, i8*** %10
%87 = load %struct.tc_u32_sel*, %struct.tc_u32_sel** %7
%88 = call i32 @pack_key16(%struct.tc_u32_sel* %87, i32 0, i32 16383, i32 6, i32 0)
store i32 %88, i32* %8
br label %162
89: ; preds = %77
%90 = load i8**, i8*** %10
%91 = load i8*, i8** %90
%92 = call i64 @strcmp(i8* %91, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%93 = icmp eq i64 %92, 0
br i1 %93, label %94, label %101
94: ; preds = %89
%95 = load i32, i32* %9
%96 = add nsw i32 %95, -1
store i32 %96, i32* %9
%97 = load i8**, i8*** %10
%98 = getelementptr inbounds i8*, i8** %97, i32 1
store i8** %98, i8*** %10
%99 = load %struct.tc_u32_sel*, %struct.tc_u32_sel** %7
%100 = call i32 @pack_key16(%struct.tc_u32_sel* %99, i32 0, i32 8191, i32 6, i32 0)
store i32 %100, i32* %8
br label %162
101: ; preds = %89
%102 = load i8**, i8*** %10
%103 = load i8*, i8** %102
%104 = call i64 @strcmp(i8* %103, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%105 = icmp eq i64 %104, 0
br i1 %105, label %106, label %113
106: ; preds = %101
%107 = load i32, i32* %9
%108 = add nsw i32 %107, -1
store i32 %108, i32* %9
%109 = load i8**, i8*** %10
%110 = getelementptr inbounds i8*, i8** %109, i32 1
store i8** %110, i8*** %10
%111 = load %struct.tc_u32_sel*, %struct.tc_u32_sel** %7
%112 = call i32 @pack_key16(%struct.tc_u32_sel* %111, i32 16384, i32 16384, i32 6, i32 0)
store i32 %112, i32* %8
br label %162
113: ; preds = %101
%114 = load i8**, i8*** %10
%115 = load i8*, i8** %114
%116 = call i64 @strcmp(i8* %115, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%117 = icmp eq i64 %116, 0
br i1 %117, label %118, label %125
118: ; preds = %113
%119 = load i32, i32* %9
%120 = add nsw i32 %119, -1
store i32 %120, i32* %9
%121 = load i8**, i8*** %10
%122 = getelementptr inbounds i8*, i8** %121, i32 1
store i8** %122, i8*** %10
%123 = load %struct.tc_u32_sel*, %struct.tc_u32_sel** %7
%124 = call i32 @pack_key16(%struct.tc_u32_sel* %123, i32 8192, i32 8192, i32 6, i32 0)
store i32 %124, i32* %8
br label %162
125: ; preds = %113
%126 = load i8**, i8*** %10
%127 = load i8*, i8** %126
%128 = call i64 @strcmp(i8* %127, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%129 = icmp eq i64 %128, 0
br i1 %129, label %130, label %134
130: ; preds = %125
%131 = call i32 (...) @NEXT_ARG()
%132 = load %struct.tc_u32_sel*, %struct.tc_u32_sel** %7
%133 = call i32 @parse_u16(i32* %9, i8*** %10, %struct.tc_u32_sel* %132, i32 22, i32 0)
store i32 %133, i32* %8
br label %162
134: ; preds = %125
%135 = load i8**, i8*** %10
%136 = load i8*, i8** %135
%137 = call i64 @strcmp(i8* %136, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
%138 = icmp eq i64 %137, 0
br i1 %138, label %139, label %143
139: ; preds = %134
%140 = call i32 (...) @NEXT_ARG()
%141 = load %struct.tc_u32_sel*, %struct.tc_u32_sel** %7
%142 = call i32 @parse_u16(i32* %9, i8*** %10, %struct.tc_u32_sel* %141, i32 20, i32 0)
store i32 %142, i32* %8
br label %162
143: ; preds = %134
%144 = load i8**, i8*** %10
%145 = load i8*, i8** %144
%146 = call i64 @strcmp(i8* %145, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
%147 = icmp eq i64 %146, 0
br i1 %147, label %148, label %152
148: ; preds = %143
%149 = call i32 (...) @NEXT_ARG()
%150 = load %struct.tc_u32_sel*, %struct.tc_u32_sel** %7
%151 = call i32 @parse_u8(i32* %9, i8*** %10, %struct.tc_u32_sel* %150, i32 20, i32 0)
store i32 %151, i32* %8
br label %162
152: ; preds = %143
%153 = load i8**, i8*** %10
%154 = load i8*, i8** %153
%155 = call i64 @strcmp(i8* %154, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0))
%156 = icmp eq i64 %155, 0
br i1 %156, label %157, label %161
157: ; preds = %152
%158 = call i32 (...) @NEXT_ARG()
%159 = load %struct.tc_u32_sel*, %struct.tc_u32_sel** %7
%160 = call i32 @parse_u8(i32* %9, i8*** %10, %struct.tc_u32_sel* %159, i32 20, i32 1)
store i32 %160, i32* %8
br label %162
161: ; preds = %152
store i32 -1, i32* %4
br label %168
162: ; preds = %157, %148, %139, %130, %118, %106, %94, %82, %73, %64, %55, %46, %32, %23
%163 = load i32, i32* %9
%164 = load i32*, i32** %5
store i32 %163, i32* %164
%165 = load i8**, i8*** %10
%166 = load i8***, i8**** %6
store i8** %165, i8*** %166
%167 = load i32, i32* %8
store i32 %167, i32* %4
br label %168
168: ; preds = %162, %161, %17
%169 = load i32, i32* %4
ret i32 %169
}

LLVM IR (-O2):
%struct.tc_u32_sel = type { i32 }
@.str = [4 x i8] c"src\00"
@.str.1 = [4 x i8] c"dst\00"
@.str.2 = [4 x i8] c"tos\00"
@.str.3 = [8 x i8] c"dsfield\00"
@.str.4 = [4 x i8] c"ihl\00"
@.str.5 = [9 x i8] c"protocol\00"
@.str.6 = [11 x i8] c"precedence\00"
@.str.7 = [7 x i8] c"nofrag\00"
@.str.8 = [10 x i8] c"firstfrag\00"
@.str.9 = [3 x i8] c"df\00"
@.str.10 = [3 x i8] c"mf\00"
@.str.11 = [6 x i8] c"dport\00"
@.str.12 = [6 x i8] c"sport\00"
@.str.13 = [10 x i8] c"icmp_type\00"
@.str.14 = [10 x i8] c"icmp_code\00"
define i32 @parse_ip(i32* nocapture %0, i8*** nocapture %1, %struct.tc_u32_sel* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = bitcast i32* %4 to i8*
%7 = load i32, i32* %0
store i32 %7, i32* %4
%8 = bitcast i8*** %5 to i8*
%9 = load i8**, i8*** %1
store i8** %9, i8*** %5
%10 = icmp slt i32 %7, 2
br i1 %10, label %121, label %11
11: ; preds = %3
%12 = load i8*, i8** %9
%13 = tail call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = tail call i32 (...) @NEXT_ARG()
%17 = call i32 @parse_ip_addr(i32* %4, i8*** %5, %struct.tc_u32_sel* %2, i32 12)
br label %117
18: ; preds = %11
%19 = load i8*, i8** %9
%20 = tail call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = tail call i32 (...) @NEXT_ARG()
%24 = call i32 @parse_ip_addr(i32* %4, i8*** %5, %struct.tc_u32_sel* %2, i32 16)
br label %117
25: ; preds = %18
%26 = load i8*, i8** %9
%27 = tail call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %33, label %29
29: ; preds = %25
%30 = load i8*, i8** %9
%31 = tail call i64 @matches(i8* %30, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %29, %25
%34 = tail call i32 (...) @NEXT_ARG()
%35 = call i32 @parse_u8(i32* %4, i8*** %5, %struct.tc_u32_sel* %2, i32 1, i32 0)
br label %117
36: ; preds = %29
%37 = load i8*, i8** %9
%38 = tail call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %36
%41 = tail call i32 (...) @NEXT_ARG()
%42 = call i32 @parse_u8(i32* %4, i8*** %5, %struct.tc_u32_sel* %2, i32 0, i32 0)
br label %117
43: ; preds = %36
%44 = load i8*, i8** %9
%45 = tail call i64 @strcmp(i8* %44, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = tail call i32 (...) @NEXT_ARG()
%49 = call i32 @parse_u8(i32* %4, i8*** %5, %struct.tc_u32_sel* %2, i32 9, i32 0)
br label %117
50: ; preds = %43
%51 = load i8*, i8** %9
%52 = tail call i64 @matches(i8* %51, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %50
%55 = tail call i32 (...) @NEXT_ARG()
%56 = call i32 @parse_u8(i32* %4, i8*** %5, %struct.tc_u32_sel* %2, i32 1, i32 0)
br label %117
57: ; preds = %50
%58 = load i8*, i8** %9
%59 = tail call i64 @strcmp(i8* %58, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %65
61: ; preds = %57
%62 = add nsw i32 %7, -1
store i32 %62, i32* %4
%63 = getelementptr inbounds i8*, i8** %9, i64 1
store i8** %63, i8*** %5
%64 = tail call i32 @pack_key16(%struct.tc_u32_sel* %2, i32 0, i32 16383, i32 6, i32 0)
br label %117
65: ; preds = %57
%66 = load i8*, i8** %9
%67 = tail call i64 @strcmp(i8* %66, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%68 = icmp eq i64 %67, 0
br i1 %68, label %69, label %73
69: ; preds = %65
%70 = add nsw i32 %7, -1
store i32 %70, i32* %4
%71 = getelementptr inbounds i8*, i8** %9, i64 1
store i8** %71, i8*** %5
%72 = tail call i32 @pack_key16(%struct.tc_u32_sel* %2, i32 0, i32 8191, i32 6, i32 0)
br label %117
73: ; preds = %65
%74 = load i8*, i8** %9
%75 = tail call i64 @strcmp(i8* %74, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %81
77: ; preds = %73
%78 = add nsw i32 %7, -1
store i32 %78, i32* %4
%79 = getelementptr inbounds i8*, i8** %9, i64 1
store i8** %79, i8*** %5
%80 = tail call i32 @pack_key16(%struct.tc_u32_sel* %2, i32 16384, i32 16384, i32 6, i32 0)
br label %117
81: ; preds = %73
%82 = load i8*, i8** %9
%83 = tail call i64 @strcmp(i8* %82, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%84 = icmp eq i64 %83, 0
br i1 %84, label %85, label %89
85: ; preds = %81
%86 = add nsw i32 %7, -1
store i32 %86, i32* %4
%87 = getelementptr inbounds i8*, i8** %9, i64 1
store i8** %87, i8*** %5
%88 = tail call i32 @pack_key16(%struct.tc_u32_sel* %2, i32 8192, i32 8192, i32 6, i32 0)
br label %117
89: ; preds = %81
%90 = load i8*, i8** %9
%91 = tail call i64 @strcmp(i8* %90, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0))
%92 = icmp eq i64 %91, 0
br i1 %92, label %93, label %96
93: ; preds = %89
%94 = tail call i32 (...) @NEXT_ARG()
%95 = call i32 @parse_u16(i32* %4, i8*** %5, %struct.tc_u32_sel* %2, i32 22, i32 0)
br label %117
96: ; preds = %89
%97 = load i8*, i8** %9
%98 = tail call i64 @strcmp(i8* %97, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
%99 = icmp eq i64 %98, 0
br i1 %99, label %100, label %103
100: ; preds = %96
%101 = tail call i32 (...) @NEXT_ARG()
%102 = call i32 @parse_u16(i32* %4, i8*** %5, %struct.tc_u32_sel* %2, i32 20, i32 0)
br label %117
103: ; preds = %96
%104 = load i8*, i8** %9
%105 = tail call i64 @strcmp(i8* %104, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
%106 = icmp eq i64 %105, 0
br i1 %106, label %107, label %110
107: ; preds = %103
%108 = tail call i32 (...) @NEXT_ARG()
%109 = call i32 @parse_u8(i32* %4, i8*** %5, %struct.tc_u32_sel* %2, i32 20, i32 0)
br label %117
110: ; preds = %103
%111 = load i8*, i8** %9
%112 = tail call i64 @strcmp(i8* %111, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0))
%113 = icmp eq i64 %112, 0
br i1 %113, label %114, label %121
114: ; preds = %110
%115 = tail call i32 (...) @NEXT_ARG()
%116 = call i32 @parse_u8(i32* %4, i8*** %5, %struct.tc_u32_sel* %2, i32 20, i32 1)
br label %117
117: ; preds = %114, %107, %100, %93, %85, %77, %69, %61, %54, %47, %40, %33, %22, %15
%118 = phi i32 [ %17, %15 ], [ %24, %22 ], [ %35, %33 ], [ %42, %40 ], [ %49, %47 ], [ %56, %54 ], [ %64, %61 ], [ %72, %69 ], [ %80, %77 ], [ %88, %85 ], [ %95, %93 ], [ %102, %100 ], [ %109, %107 ], [ %116, %114 ]
%119 = load i32, i32* %4
store i32 %119, i32* %0
%120 = load i8**, i8*** %5
store i8** %120, i8*** %1
br label %121
121: ; preds = %110, %3, %117
%122 = phi i32 [ %118, %117 ], [ -1, %3 ], [ -1, %110 ]
ret i32 %122
}