int which_module_number(char type) {
  char mods[] = {'W', 'X', 'Z', 'Y', '0', '1', '2',
                 '3', '4', '5', '6', '7', '8', '\0'};
  int nos[] = {0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 6, 7, 8, -1};
  int i;
  for (i = 0; mods[i] != '\0'; i++)
    if (mods[i] == type)
      return (nos[i]);
  return (-1);
}


x86 assembly (clang, -O0):
<which_module_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x13(%rbp)
mov    0xed9(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xed3(%rip),%ax
mov    %ax,-0x7(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xec8(%rip),%rsi
mov    $0x38,%edx
call   1030 <memcpy@plt>
movl   $0x0,-0x54(%rbp)
movslq -0x54(%rbp),%rax
movsbl -0x13(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11a3 <which_module_number+0x93>
movslq -0x54(%rbp),%rax
movsbl -0x13(%rbp,%rax,1),%eax
movsbl -0x5(%rbp),%ecx
cmp    %ecx,%eax
jne    1190 <which_module_number+0x80>
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%eax
mov    %eax,-0x4(%rbp)
jmp    11aa <which_module_number+0x9a>
jmp    1195 <which_module_number+0x85>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1159 <which_module_number+0x49>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<which_module_number>:
mov    $0xffffffff,%eax
add    $0xd0,%dil
cmp    $0x2a,%dil
ja     1181 <which_module_number+0x81>
xor    %ecx,%ecx
movzbl %dil,%edx
lea    0xee4(%rip),%rsi
movslq (%rsi,%rdx,4),%rdx
add    %rsi,%rdx
jmp    *%rdx
mov    $0x4,%ecx
jmp    1177 <which_module_number+0x77>
mov    $0x5,%ecx
jmp    1177 <which_module_number+0x77>
mov    $0x6,%ecx
jmp    1177 <which_module_number+0x77>
mov    $0x7,%ecx
jmp    1177 <which_module_number+0x77>
mov    $0x8,%ecx
jmp    1177 <which_module_number+0x77>
mov    $0x9,%ecx
jmp    1177 <which_module_number+0x77>
mov    $0xa,%ecx
jmp    1177 <which_module_number+0x77>
mov    $0xb,%ecx
jmp    1177 <which_module_number+0x77>
mov    $0xc,%ecx
jmp    1177 <which_module_number+0x77>
mov    $0x1,%ecx
jmp    1177 <which_module_number+0x77>
mov    $0x3,%ecx
jmp    1177 <which_module_number+0x77>
mov    $0x2,%ecx
lea    0xf32(%rip),%rax
mov    (%rax,%rcx,4),%eax
ret

LLVM IR (-O0):
@__const.which_module_number.mods = [14 x i8] c"WXZY012345678\00"
@__const.which_module_number.nos = [14 x i32] [i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 -1]
define i32 @which_module_number(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca [14 x i8]
%5 = alloca [14 x i32]
%6 = alloca i32
store i8 %0, i8* %3
%7 = bitcast [14 x i8]* %4 to i8*
%8 = bitcast [14 x i32]* %5 to i8*
store i32 0, i32* %6
br label %9
9: ; preds = %31, %1
%10 = load i32, i32* %6
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [14 x i8], [14 x i8]* %4, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %34
16: ; preds = %9
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [14 x i8], [14 x i8]* %4, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = load i8, i8* %3
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %21, %23
br i1 %24, label %25, label %30
25: ; preds = %16
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [14 x i32], [14 x i32]* %5, i64 0, i64 %27
%29 = load i32, i32* %28
store i32 %29, i32* %2
br label %35
30: ; preds = %16
br label %31
31: ; preds = %30
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %9
34: ; preds = %9
store i32 -1, i32* %2
br label %35
35: ; preds = %34, %25
%36 = load i32, i32* %2
ret i32 %36
}

LLVM IR (-O2):
@__const.which_module_number.nos = [14 x i32] [i32 0, i32 1, i32 2, i32 3, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 -1]
define i32 @which_module_number(i8 signext %0) {
switch i8 %0, label %18 [
i8 87, label %14
i8 88, label %2
i8 90, label %3
i8 89, label %4
i8 48, label %5
i8 49, label %6
i8 50, label %7
i8 51, label %8
i8 52, label %9
i8 53, label %10
i8 54, label %11
i8 55, label %12
i8 56, label %13
]
2: ; preds = %1
br label %14
3: ; preds = %1
br label %14
4: ; preds = %1
br label %14
5: ; preds = %1
br label %14
6: ; preds = %1
br label %14
7: ; preds = %1
br label %14
8: ; preds = %1
br label %14
9: ; preds = %1
br label %14
10: ; preds = %1
br label %14
11: ; preds = %1
br label %14
12: ; preds = %1
br label %14
13: ; preds = %1
br label %14
14: ; preds = %1, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%15 = phi i64 [ 0, %1 ], [ 1, %2 ], [ 2, %3 ], [ 3, %4 ], [ 4, %5 ], [ 5, %6 ], [ 6, %7 ], [ 7, %8 ], [ 8, %9 ], [ 9, %10 ], [ 10, %11 ], [ 11, %12 ], [ 12, %13 ]
%16 = getelementptr inbounds [14 x i32], [14 x i32]* @__const.which_module_number.nos, i64 0, i64 %15
%17 = load i32, i32* %16
br label %18
18: ; preds = %1, %14
%19 = phi i32 [ %17, %14 ], [ -1, %1 ]
ret i32 %19
}