#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 */
scalar_t__ checkbegin(char const *, char *);
int strlen(char const *);
int config_get_tag_name(const char *line, int begin) {
  int tag_name;
  if (!line || strlen(line) < 2) {
    return (-1);
  }
  if (begin == 1) {
    begin = 2;
  } else {
    begin = 1;
  }
  if (checkbegin(&line[begin], "global")) {
    tag_name = 1;
  } else if (checkbegin(&line[begin], "from")) {
    tag_name = 2;
  } else if (checkbegin(&line[begin], "to")) {
    tag_name = 4;
  } else if (checkbegin(&line[begin], "user")) {
    tag_name = 8;
  } else if (checkbegin(&line[begin], "port")) {
    tag_name = 16;
  } else if (checkbegin(&line[begin], "forwarded")) {
    tag_name = 32;
  } else if (checkbegin(&line[begin], "time")) {
    tag_name = 64;
  } else if (checkbegin(&line[begin], "servertype")) {
    tag_name = 128;
  } else if (checkbegin(&line[begin], "proxyip")) {
    tag_name = 256;
  } else if (checkbegin(&line[begin], "proxyport")) {
    tag_name = 512;
  } else {
    tag_name = (-1);
  }
  return tag_name;
}


x86 assembly (clang, -O0):
<config_get_tag_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114c <config_get_tag_name+0x2c>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jge    1158 <config_get_tag_name+0x38>
movl   $0xffffffff,-0x4(%rbp)
jmp    1371 <config_get_tag_name+0x251>
cmpl   $0x1,-0x14(%rbp)
jne    116e <config_get_tag_name+0x4e>
movl   $0x2,-0x14(%rbp)
jmp    1175 <config_get_tag_name+0x55>
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xe79(%rip),%rsi
call   1040 <checkbegin@plt>
cmp    $0x0,%rax
je     11a2 <config_get_tag_name+0x82>
movl   $0x1,-0x18(%rbp)
jmp    136b <config_get_tag_name+0x24b>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xe53(%rip),%rsi
call   1040 <checkbegin@plt>
cmp    $0x0,%rax
je     11cf <config_get_tag_name+0xaf>
movl   $0x2,-0x18(%rbp)
jmp    1366 <config_get_tag_name+0x246>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xe2b(%rip),%rsi
call   1040 <checkbegin@plt>
cmp    $0x0,%rax
je     11fc <config_get_tag_name+0xdc>
movl   $0x4,-0x18(%rbp)
jmp    1361 <config_get_tag_name+0x241>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xe01(%rip),%rsi
call   1040 <checkbegin@plt>
cmp    $0x0,%rax
je     1229 <config_get_tag_name+0x109>
movl   $0x8,-0x18(%rbp)
jmp    135c <config_get_tag_name+0x23c>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xe00(%rip),%rsi
call   1040 <checkbegin@plt>
cmp    $0x0,%rax
je     1256 <config_get_tag_name+0x136>
movl   $0x10,-0x18(%rbp)
jmp    1357 <config_get_tag_name+0x237>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xdac(%rip),%rsi
call   1040 <checkbegin@plt>
cmp    $0x0,%rax
je     1283 <config_get_tag_name+0x163>
movl   $0x20,-0x18(%rbp)
jmp    1352 <config_get_tag_name+0x232>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xd89(%rip),%rsi
call   1040 <checkbegin@plt>
cmp    $0x0,%rax
je     12b0 <config_get_tag_name+0x190>
movl   $0x40,-0x18(%rbp)
jmp    134d <config_get_tag_name+0x22d>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xd61(%rip),%rsi
call   1040 <checkbegin@plt>
cmp    $0x0,%rax
je     12dd <config_get_tag_name+0x1bd>
movl   $0x80,-0x18(%rbp)
jmp    1348 <config_get_tag_name+0x228>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xd3f(%rip),%rsi
call   1040 <checkbegin@plt>
cmp    $0x0,%rax
je     130a <config_get_tag_name+0x1ea>
movl   $0x100,-0x18(%rbp)
jmp    1343 <config_get_tag_name+0x223>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
lea    0xd1a(%rip),%rsi
call   1040 <checkbegin@plt>
cmp    $0x0,%rax
je     1337 <config_get_tag_name+0x217>
movl   $0x200,-0x18(%rbp)
jmp    133e <config_get_tag_name+0x21e>
movl   $0xffffffff,-0x18(%rbp)
jmp    1343 <config_get_tag_name+0x223>
jmp    1348 <config_get_tag_name+0x228>
jmp    134d <config_get_tag_name+0x22d>
jmp    1352 <config_get_tag_name+0x232>
jmp    1357 <config_get_tag_name+0x237>
jmp    135c <config_get_tag_name+0x23c>
jmp    1361 <config_get_tag_name+0x241>
jmp    1366 <config_get_tag_name+0x246>
jmp    136b <config_get_tag_name+0x24b>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_get_tag_name>:
push   %rbp
push   %r14
push   %rbx
mov    $0xffffffff,%r14d
test   %rdi,%rdi
je     1270 <config_get_tag_name+0x150>
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     1270 <config_get_tag_name+0x150>
xor    %eax,%eax
cmp    $0x1,%ebp
sete   %al
add    %rax,%rbx
add    $0x1,%rbx
lea    0xea4(%rip),%rsi
mov    %rbx,%rdi
call   1040 <checkbegin@plt>
mov    $0x1,%r14d
test   %rax,%rax
jne    1270 <config_get_tag_name+0x150>
lea    0xe8d(%rip),%rsi
mov    %rbx,%rdi
call   1040 <checkbegin@plt>
mov    $0x2,%r14d
test   %rax,%rax
jne    1270 <config_get_tag_name+0x150>
lea    0xe74(%rip),%rsi
mov    %rbx,%rdi
call   1040 <checkbegin@plt>
mov    $0x4,%r14d
test   %rax,%rax
jne    1270 <config_get_tag_name+0x150>
lea    0xe59(%rip),%rsi
mov    %rbx,%rdi
call   1040 <checkbegin@plt>
mov    $0x8,%r14d
test   %rax,%rax
jne    1270 <config_get_tag_name+0x150>
lea    0xe67(%rip),%rsi
mov    %rbx,%rdi
call   1040 <checkbegin@plt>
mov    $0x10,%r14d
test   %rax,%rax
jne    1270 <config_get_tag_name+0x150>
lea    0xe22(%rip),%rsi
mov    %rbx,%rdi
call   1040 <checkbegin@plt>
mov    $0x20,%r14d
test   %rax,%rax
jne    1270 <config_get_tag_name+0x150>
lea    0xe12(%rip),%rsi
mov    %rbx,%rdi
call   1040 <checkbegin@plt>
mov    $0x40,%r14d
test   %rax,%rax
jne    1270 <config_get_tag_name+0x150>
lea    0xdfd(%rip),%rsi
mov    %rbx,%rdi
call   1040 <checkbegin@plt>
mov    $0x80,%r14d
test   %rax,%rax
jne    1270 <config_get_tag_name+0x150>
lea    0xdee(%rip),%rsi
mov    %rbx,%rdi
call   1040 <checkbegin@plt>
mov    $0x100,%r14d
test   %rax,%rax
jne    1270 <config_get_tag_name+0x150>
lea    0xddc(%rip),%rsi
mov    %rbx,%rdi
call   1040 <checkbegin@plt>
cmp    $0x1,%rax
sbb    %r14d,%r14d
or     $0x200,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"global\00"
@.str.1 = [5 x i8] c"from\00"
@.str.2 = [3 x i8] c"to\00"
@.str.3 = [5 x i8] c"user\00"
@.str.4 = [5 x i8] c"port\00"
@.str.5 = [10 x i8] c"forwarded\00"
@.str.6 = [5 x i8] c"time\00"
@.str.7 = [11 x i8] c"servertype\00"
@.str.8 = [8 x i8] c"proxyip\00"
@.str.9 = [10 x i8] c"proxyport\00"
define i32 @config_get_tag_name(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = call i32 @strlen(i8* %10)
%12 = icmp slt i32 %11, 2
br i1 %12, label %13, label %14
13: ; preds = %9, %2
store i32 -1, i32* %3
br label %111
14: ; preds = %9
%15 = load i32, i32* %5
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %18
17: ; preds = %14
store i32 2, i32* %5
br label %19
18: ; preds = %14
store i32 1, i32* %5
br label %19
19: ; preds = %18, %17
%20 = load i8*, i8** %4
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = call i64 @checkbegin(i8* %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %19
store i32 1, i32* %6
br label %109
27: ; preds = %19
%28 = load i8*, i8** %4
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = call i64 @checkbegin(i8* %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %27
store i32 2, i32* %6
br label %108
35: ; preds = %27
%36 = load i8*, i8** %4
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
%40 = call i64 @checkbegin(i8* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %35
store i32 4, i32* %6
br label %107
43: ; preds = %35
%44 = load i8*, i8** %4
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = call i64 @checkbegin(i8* %47, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%49 = icmp ne i64 %48, 0
br i1 %49, label %50, label %51
50: ; preds = %43
store i32 8, i32* %6
br label %106
51: ; preds = %43
%52 = load i8*, i8** %4
%53 = load i32, i32* %5
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8, i8* %52, i64 %54
%56 = call i64 @checkbegin(i8* %55, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%57 = icmp ne i64 %56, 0
br i1 %57, label %58, label %59
58: ; preds = %51
store i32 16, i32* %6
br label %105
59: ; preds = %51
%60 = load i8*, i8** %4
%61 = load i32, i32* %5
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8, i8* %60, i64 %62
%64 = call i64 @checkbegin(i8* %63, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%65 = icmp ne i64 %64, 0
br i1 %65, label %66, label %67
66: ; preds = %59
store i32 32, i32* %6
br label %104
67: ; preds = %59
%68 = load i8*, i8** %4
%69 = load i32, i32* %5
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8, i8* %68, i64 %70
%72 = call i64 @checkbegin(i8* %71, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%73 = icmp ne i64 %72, 0
br i1 %73, label %74, label %75
74: ; preds = %67
store i32 64, i32* %6
br label %103
75: ; preds = %67
%76 = load i8*, i8** %4
%77 = load i32, i32* %5
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8, i8* %76, i64 %78
%80 = call i64 @checkbegin(i8* %79, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%81 = icmp ne i64 %80, 0
br i1 %81, label %82, label %83
82: ; preds = %75
store i32 128, i32* %6
br label %102
83: ; preds = %75
%84 = load i8*, i8** %4
%85 = load i32, i32* %5
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8, i8* %84, i64 %86
%88 = call i64 @checkbegin(i8* %87, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%89 = icmp ne i64 %88, 0
br i1 %89, label %90, label %91
90: ; preds = %83
store i32 256, i32* %6
br label %101
91: ; preds = %83
%92 = load i8*, i8** %4
%93 = load i32, i32* %5
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i8, i8* %92, i64 %94
%96 = call i64 @checkbegin(i8* %95, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
%97 = icmp ne i64 %96, 0
br i1 %97, label %98, label %99
98: ; preds = %91
store i32 512, i32* %6
br label %100
99: ; preds = %91
store i32 -1, i32* %6
br label %100
100: ; preds = %99, %98
br label %101
101: ; preds = %100, %90
br label %102
102: ; preds = %101, %82
br label %103
103: ; preds = %102, %74
br label %104
104: ; preds = %103, %66
br label %105
105: ; preds = %104, %58
br label %106
106: ; preds = %105, %50
br label %107
107: ; preds = %106, %42
br label %108
108: ; preds = %107, %34
br label %109
109: ; preds = %108, %26
%110 = load i32, i32* %6
store i32 %110, i32* %3
br label %111
111: ; preds = %109, %13
%112 = load i32, i32* %3
ret i32 %112
}

LLVM IR (-O2):
@.str = [7 x i8] c"global\00"
@.str.1 = [5 x i8] c"from\00"
@.str.2 = [3 x i8] c"to\00"
@.str.3 = [5 x i8] c"user\00"
@.str.4 = [5 x i8] c"port\00"
@.str.5 = [10 x i8] c"forwarded\00"
@.str.6 = [5 x i8] c"time\00"
@.str.7 = [11 x i8] c"servertype\00"
@.str.8 = [8 x i8] c"proxyip\00"
@.str.9 = [10 x i8] c"proxyport\00"
define i32 @config_get_tag_name(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %41, label %4
4: ; preds = %2
%5 = tail call i32 @strlen(i8* %0)
%6 = icmp slt i32 %5, 2
br i1 %6, label %41, label %7
7: ; preds = %4
%8 = icmp eq i32 %1, 1
%9 = select i1 %8, i64 2, i64 1
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = tail call i64 @checkbegin(i8* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %41
13: ; preds = %7
%14 = tail call i64 @checkbegin(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %41
16: ; preds = %13
%17 = tail call i64 @checkbegin(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %41
19: ; preds = %16
%20 = tail call i64 @checkbegin(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %41
22: ; preds = %19
%23 = tail call i64 @checkbegin(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %41
25: ; preds = %22
%26 = tail call i64 @checkbegin(i8* %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %41
28: ; preds = %25
%29 = tail call i64 @checkbegin(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %41
31: ; preds = %28
%32 = tail call i64 @checkbegin(i8* %10, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %41
34: ; preds = %31
%35 = tail call i64 @checkbegin(i8* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %41
37: ; preds = %34
%38 = tail call i64 @checkbegin(i8* %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
%40 = select i1 %39, i32 -1, i32 512
br label %41
41: ; preds = %7, %13, %16, %19, %22, %25, %28, %31, %34, %37, %2, %4
%42 = phi i32 [ -1, %4 ], [ -1, %2 ], [ 1, %7 ], [ 2, %13 ], [ 4, %16 ], [ 8, %19 ], [ 16, %22 ], [ 32, %25 ], [ 64, %28 ], [ 128, %31 ], [ 256, %34 ], [ %40, %37 ]
ret i32 %42
}