#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__ strcmp(char *, char *);
int DbgStringToFlags(char *s) {
  if ((((s)[0] == ("all")[0]) && (strcmp((s), ("all")) == 0)))
    return (0x1fff);
  else if ((((s)[0] == ("syn")[0]) && (strcmp((s), ("syn")) == 0)))
    return (0x3fff);
  else if ((((s)[0] == ("sem")[0]) && (strcmp((s), ("sem")) == 0)))
    return (0x5fff);
  else if ((((s)[0] == ("synsem")[0]) && (strcmp((s), ("synsem")) == 0)))
    return (0x7fff);
  else
    return (-1);
}


x86 assembly (clang, -O0):
<DbgStringToFlags>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl 0xed6(%rip),%ecx
cmp    %ecx,%eax
jne    1158 <DbgStringToFlags+0x48>
mov    -0x10(%rbp),%rdi
lea    0xec3(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1158 <DbgStringToFlags+0x48>
movl   $0x1fff,-0x4(%rbp)
jmp    1213 <DbgStringToFlags+0x103>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl 0xe9e(%rip),%ecx
cmp    %ecx,%eax
jne    1194 <DbgStringToFlags+0x84>
mov    -0x10(%rbp),%rdi
lea    0xe8b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1194 <DbgStringToFlags+0x84>
movl   $0x3fff,-0x4(%rbp)
jmp    1213 <DbgStringToFlags+0x103>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl 0xe69(%rip),%ecx
cmp    %ecx,%eax
jne    11d0 <DbgStringToFlags+0xc0>
mov    -0x10(%rbp),%rdi
lea    0xe56(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11d0 <DbgStringToFlags+0xc0>
movl   $0x5fff,-0x4(%rbp)
jmp    1213 <DbgStringToFlags+0x103>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl 0xe2a(%rip),%ecx
cmp    %ecx,%eax
jne    120c <DbgStringToFlags+0xfc>
mov    -0x10(%rbp),%rdi
lea    0xe17(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    120c <DbgStringToFlags+0xfc>
movl   $0x7fff,-0x4(%rbp)
jmp    1213 <DbgStringToFlags+0x103>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DbgStringToFlags>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
cmp    $0x61,%al
jne    1130 <DbgStringToFlags+0x20>
lea    0xedf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1181 <DbgStringToFlags+0x71>
mov    (%rbx),%al
cmp    $0x73,%al
jne    117a <DbgStringToFlags+0x6a>
lea    0xec9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1188 <DbgStringToFlags+0x78>
cmpb   $0x73,(%rbx)
jne    117a <DbgStringToFlags+0x6a>
lea    0xeb7(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     118f <DbgStringToFlags+0x7f>
cmpb   $0x73,(%rbx)
jne    117a <DbgStringToFlags+0x6a>
lea    0xe9b(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1196 <DbgStringToFlags+0x86>
mov    $0xffffffff,%eax
pop    %rbx
ret
mov    $0x1fff,%eax
pop    %rbx
ret
mov    $0x3fff,%eax
pop    %rbx
ret
mov    $0x5fff,%eax
pop    %rbx
ret
mov    $0x7fff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"all\00"
@.str.1 = [4 x i8] c"syn\00"
@.str.2 = [4 x i8] c"sem\00"
@.str.3 = [7 x i8] c"synsem\00"
define i32 @DbgStringToFlags(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = load i8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %7, %9
br i1 %10, label %11, label %16
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = 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 %16
15: ; preds = %11
store i32 8191, i32* %2
br label %56
16: ; preds = %11, %1
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = load i8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %20, %22
br i1 %23, label %24, label %29
24: ; preds = %16
%25 = load i8*, i8** %3
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %24
store i32 16383, i32* %2
br label %56
29: ; preds = %24, %16
%30 = load i8*, i8** %3
%31 = getelementptr inbounds i8, i8* %30, i64 0
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = load i8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %33, %35
br i1 %36, label %37, label %42
37: ; preds = %29
%38 = load i8*, i8** %3
%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 %41, label %42
41: ; preds = %37
store i32 24575, i32* %2
br label %56
42: ; preds = %37, %29
%43 = load i8*, i8** %3
%44 = getelementptr inbounds i8, i8* %43, i64 0
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = load i8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %46, %48
br i1 %49, label %50, label %55
50: ; preds = %42
%51 = load i8*, i8** %3
%52 = call i64 @strcmp(i8* %51, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %55
54: ; preds = %50
store i32 32767, i32* %2
br label %56
55: ; preds = %50, %42
store i32 -1, i32* %2
br label %56
56: ; preds = %55, %54, %41, %28, %15
%57 = load i32, i32* %2
ret i32 %57
}

LLVM IR (-O2):
@.str = [4 x i8] c"all\00"
@.str.1 = [4 x i8] c"syn\00"
@.str.2 = [4 x i8] c"sem\00"
@.str.3 = [7 x i8] c"synsem\00"
define i32 @DbgStringToFlags(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 97
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %28, label %7
7: ; preds = %4
%8 = load i8, i8* %0
br label %9
9: ; preds = %7, %1
%10 = phi i8 [ %8, %7 ], [ %2, %1 ]
%11 = icmp eq i8 %10, 115
br i1 %11, label %12, label %27
12: ; preds = %9
%13 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %28, label %15
15: ; preds = %12
%16 = load i8, i8* %0
%17 = icmp eq i8 %16, 115
br i1 %17, label %18, label %27
18: ; preds = %15
%19 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %28, label %21
21: ; preds = %18
%22 = load i8, i8* %0
%23 = icmp eq i8 %22, 115
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %9, %15, %24, %21
br label %28
28: ; preds = %24, %18, %12, %4, %27
%29 = phi i32 [ -1, %27 ], [ 8191, %4 ], [ 16383, %12 ], [ 24575, %18 ], [ 32767, %24 ]
ret i32 %29
}