#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 */
unsigned int ControlMask;
unsigned int ShiftMask;
unsigned int getmodnumber(char);
unsigned int getmodmask(char *c) {
  switch (c[0]) {
  case 'C':
    return ControlMask;
  case 'S':
    return ShiftMask;
  case 'M':
    return getmodnumber(c[1]);
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<getmodmask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
sub    $0x43,%eax
je     1156 <getmodmask+0x46>
jmp    1134 <getmodmask+0x24>
mov    -0x14(%rbp),%eax
sub    $0x4d,%eax
je     1178 <getmodmask+0x68>
jmp    1145 <getmodmask+0x35>
mov    -0x14(%rbp),%eax
sub    $0x53,%eax
je     1167 <getmodmask+0x57>
jmp    118d <getmodmask+0x7d>
mov    0x2e83(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1194 <getmodmask+0x84>
mov    0x2e7a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1194 <getmodmask+0x84>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <getmodnumber@plt>
mov    %eax,-0x4(%rbp)
jmp    1194 <getmodmask+0x84>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getmodmask>:
movsbl (%rdi),%ecx
cmp    $0x53,%ecx
je     112d <getmodmask+0x1d>
cmp    $0x4d,%ecx
je     1137 <getmodmask+0x27>
xor    %eax,%eax
cmp    $0x43,%ecx
jne    1136 <getmodmask+0x26>
mov    0x2eb5(%rip),%rax
jmp    1134 <getmodmask+0x24>
mov    0x2eb4(%rip),%rax
mov    (%rax),%eax
ret
movsbl 0x1(%rdi),%edi
jmp    1030 <getmodnumber@plt>

LLVM IR (-O0):
@ControlMask = global i32 0
@ShiftMask = global i32 0
define i32 @getmodmask(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
switch i32 %7, label %17 [
i32 67, label %8
i32 83, label %10
i32 77, label %12
]
8: ; preds = %1
%9 = load i32, i32* @ControlMask
store i32 %9, i32* %2
br label %18
10: ; preds = %1
%11 = load i32, i32* @ShiftMask
store i32 %11, i32* %2
br label %18
12: ; preds = %1
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = load i8, i8* %14
%16 = call i32 @getmodnumber(i8 signext %15)
store i32 %16, i32* %2
br label %18
17: ; preds = %1
store i32 0, i32* %2
br label %18
18: ; preds = %17, %12, %10, %8
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@ControlMask = global i32 0
@ShiftMask = global i32 0
define i32 @getmodmask(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
switch i32 %3, label %12 [
i32 67, label %4
i32 83, label %6
i32 77, label %8
]
4: ; preds = %1
%5 = load i32, i32* @ControlMask
br label %12
6: ; preds = %1
%7 = load i32, i32* @ShiftMask
br label %12
8: ; preds = %1
%9 = getelementptr inbounds i8, i8* %0, i64 1
%10 = load i8, i8* %9
%11 = tail call i32 @getmodnumber(i8 signext %10)
br label %12
12: ; preds = %1, %8, %6, %4
%13 = phi i32 [ %11, %8 ], [ %7, %6 ], [ %5, %4 ], [ 0, %1 ]
ret i32 %13
}