#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 DbgStringToLevel(char *s) {
  if ((((s)[0] == ("off")[0]) && (strcmp((s), ("off")) == 0)))
    return (0);
  else if ((((s)[0] == ("bad")[0]) && (strcmp((s), ("bad")) == 0)))
    return (1);
  else if ((((s)[0] == ("ok")[0]) && (strcmp((s), ("ok")) == 0)))
    return (2);
  else if ((((s)[0] == ("detail")[0]) && (strcmp((s), ("detail")) == 0)))
    return (3);
  else if ((((s)[0] == ("hyper")[0]) && (strcmp((s), ("hyper")) == 0)))
    return (4);
  else
    return (-1);
}


x86 assembly (clang, -O0):
<DbgStringToLevel>:
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 <DbgStringToLevel+0x48>
mov    -0x10(%rbp),%rdi
lea    0xec3(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1158 <DbgStringToLevel+0x48>
movl   $0x0,-0x4(%rbp)
jmp    124f <DbgStringToLevel+0x13f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl 0xe9e(%rip),%ecx
cmp    %ecx,%eax
jne    1194 <DbgStringToLevel+0x84>
mov    -0x10(%rbp),%rdi
lea    0xe8b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1194 <DbgStringToLevel+0x84>
movl   $0x1,-0x4(%rbp)
jmp    124f <DbgStringToLevel+0x13f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl 0xe66(%rip),%ecx
cmp    %ecx,%eax
jne    11d0 <DbgStringToLevel+0xc0>
mov    -0x10(%rbp),%rdi
lea    0xe53(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11d0 <DbgStringToLevel+0xc0>
movl   $0x2,-0x4(%rbp)
jmp    124f <DbgStringToLevel+0x13f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl 0xe2d(%rip),%ecx
cmp    %ecx,%eax
jne    120c <DbgStringToLevel+0xfc>
mov    -0x10(%rbp),%rdi
lea    0xe1a(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    120c <DbgStringToLevel+0xfc>
movl   $0x3,-0x4(%rbp)
jmp    124f <DbgStringToLevel+0x13f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl 0xdf8(%rip),%ecx
cmp    %ecx,%eax
jne    1248 <DbgStringToLevel+0x138>
mov    -0x10(%rbp),%rdi
lea    0xde5(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1248 <DbgStringToLevel+0x138>
movl   $0x4,-0x4(%rbp)
jmp    124f <DbgStringToLevel+0x13f>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DbgStringToLevel>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
cmp    $0x6f,%al
jne    1130 <DbgStringToLevel+0x20>
lea    0xedf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     119d <DbgStringToLevel+0x8d>
mov    (%rbx),%al
cmp    $0x62,%al
jne    114a <DbgStringToLevel+0x3a>
lea    0xec9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11a1 <DbgStringToLevel+0x91>
mov    (%rbx),%al
cmp    $0x6f,%al
jne    1164 <DbgStringToLevel+0x54>
lea    0xeb3(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11a8 <DbgStringToLevel+0x98>
mov    (%rbx),%al
cmp    $0x64,%al
jne    117e <DbgStringToLevel+0x6e>
lea    0xe9c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11af <DbgStringToLevel+0x9f>
mov    (%rbx),%al
cmp    $0x68,%al
jne    1196 <DbgStringToLevel+0x86>
lea    0xe89(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11b6 <DbgStringToLevel+0xa6>
mov    $0xffffffff,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret
mov    $0x2,%eax
pop    %rbx
ret
mov    $0x3,%eax
pop    %rbx
ret
mov    $0x4,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"off\00"
@.str.1 = [4 x i8] c"bad\00"
@.str.2 = [3 x i8] c"ok\00"
@.str.3 = [7 x i8] c"detail\00"
@.str.4 = [6 x i8] c"hyper\00"
define i32 @DbgStringToLevel(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 0, i32* %2
br label %69
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 1, i32* %2
br label %69
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 ([3 x i8], [3 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 ([3 x i8], [3 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 2, i32* %2
br label %69
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 3, i32* %2
br label %69
55: ; preds = %50, %42
%56 = load i8*, i8** %3
%57 = getelementptr inbounds i8, i8* %56, i64 0
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = load i8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0)
%61 = sext i8 %60 to i32
%62 = icmp eq i32 %59, %61
br i1 %62, label %63, label %68
63: ; preds = %55
%64 = load i8*, i8** %3
%65 = call i64 @strcmp(i8* %64, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%66 = icmp eq i64 %65, 0
br i1 %66, label %67, label %68
67: ; preds = %63
store i32 4, i32* %2
br label %69
68: ; preds = %63, %55
store i32 -1, i32* %2
br label %69
69: ; preds = %68, %67, %54, %41, %28, %15
%70 = load i32, i32* %2
ret i32 %70
}

LLVM IR (-O2):
@.str = [4 x i8] c"off\00"
@.str.1 = [4 x i8] c"bad\00"
@.str.2 = [3 x i8] c"ok\00"
@.str.3 = [7 x i8] c"detail\00"
@.str.4 = [6 x i8] c"hyper\00"
define i32 @DbgStringToLevel(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 111
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 %40, 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, 98
br i1 %11, label %12, label %17
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 %40, label %15
15: ; preds = %12
%16 = load i8, i8* %0
br label %17
17: ; preds = %15, %9
%18 = phi i8 [ %16, %15 ], [ %10, %9 ]
%19 = icmp eq i8 %18, 111
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %40, label %23
23: ; preds = %20
%24 = load i8, i8* %0
br label %25
25: ; preds = %23, %17
%26 = phi i8 [ %24, %23 ], [ %18, %17 ]
%27 = icmp eq i8 %26, 100
br i1 %27, label %28, label %33
28: ; preds = %25
%29 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %40, label %31
31: ; preds = %28
%32 = load i8, i8* %0
br label %33
33: ; preds = %31, %25
%34 = phi i8 [ %32, %31 ], [ %26, %25 ]
%35 = icmp eq i8 %34, 104
br i1 %35, label %36, label %39
36: ; preds = %33
%37 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %40, label %39
39: ; preds = %36, %33
br label %40
40: ; preds = %36, %28, %20, %12, %4, %39
%41 = phi i32 [ -1, %39 ], [ 0, %4 ], [ 1, %12 ], [ 2, %20 ], [ 3, %28 ], [ 4, %36 ]
ret i32 %41
}