#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 */
char tolower(char);
char fgaj_normalize_level(char level) {
  if (level >= 'A' && level <= 'Z')
    level = tolower(level);
  if (level == 't')
    return 10;
  if (level == 'd')
    return 20;
  if (level == 'i')
    return 30;
  if (level == 'w')
    return 40;
  if (level == 'e' || level == 'r')
    return 50;
  return level;
}


x86 assembly (clang, -O0):
<fgaj_normalize_level>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x41,%eax
jl     1144 <fgaj_normalize_level+0x34>
movsbl -0x2(%rbp),%eax
cmp    $0x5a,%eax
jg     1144 <fgaj_normalize_level+0x34>
movsbl -0x2(%rbp),%edi
call   1030 <tolower@plt>
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x74,%eax
jne    115a <fgaj_normalize_level+0x4a>
movb   $0xa,-0x1(%rbp)
jmp    11c5 <fgaj_normalize_level+0xb5>
movsbl -0x2(%rbp),%eax
cmp    $0x64,%eax
jne    1170 <fgaj_normalize_level+0x60>
movb   $0x14,-0x1(%rbp)
jmp    11c5 <fgaj_normalize_level+0xb5>
movsbl -0x2(%rbp),%eax
cmp    $0x69,%eax
jne    1186 <fgaj_normalize_level+0x76>
movb   $0x1e,-0x1(%rbp)
jmp    11c5 <fgaj_normalize_level+0xb5>
movsbl -0x2(%rbp),%eax
cmp    $0x77,%eax
jne    119c <fgaj_normalize_level+0x8c>
movb   $0x28,-0x1(%rbp)
jmp    11c5 <fgaj_normalize_level+0xb5>
movsbl -0x2(%rbp),%eax
cmp    $0x65,%eax
je     11b6 <fgaj_normalize_level+0xa6>
movsbl -0x2(%rbp),%eax
cmp    $0x72,%eax
jne    11bf <fgaj_normalize_level+0xaf>
movb   $0x32,-0x1(%rbp)
jmp    11c5 <fgaj_normalize_level+0xb5>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgaj_normalize_level>:
push   %rax
lea    -0x41(%rdi),%eax
cmp    $0x19,%al
ja     1123 <fgaj_normalize_level+0x13>
movsbl %dil,%edi
call   1030 <tolower@plt>
mov    %eax,%edi
lea    -0x64(%rdi),%ecx
cmp    $0x13,%cl
ja     1148 <fgaj_normalize_level+0x38>
mov    $0xa,%al
movzbl %cl,%ecx
lea    0xec9(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x32,%al
pop    %rcx
ret
mov    $0x14,%al
pop    %rcx
ret
mov    %edi,%eax
pop    %rcx
ret
mov    $0x28,%al
pop    %rcx
ret
mov    $0x1e,%al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @fgaj_normalize_level(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 65
br i1 %6, label %7, label %14
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 90
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i8, i8* %3
%13 = call signext i8 @tolower(i8 signext %12)
store i8 %13, i8* %3
br label %14
14: ; preds = %11, %7, %1
%15 = load i8, i8* %3
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 116
br i1 %17, label %18, label %19
18: ; preds = %14
store i8 10, i8* %2
br label %45
19: ; preds = %14
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 100
br i1 %22, label %23, label %24
23: ; preds = %19
store i8 20, i8* %2
br label %45
24: ; preds = %19
%25 = load i8, i8* %3
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 105
br i1 %27, label %28, label %29
28: ; preds = %24
store i8 30, i8* %2
br label %45
29: ; preds = %24
%30 = load i8, i8* %3
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 119
br i1 %32, label %33, label %34
33: ; preds = %29
store i8 40, i8* %2
br label %45
34: ; preds = %29
%35 = load i8, i8* %3
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 101
br i1 %37, label %42, label %38
38: ; preds = %34
%39 = load i8, i8* %3
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 114
br i1 %41, label %42, label %43
42: ; preds = %38, %34
store i8 50, i8* %2
br label %45
43: ; preds = %38
%44 = load i8, i8* %3
store i8 %44, i8* %2
br label %45
45: ; preds = %43, %42, %33, %28, %23, %18
%46 = load i8, i8* %2
ret i8 %46
}

LLVM IR (-O2):
define signext i8 @fgaj_normalize_level(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call signext i8 @tolower(i8 signext %0)
br label %6
6: ; preds = %4, %1
%7 = phi i8 [ %5, %4 ], [ %0, %1 ]
switch i8 %7, label %11 [
i8 116, label %13
i8 100, label %8
i8 105, label %9
i8 119, label %10
i8 114, label %12
i8 101, label %12
]
8: ; preds = %6
br label %13
9: ; preds = %6
br label %13
10: ; preds = %6
br label %13
11: ; preds = %6
br label %13
12: ; preds = %6, %6
br label %13
13: ; preds = %6, %12, %11, %10, %9, %8
%14 = phi i8 [ 20, %8 ], [ 30, %9 ], [ 40, %10 ], [ %7, %11 ], [ 10, %6 ], [ 50, %12 ]
ret i8 %14
}