int month_to_i(char *month) {
  if (month == "JAN")
    return 1;
  if (month == "FEB")
    return 2;
  if (month == "MAR")
    return 3;
  if (month == "APR")
    return 4;
  if (month == "MAY")
    return 5;
  if (month == "JUN")
    return 6;
  if (month == "JUL")
    return 7;
  if (month == "AUG")
    return 8;
  if (month == "SEP")
    return 9;
  if (month == "OCT")
    return 10;
  if (month == "NOV")
    return 11;
  if (month == "DEC")
    return 12;
}


x86 assembly (clang, -O0):
<month_to_i>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
lea    0xef1(%rip),%rax
cmp    %rax,-0x10(%rbp)
jne    1125 <month_to_i+0x25>
movl   $0x1,-0x4(%rbp)
jmp    125f <month_to_i+0x15f>
lea    0xed8(%rip),%rax
cmp    %rax,-0x10(%rbp)
jne    1142 <month_to_i+0x42>
movl   $0x2,-0x4(%rbp)
jmp    125f <month_to_i+0x15f>
lea    0xebf(%rip),%rax
cmp    %rax,-0x10(%rbp)
jne    115f <month_to_i+0x5f>
movl   $0x3,-0x4(%rbp)
jmp    125f <month_to_i+0x15f>
lea    0xea6(%rip),%rax
cmp    %rax,-0x10(%rbp)
jne    117c <month_to_i+0x7c>
movl   $0x4,-0x4(%rbp)
jmp    125f <month_to_i+0x15f>
lea    0xe8d(%rip),%rax
cmp    %rax,-0x10(%rbp)
jne    1199 <month_to_i+0x99>
movl   $0x5,-0x4(%rbp)
jmp    125f <month_to_i+0x15f>
lea    0xe74(%rip),%rax
cmp    %rax,-0x10(%rbp)
jne    11b6 <month_to_i+0xb6>
movl   $0x6,-0x4(%rbp)
jmp    125f <month_to_i+0x15f>
lea    0xe5b(%rip),%rax
cmp    %rax,-0x10(%rbp)
jne    11d3 <month_to_i+0xd3>
movl   $0x7,-0x4(%rbp)
jmp    125f <month_to_i+0x15f>
lea    0xe42(%rip),%rax
cmp    %rax,-0x10(%rbp)
jne    11f0 <month_to_i+0xf0>
movl   $0x8,-0x4(%rbp)
jmp    125f <month_to_i+0x15f>
lea    0xe29(%rip),%rax
cmp    %rax,-0x10(%rbp)
jne    120d <month_to_i+0x10d>
movl   $0x9,-0x4(%rbp)
jmp    125f <month_to_i+0x15f>
lea    0xe10(%rip),%rax
cmp    %rax,-0x10(%rbp)
jne    122a <month_to_i+0x12a>
movl   $0xa,-0x4(%rbp)
jmp    125f <month_to_i+0x15f>
lea    0xdf7(%rip),%rax
cmp    %rax,-0x10(%rbp)
jne    1247 <month_to_i+0x147>
movl   $0xb,-0x4(%rbp)
jmp    125f <month_to_i+0x15f>
lea    0xdde(%rip),%rax
cmp    %rax,-0x10(%rbp)
jne    125f <month_to_i+0x15f>
movl   $0xc,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<month_to_i>:
lea    0xef9(%rip),%rax
cmp    %rax,%rdi
je     1193 <month_to_i+0x93>
lea    0xeed(%rip),%rax
cmp    %rax,%rdi
je     1199 <month_to_i+0x99>
lea    0xee5(%rip),%rax
cmp    %rax,%rdi
je     119f <month_to_i+0x9f>
lea    0xedd(%rip),%rax
cmp    %rax,%rdi
je     11a5 <month_to_i+0xa5>
lea    0xed5(%rip),%rax
cmp    %rax,%rdi
je     11ab <month_to_i+0xab>
lea    0xecd(%rip),%rax
cmp    %rax,%rdi
je     11b1 <month_to_i+0xb1>
lea    0xec5(%rip),%rax
cmp    %rax,%rdi
je     11b7 <month_to_i+0xb7>
lea    0xebd(%rip),%rax
cmp    %rax,%rdi
je     11bd <month_to_i+0xbd>
lea    0xeb5(%rip),%rax
cmp    %rax,%rdi
je     11c3 <month_to_i+0xc3>
lea    0xead(%rip),%rax
cmp    %rax,%rdi
je     11c9 <month_to_i+0xc9>
lea    0xea5(%rip),%rax
xor    %ecx,%ecx
cmp    %rax,%rdi
sete   %cl
mov    $0xc,%eax
sub    %ecx,%eax
ret
mov    $0x1,%eax
ret
mov    $0x2,%eax
ret
mov    $0x3,%eax
ret
mov    $0x4,%eax
ret
mov    $0x5,%eax
ret
mov    $0x6,%eax
ret
mov    $0x7,%eax
ret
mov    $0x8,%eax
ret
mov    $0x9,%eax
ret
mov    $0xa,%eax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"JAN\00"
@.str.1 = [4 x i8] c"FEB\00"
@.str.2 = [4 x i8] c"MAR\00"
@.str.3 = [4 x i8] c"APR\00"
@.str.4 = [4 x i8] c"MAY\00"
@.str.5 = [4 x i8] c"JUN\00"
@.str.6 = [4 x i8] c"JUL\00"
@.str.7 = [4 x i8] c"AUG\00"
@.str.8 = [4 x i8] c"SEP\00"
@.str.9 = [4 x i8] c"OCT\00"
@.str.10 = [4 x i8] c"NOV\00"
@.str.11 = [4 x i8] c"DEC\00"
define i32 @month_to_i(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %51
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = icmp eq i8* %8, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 2, i32* %2
br label %51
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = icmp eq i8* %12, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 3, i32* %2
br label %51
15: ; preds = %11
%16 = load i8*, i8** %3
%17 = icmp eq i8* %16, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 4, i32* %2
br label %51
19: ; preds = %15
%20 = load i8*, i8** %3
%21 = icmp eq i8* %20, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 5, i32* %2
br label %51
23: ; preds = %19
%24 = load i8*, i8** %3
%25 = icmp eq i8* %24, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0)
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 6, i32* %2
br label %51
27: ; preds = %23
%28 = load i8*, i8** %3
%29 = icmp eq i8* %28, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0)
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 7, i32* %2
br label %51
31: ; preds = %27
%32 = load i8*, i8** %3
%33 = icmp eq i8* %32, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0)
br i1 %33, label %34, label %35
34: ; preds = %31
store i32 8, i32* %2
br label %51
35: ; preds = %31
%36 = load i8*, i8** %3
%37 = icmp eq i8* %36, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0)
br i1 %37, label %38, label %39
38: ; preds = %35
store i32 9, i32* %2
br label %51
39: ; preds = %35
%40 = load i8*, i8** %3
%41 = icmp eq i8* %40, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0)
br i1 %41, label %42, label %43
42: ; preds = %39
store i32 10, i32* %2
br label %51
43: ; preds = %39
%44 = load i8*, i8** %3
%45 = icmp eq i8* %44, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0)
br i1 %45, label %46, label %47
46: ; preds = %43
store i32 11, i32* %2
br label %51
47: ; preds = %43
%48 = load i8*, i8** %3
%49 = icmp eq i8* %48, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0)
br i1 %49, label %50, label %51
50: ; preds = %47
store i32 12, i32* %2
br label %51
51: ; preds = %6, %10, %14, %18, %22, %26, %30, %34, %38, %42, %46, %50, %47
%52 = load i32, i32* %2
ret i32 %52
}

LLVM IR (-O2):
@.str = [4 x i8] c"JAN\00"
@.str.1 = [4 x i8] c"FEB\00"
@.str.2 = [4 x i8] c"MAR\00"
@.str.3 = [4 x i8] c"APR\00"
@.str.4 = [4 x i8] c"MAY\00"
@.str.5 = [4 x i8] c"JUN\00"
@.str.6 = [4 x i8] c"JUL\00"
@.str.7 = [4 x i8] c"AUG\00"
@.str.8 = [4 x i8] c"SEP\00"
@.str.9 = [4 x i8] c"OCT\00"
@.str.10 = [4 x i8] c"NOV\00"
define i32 @month_to_i(i8* readnone %0) {
%2 = icmp eq i8* %0, getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
br i1 %2, label %24, label %3
3: ; preds = %1
%4 = icmp eq i8* %0, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
br i1 %4, label %24, label %5
5: ; preds = %3
%6 = icmp eq i8* %0, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
br i1 %6, label %24, label %7
7: ; preds = %5
%8 = icmp eq i8* %0, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
br i1 %8, label %24, label %9
9: ; preds = %7
%10 = icmp eq i8* %0, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
br i1 %10, label %24, label %11
11: ; preds = %9
%12 = icmp eq i8* %0, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0)
br i1 %12, label %24, label %13
13: ; preds = %11
%14 = icmp eq i8* %0, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0)
br i1 %14, label %24, label %15
15: ; preds = %13
%16 = icmp eq i8* %0, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0)
br i1 %16, label %24, label %17
17: ; preds = %15
%18 = icmp eq i8* %0, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0)
br i1 %18, label %24, label %19
19: ; preds = %17
%20 = icmp eq i8* %0, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0)
br i1 %20, label %24, label %21
21: ; preds = %19
%22 = icmp eq i8* %0, getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0)
%23 = select i1 %22, i32 11, i32 12
br label %24
24: ; preds = %21, %19, %17, %15, %13, %11, %9, %7, %5, %3, %1
%25 = phi i32 [ 1, %1 ], [ 2, %3 ], [ 3, %5 ], [ 4, %7 ], [ 5, %9 ], [ 6, %11 ], [ 7, %13 ], [ 8, %15 ], [ 9, %17 ], [ 10, %19 ], [ %23, %21 ]
ret i32 %25
}