#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__ regmatchInsensitive(char *, char *);
int /*<<< orphan*/ slog(int, char *, char *);
int getheader(char *string) {
  if (regmatchInsensitive(string, "^\\[objectives\\]$")) {
    return (2);
  } else if (regmatchInsensitive(string, "^\\[watch\\]$")) {
    return (10);
  } else if (regmatchInsensitive(string, "^\\[aobjectives\\]$")) {
    return (5);
  } else if (regmatchInsensitive(string, "^\\[input\\]$")) {
    return (3);
  } else if (regmatchInsensitive(string, "^\\[output\\]$")) {
    return (4);
  } else if (regmatchInsensitive(string, "^\\[hostid\\]$")) {
    return (6);
  } else if (regmatchInsensitive(string, "^\\[remote\\]$")) {
    return (7);
  } else if (regmatchInsensitive(string, "^\\[log\\]$")) {
    return 8;
  } else if (regmatchInsensitive(string, "^\\[End\\]$")) {
    return 9;
  }
  slog(2, "Unknown header in configuration file: %s\n", string);
  return (0);
}


x86 assembly (clang, -O0):
<getheader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <regmatchInsensitive@plt>
cmp    $0x0,%rax
je     1152 <getheader+0x32>
movl   $0x2,-0x4(%rbp)
jmp    12c6 <getheader+0x1a6>
mov    -0x10(%rbp),%rdi
lea    0xeb4(%rip),%rsi
call   1040 <regmatchInsensitive@plt>
cmp    $0x0,%rax
je     1178 <getheader+0x58>
movl   $0xa,-0x4(%rbp)
jmp    12c6 <getheader+0x1a6>
mov    -0x10(%rbp),%rdi
lea    0xe9a(%rip),%rsi
call   1040 <regmatchInsensitive@plt>
cmp    $0x0,%rax
je     119e <getheader+0x7e>
movl   $0x5,-0x4(%rbp)
jmp    12c6 <getheader+0x1a6>
mov    -0x10(%rbp),%rdi
lea    0xe86(%rip),%rsi
call   1040 <regmatchInsensitive@plt>
cmp    $0x0,%rax
je     11c4 <getheader+0xa4>
movl   $0x3,-0x4(%rbp)
jmp    12c6 <getheader+0x1a6>
mov    -0x10(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1040 <regmatchInsensitive@plt>
cmp    $0x0,%rax
je     11ea <getheader+0xca>
movl   $0x4,-0x4(%rbp)
jmp    12c6 <getheader+0x1a6>
mov    -0x10(%rbp),%rdi
lea    0xe53(%rip),%rsi
call   1040 <regmatchInsensitive@plt>
cmp    $0x0,%rax
je     1210 <getheader+0xf0>
movl   $0x6,-0x4(%rbp)
jmp    12c6 <getheader+0x1a6>
mov    -0x10(%rbp),%rdi
lea    0xe3a(%rip),%rsi
call   1040 <regmatchInsensitive@plt>
cmp    $0x0,%rax
je     1236 <getheader+0x116>
movl   $0x7,-0x4(%rbp)
jmp    12c6 <getheader+0x1a6>
mov    -0x10(%rbp),%rdi
lea    0xe21(%rip),%rsi
call   1040 <regmatchInsensitive@plt>
cmp    $0x0,%rax
je     125c <getheader+0x13c>
movl   $0x8,-0x4(%rbp)
jmp    12c6 <getheader+0x1a6>
mov    -0x10(%rbp),%rdi
lea    0xe05(%rip),%rsi
call   1040 <regmatchInsensitive@plt>
cmp    $0x0,%rax
je     1282 <getheader+0x162>
movl   $0x9,-0x4(%rbp)
jmp    12c6 <getheader+0x1a6>
jmp    1287 <getheader+0x167>
jmp    128c <getheader+0x16c>
jmp    1291 <getheader+0x171>
jmp    1296 <getheader+0x176>
jmp    129b <getheader+0x17b>
jmp    12a0 <getheader+0x180>
jmp    12a5 <getheader+0x185>
jmp    12aa <getheader+0x18a>
mov    -0x10(%rbp),%rdx
mov    $0x2,%edi
lea    0xdbc(%rip),%rsi
call   1030 <slog@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getheader>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rsi
call   1040 <regmatchInsensitive@plt>
mov    %rax,%rcx
mov    $0x2,%eax
test   %rcx,%rcx
je     113f <getheader+0x1f>
pop    %rbx
ret
lea    0xecb(%rip),%rsi
mov    %rbx,%rdi
call   1040 <regmatchInsensitive@plt>
mov    %rax,%rcx
mov    $0xa,%eax
test   %rcx,%rcx
jne    113d <getheader+0x1d>
lea    0xebb(%rip),%rsi
mov    %rbx,%rdi
call   1040 <regmatchInsensitive@plt>
mov    %rax,%rcx
mov    $0x5,%eax
test   %rcx,%rcx
jne    113d <getheader+0x1d>
lea    0xeb1(%rip),%rsi
mov    %rbx,%rdi
call   1040 <regmatchInsensitive@plt>
mov    %rax,%rcx
mov    $0x3,%eax
test   %rcx,%rcx
jne    113d <getheader+0x1d>
lea    0xea1(%rip),%rsi
mov    %rbx,%rdi
call   1040 <regmatchInsensitive@plt>
mov    %rax,%rcx
mov    $0x4,%eax
test   %rcx,%rcx
jne    113d <getheader+0x1d>
lea    0xe92(%rip),%rsi
mov    %rbx,%rdi
call   1040 <regmatchInsensitive@plt>
mov    %rax,%rcx
mov    $0x6,%eax
test   %rcx,%rcx
jne    113d <getheader+0x1d>
lea    0xe7f(%rip),%rsi
mov    %rbx,%rdi
call   1040 <regmatchInsensitive@plt>
mov    %rax,%rcx
mov    $0x7,%eax
test   %rcx,%rcx
jne    113d <getheader+0x1d>
lea    0xe6c(%rip),%rsi
mov    %rbx,%rdi
call   1040 <regmatchInsensitive@plt>
mov    %rax,%rcx
mov    $0x8,%eax
test   %rcx,%rcx
jne    113d <getheader+0x1d>
lea    0xe56(%rip),%rsi
mov    %rbx,%rdi
call   1040 <regmatchInsensitive@plt>
mov    %rax,%rcx
mov    $0x9,%eax
test   %rcx,%rcx
jne    113d <getheader+0x1d>
lea    0xe40(%rip),%rsi
mov    $0x2,%edi
mov    %rbx,%rdx
call   1030 <slog@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"^\\[objectives\\]$\00"
@.str.1 = [12 x i8] c"^\\[watch\\]$\00"
@.str.2 = [18 x i8] c"^\\[aobjectives\\]$\00"
@.str.3 = [12 x i8] c"^\\[input\\]$\00"
@.str.4 = [13 x i8] c"^\\[output\\]$\00"
@.str.5 = [13 x i8] c"^\\[hostid\\]$\00"
@.str.6 = [13 x i8] c"^\\[remote\\]$\00"
@.str.7 = [10 x i8] c"^\\[log\\]$\00"
@.str.8 = [10 x i8] c"^\\[End\\]$\00"
@.str.9 = [42 x i8] c"Unknown header in configuration file: %s\0A\00"
define i32 @getheader(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @regmatchInsensitive(i8* %4, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 2, i32* %2
br label %59
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i64 @regmatchInsensitive(i8* %9, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 10, i32* %2
br label %59
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = call i64 @regmatchInsensitive(i8* %14, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 5, i32* %2
br label %59
18: ; preds = %13
%19 = load i8*, i8** %3
%20 = call i64 @regmatchInsensitive(i8* %19, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 3, i32* %2
br label %59
23: ; preds = %18
%24 = load i8*, i8** %3
%25 = call i64 @regmatchInsensitive(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %23
store i32 4, i32* %2
br label %59
28: ; preds = %23
%29 = load i8*, i8** %3
%30 = call i64 @regmatchInsensitive(i8* %29, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %28
store i32 6, i32* %2
br label %59
33: ; preds = %28
%34 = load i8*, i8** %3
%35 = call i64 @regmatchInsensitive(i8* %34, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %33
store i32 7, i32* %2
br label %59
38: ; preds = %33
%39 = load i8*, i8** %3
%40 = call i64 @regmatchInsensitive(i8* %39, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %38
store i32 8, i32* %2
br label %59
43: ; preds = %38
%44 = load i8*, i8** %3
%45 = call i64 @regmatchInsensitive(i8* %44, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %43
store i32 9, i32* %2
br label %59
48: ; preds = %43
br label %49
49: ; preds = %48
br label %50
50: ; preds = %49
br label %51
51: ; preds = %50
br label %52
52: ; preds = %51
br label %53
53: ; preds = %52
br label %54
54: ; preds = %53
br label %55
55: ; preds = %54
br label %56
56: ; preds = %55
%57 = load i8*, i8** %3
%58 = call i32 @slog(i32 2, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0), i8* %57)
store i32 0, i32* %2
br label %59
59: ; preds = %56, %47, %42, %37, %32, %27, %22, %17, %12, %7
%60 = load i32, i32* %2
ret i32 %60
}

LLVM IR (-O2):
@.str = [17 x i8] c"^\\[objectives\\]$\00"
@.str.1 = [12 x i8] c"^\\[watch\\]$\00"
@.str.2 = [18 x i8] c"^\\[aobjectives\\]$\00"
@.str.3 = [12 x i8] c"^\\[input\\]$\00"
@.str.4 = [13 x i8] c"^\\[output\\]$\00"
@.str.5 = [13 x i8] c"^\\[hostid\\]$\00"
@.str.6 = [13 x i8] c"^\\[remote\\]$\00"
@.str.7 = [10 x i8] c"^\\[log\\]$\00"
@.str.8 = [10 x i8] c"^\\[End\\]$\00"
@.str.9 = [42 x i8] c"Unknown header in configuration file: %s\0A\00"
define i32 @getheader(i8* %0) {
%2 = tail call i64 @regmatchInsensitive(i8* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %30
4: ; preds = %1
%5 = tail call i64 @regmatchInsensitive(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %30
7: ; preds = %4
%8 = tail call i64 @regmatchInsensitive(i8* %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %30
10: ; preds = %7
%11 = tail call i64 @regmatchInsensitive(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %30
13: ; preds = %10
%14 = tail call i64 @regmatchInsensitive(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %30
16: ; preds = %13
%17 = tail call i64 @regmatchInsensitive(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %30
19: ; preds = %16
%20 = tail call i64 @regmatchInsensitive(i8* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %19
%23 = tail call i64 @regmatchInsensitive(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %22
%26 = tail call i64 @regmatchInsensitive(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = tail call i32 @slog(i32 2, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0), i8* %0)
br label %30
30: ; preds = %25, %22, %19, %16, %13, %10, %7, %4, %1, %28
%31 = phi i32 [ 0, %28 ], [ 2, %1 ], [ 10, %4 ], [ 5, %7 ], [ 3, %10 ], [ 4, %13 ], [ 6, %16 ], [ 7, %19 ], [ 8, %22 ], [ 9, %25 ]
ret i32 %31
}