int CompilerMonth(const char *date) {
  int Month = 1;
  switch (date[0]) {
  case 'J':
    Month = (date[1] == 'a') ? 1 : ((date[2] == 'n') ? 6 : 7);
    break;
  case 'F':
    Month = 2;
    break;
  case 'A':
    Month = date[2] == 'r' ? 4 : 8;
    break;
  case 'M':
    Month = date[2] == 'r' ? 3 : 5;
    break;
  case 'S':
    Month = 9;
    break;
  case 'O':
    Month = 10;
    break;
  case 'N':
    Month = 11;
    break;
  case 'D':
    Month = 12;
    break;
  }
  return Month;
}


x86 assembly (clang, -O0):
<CompilerMonth>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x12,%eax
ja     11f7 <CompilerMonth+0xf7>
mov    -0x18(%rbp),%rax
lea    0xecd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x61,%eax
jne    115a <CompilerMonth+0x5a>
mov    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1175 <CompilerMonth+0x75>
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%edx
mov    $0x7,%eax
mov    $0x6,%ecx
cmp    $0x6e,%edx
cmove  %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11f7 <CompilerMonth+0xf7>
movl   $0x2,-0xc(%rbp)
jmp    11f7 <CompilerMonth+0xf7>
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%edx
mov    $0x8,%eax
mov    $0x4,%ecx
cmp    $0x72,%edx
cmove  %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    11f7 <CompilerMonth+0xf7>
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%edx
mov    $0x5,%eax
mov    $0x3,%ecx
cmp    $0x72,%edx
cmove  %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    11f7 <CompilerMonth+0xf7>
movl   $0x9,-0xc(%rbp)
jmp    11f7 <CompilerMonth+0xf7>
movl   $0xa,-0xc(%rbp)
jmp    11f7 <CompilerMonth+0xf7>
movl   $0xb,-0xc(%rbp)
jmp    11f7 <CompilerMonth+0xf7>
movl   $0xc,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CompilerMonth>:
movsbl (%rdi),%ecx
mov    $0x1,%eax
add    $0xffffffbf,%ecx
cmp    $0x12,%ecx
ja     1156 <CompilerMonth+0x56>
lea    0xee9(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
xor    %eax,%eax
cmpb   $0x72,0x2(%rdi)
setne  %al
lea    0x4(,%rax,4),%eax
ret
mov    $0xc,%eax
jmp    1156 <CompilerMonth+0x56>
mov    $0x2,%eax
ret
mov    $0xb,%eax
ret
mov    $0xa,%eax
ret
mov    $0x9,%eax
ret
cmpb   $0x61,0x1(%rdi)
jne    1166 <CompilerMonth+0x66>
ret
xor    %eax,%eax
cmpb   $0x72,0x2(%rdi)
setne  %al
add    %eax,%eax
add    $0x3,%eax
ret
xor    %eax,%eax
cmpb   $0x6e,0x2(%rdi)
sete   %al
xor    $0x7,%eax
ret

LLVM IR (-O0):
define i32 @CompilerMonth(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 1, i32* %3
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
switch i32 %7, label %46 [
i32 74, label %8
i32 70, label %25
i32 65, label %26
i32 77, label %34
i32 83, label %42
i32 79, label %43
i32 78, label %44
i32 68, label %45
]
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 97
br i1 %13, label %14, label %15
14: ; preds = %8
br label %23
15: ; preds = %8
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i64 2
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 110
%21 = zext i1 %20 to i64
%22 = select i1 %20, i32 6, i32 7
br label %23
23: ; preds = %15, %14
%24 = phi i32 [ 1, %14 ], [ %22, %15 ]
store i32 %24, i32* %3
br label %46
25: ; preds = %1
store i32 2, i32* %3
br label %46
26: ; preds = %1
%27 = load i8*, i8** %2
%28 = getelementptr inbounds i8, i8* %27, i64 2
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 114
%32 = zext i1 %31 to i64
%33 = select i1 %31, i32 4, i32 8
store i32 %33, i32* %3
br label %46
34: ; preds = %1
%35 = load i8*, i8** %2
%36 = getelementptr inbounds i8, i8* %35, i64 2
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 114
%40 = zext i1 %39 to i64
%41 = select i1 %39, i32 3, i32 5
store i32 %41, i32* %3
br label %46
42: ; preds = %1
store i32 9, i32* %3
br label %46
43: ; preds = %1
store i32 10, i32* %3
br label %46
44: ; preds = %1
store i32 11, i32* %3
br label %46
45: ; preds = %1
store i32 12, i32* %3
br label %46
46: ; preds = %1, %45, %44, %43, %42, %34, %26, %25, %23
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
define i32 @CompilerMonth(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
switch i32 %3, label %28 [
i32 74, label %4
i32 70, label %13
i32 65, label %14
i32 77, label %19
i32 83, label %24
i32 79, label %25
i32 78, label %26
i32 68, label %27
]
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 97
br i1 %7, label %28, label %8
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 110
%12 = select i1 %11, i32 6, i32 7
br label %28
13: ; preds = %1
br label %28
14: ; preds = %1
%15 = getelementptr inbounds i8, i8* %0, i64 2
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 114
%18 = select i1 %17, i32 4, i32 8
br label %28
19: ; preds = %1
%20 = getelementptr inbounds i8, i8* %0, i64 2
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 114
%23 = select i1 %22, i32 3, i32 5
br label %28
24: ; preds = %1
br label %28
25: ; preds = %1
br label %28
26: ; preds = %1
br label %28
27: ; preds = %1
br label %28
28: ; preds = %8, %4, %1, %27, %26, %25, %24, %19, %14, %13
%29 = phi i32 [ 1, %1 ], [ 12, %27 ], [ 11, %26 ], [ 10, %25 ], [ 9, %24 ], [ %23, %19 ], [ %18, %14 ], [ 2, %13 ], [ %12, %8 ], [ 1, %4 ]
ret i32 %29
}