#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 */
int /*<<< orphan*/ strcasecmp(char const *, char *);
long toMonth(const char *str) {
  if (str == NULL)
    return 0;
  if (!strcasecmp(str, "jan"))
    return 1;
  else if (!strcasecmp(str, "feb"))
    return 2;
  else if (!strcasecmp(str, "mar"))
    return 3;
  else if (!strcasecmp(str, "apr"))
    return 4;
  else if (!strcasecmp(str, "may"))
    return 5;
  else if (!strcasecmp(str, "jun"))
    return 6;
  else if (!strcasecmp(str, "jul"))
    return 7;
  else if (!strcasecmp(str, "aug"))
    return 8;
  else if (!strcasecmp(str, "sep"))
    return 9;
  else if (!strcasecmp(str, "oct"))
    return 10;
  else if (!strcasecmp(str, "nov"))
    return 11;
  else if (!strcasecmp(str, "dec"))
    return 12;
  else
    return 0;
}


x86 assembly (clang, -O0):
<toMonth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1134 <toMonth+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1304 <toMonth+0x1f4>
mov    -0x10(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    115a <toMonth+0x4a>
movq   $0x1,-0x8(%rbp)
jmp    1304 <toMonth+0x1f4>
mov    -0x10(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1180 <toMonth+0x70>
movq   $0x2,-0x8(%rbp)
jmp    1304 <toMonth+0x1f4>
mov    -0x10(%rbp),%rdi
lea    0xe7d(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    11a6 <toMonth+0x96>
movq   $0x3,-0x8(%rbp)
jmp    1304 <toMonth+0x1f4>
mov    -0x10(%rbp),%rdi
lea    0xe5b(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    11cc <toMonth+0xbc>
movq   $0x4,-0x8(%rbp)
jmp    1304 <toMonth+0x1f4>
mov    -0x10(%rbp),%rdi
lea    0xe39(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    11f2 <toMonth+0xe2>
movq   $0x5,-0x8(%rbp)
jmp    1304 <toMonth+0x1f4>
mov    -0x10(%rbp),%rdi
lea    0xe17(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1218 <toMonth+0x108>
movq   $0x6,-0x8(%rbp)
jmp    1304 <toMonth+0x1f4>
mov    -0x10(%rbp),%rdi
lea    0xdf5(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    123e <toMonth+0x12e>
movq   $0x7,-0x8(%rbp)
jmp    1304 <toMonth+0x1f4>
mov    -0x10(%rbp),%rdi
lea    0xdd3(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1264 <toMonth+0x154>
movq   $0x8,-0x8(%rbp)
jmp    1304 <toMonth+0x1f4>
mov    -0x10(%rbp),%rdi
lea    0xdb1(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    128a <toMonth+0x17a>
movq   $0x9,-0x8(%rbp)
jmp    1304 <toMonth+0x1f4>
mov    -0x10(%rbp),%rdi
lea    0xd8f(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    12b0 <toMonth+0x1a0>
movq   $0xa,-0x8(%rbp)
jmp    1304 <toMonth+0x1f4>
mov    -0x10(%rbp),%rdi
lea    0xd6d(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    12d6 <toMonth+0x1c6>
movq   $0xb,-0x8(%rbp)
jmp    1304 <toMonth+0x1f4>
mov    -0x10(%rbp),%rdi
lea    0xd4b(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    12fc <toMonth+0x1ec>
movq   $0xc,-0x8(%rbp)
jmp    1304 <toMonth+0x1f4>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<toMonth>:
push   %rbx
test   %rdi,%rdi
je     122d <toMonth+0x11d>
mov    %rdi,%rbx
lea    0xedc(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1231 <toMonth+0x121>
lea    0xecc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1238 <toMonth+0x128>
lea    0xeb9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     123f <toMonth+0x12f>
lea    0xea6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1246 <toMonth+0x136>
lea    0xe93(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     124d <toMonth+0x13d>
lea    0xe80(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1254 <toMonth+0x144>
lea    0xe6d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     125b <toMonth+0x14b>
lea    0xe5a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1262 <toMonth+0x152>
lea    0xe47(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1269 <toMonth+0x159>
lea    0xe34(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1270 <toMonth+0x160>
lea    0xe25(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1277 <toMonth+0x167>
lea    0xe16(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
mov    $0xc,%eax
cmovne %rcx,%rax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret
mov    $0x2,%eax
pop    %rbx
ret
mov    $0x3,%eax
pop    %rbx
ret
mov    $0x4,%eax
pop    %rbx
ret
mov    $0x5,%eax
pop    %rbx
ret
mov    $0x6,%eax
pop    %rbx
ret
mov    $0x7,%eax
pop    %rbx
ret
mov    $0x8,%eax
pop    %rbx
ret
mov    $0x9,%eax
pop    %rbx
ret
mov    $0xa,%eax
pop    %rbx
ret
mov    $0xb,%eax
pop    %rbx
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 i64 @toMonth(i8* %0) {
%2 = alloca i64
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
store i64 0, i64* %2
br label %68
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @strcasecmp(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %7
store i64 1, i64* %2
br label %68
12: ; preds = %7
%13 = load i8*, i8** %3
%14 = call i32 @strcasecmp(i8* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %12
store i64 2, i64* %2
br label %68
17: ; preds = %12
%18 = load i8*, i8** %3
%19 = call i32 @strcasecmp(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %17
store i64 3, i64* %2
br label %68
22: ; preds = %17
%23 = load i8*, i8** %3
%24 = call i32 @strcasecmp(i8* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %22
store i64 4, i64* %2
br label %68
27: ; preds = %22
%28 = load i8*, i8** %3
%29 = call i32 @strcasecmp(i8* %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%30 = icmp ne i32 %29, 0
br i1 %30, label %32, label %31
31: ; preds = %27
store i64 5, i64* %2
br label %68
32: ; preds = %27
%33 = load i8*, i8** %3
%34 = call i32 @strcasecmp(i8* %33, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%35 = icmp ne i32 %34, 0
br i1 %35, label %37, label %36
36: ; preds = %32
store i64 6, i64* %2
br label %68
37: ; preds = %32
%38 = load i8*, i8** %3
%39 = call i32 @strcasecmp(i8* %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%40 = icmp ne i32 %39, 0
br i1 %40, label %42, label %41
41: ; preds = %37
store i64 7, i64* %2
br label %68
42: ; preds = %37
%43 = load i8*, i8** %3
%44 = call i32 @strcasecmp(i8* %43, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%45 = icmp ne i32 %44, 0
br i1 %45, label %47, label %46
46: ; preds = %42
store i64 8, i64* %2
br label %68
47: ; preds = %42
%48 = load i8*, i8** %3
%49 = call i32 @strcasecmp(i8* %48, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%50 = icmp ne i32 %49, 0
br i1 %50, label %52, label %51
51: ; preds = %47
store i64 9, i64* %2
br label %68
52: ; preds = %47
%53 = load i8*, i8** %3
%54 = call i32 @strcasecmp(i8* %53, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%55 = icmp ne i32 %54, 0
br i1 %55, label %57, label %56
56: ; preds = %52
store i64 10, i64* %2
br label %68
57: ; preds = %52
%58 = load i8*, i8** %3
%59 = call i32 @strcasecmp(i8* %58, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%60 = icmp ne i32 %59, 0
br i1 %60, label %62, label %61
61: ; preds = %57
store i64 11, i64* %2
br label %68
62: ; preds = %57
%63 = load i8*, i8** %3
%64 = call i32 @strcasecmp(i8* %63, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%65 = icmp ne i32 %64, 0
br i1 %65, label %67, label %66
66: ; preds = %62
store i64 12, i64* %2
br label %68
67: ; preds = %62
store i64 0, i64* %2
br label %68
68: ; preds = %67, %66, %61, %56, %51, %46, %41, %36, %31, %26, %21, %16, %11, %6
%69 = load i64, i64* %2
ret i64 %69
}

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"
@.str.11 = [4 x i8] c"dec\00"
define i64 @toMonth(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %40, label %3
3: ; preds = %1
%4 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %40, label %6
6: ; preds = %3
%7 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %40, label %9
9: ; preds = %6
%10 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %40, label %12
12: ; preds = %9
%13 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %40, label %15
15: ; preds = %12
%16 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %40, label %18
18: ; preds = %15
%19 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %40, label %21
21: ; preds = %18
%22 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%23 = icmp eq i32 %22, 0
br i1 %23, label %40, label %24
24: ; preds = %21
%25 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%26 = icmp eq i32 %25, 0
br i1 %26, label %40, label %27
27: ; preds = %24
%28 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%29 = icmp eq i32 %28, 0
br i1 %29, label %40, label %30
30: ; preds = %27
%31 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%32 = icmp eq i32 %31, 0
br i1 %32, label %40, label %33
33: ; preds = %30
%34 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%35 = icmp eq i32 %34, 0
br i1 %35, label %40, label %36
36: ; preds = %33
%37 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%38 = icmp eq i32 %37, 0
%39 = select i1 %38, i64 12, i64 0
br label %40
40: ; preds = %36, %33, %30, %27, %24, %21, %18, %15, %12, %9, %6, %3, %1
%41 = phi i64 [ 0, %1 ], [ 1, %3 ], [ 2, %6 ], [ 3, %9 ], [ 4, %12 ], [ 5, %15 ], [ 6, %18 ], [ 7, %21 ], [ 8, %24 ], [ 9, %27 ], [ 10, %30 ], [ 11, %33 ], [ %39, %36 ]
ret i64 %41
}