#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 atoi(char const *);
scalar_t__ strncasecmp(char const *, char *, int);
int getMonth(const char *month) {
  char *mon[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
                 "Aug", "Sep", "Oct", "Nov", "Dec", NULL};
  int i;
  for (i = 0; mon[i] != NULL; i++)
    if (strncasecmp(month, mon[i], 3) == 0)
      return (i + 1);
  return (atoi(month));
}


x86 assembly (clang, -O0):
<getMonth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
lea    0x2c66(%rip),%rsi
mov    $0x68,%edx
call   1030 <memcpy@plt>
movl   $0x0,-0x84(%rbp)
movslq -0x84(%rbp),%rax
cmpq   $0x0,-0x80(%rbp,%rax,8)
je     11bf <getMonth+0x8f>
mov    -0x10(%rbp),%rdi
movslq -0x84(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rsi
mov    $0x3,%edx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    11a6 <getMonth+0x76>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11cb <getMonth+0x9b>
jmp    11ab <getMonth+0x7b>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    115e <getMonth+0x2e>
mov    -0x10(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getMonth>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed3(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
test   %rax,%rax
je     1286 <getMonth+0x166>
lea    0xebd(%rip),%rsi
mov    $0x3,%ebp
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
test   %rax,%rax
je     128d <getMonth+0x16d>
lea    0xe9f(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
test   %rax,%rax
je     12d1 <getMonth+0x1b1>
lea    0xe86(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
test   %rax,%rax
je     1294 <getMonth+0x174>
lea    0xe6d(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
test   %rax,%rax
je     129b <getMonth+0x17b>
lea    0xe54(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
test   %rax,%rax
je     12a2 <getMonth+0x182>
lea    0xe3b(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
test   %rax,%rax
je     12a9 <getMonth+0x189>
lea    0xe22(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
test   %rax,%rax
je     12b0 <getMonth+0x190>
lea    0xe09(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
test   %rax,%rax
je     12b7 <getMonth+0x197>
lea    0xdf0(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
test   %rax,%rax
je     12be <getMonth+0x19e>
lea    0xddb(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
test   %rax,%rax
je     12c5 <getMonth+0x1a5>
lea    0xdc6(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
test   %rax,%rax
je     12cc <getMonth+0x1ac>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <atoi@plt>
mov    $0x1,%ebp
jmp    12d1 <getMonth+0x1b1>
mov    $0x2,%ebp
jmp    12d1 <getMonth+0x1b1>
mov    $0x4,%ebp
jmp    12d1 <getMonth+0x1b1>
mov    $0x5,%ebp
jmp    12d1 <getMonth+0x1b1>
mov    $0x6,%ebp
jmp    12d1 <getMonth+0x1b1>
mov    $0x7,%ebp
jmp    12d1 <getMonth+0x1b1>
mov    $0x8,%ebp
jmp    12d1 <getMonth+0x1b1>
mov    $0x9,%ebp
jmp    12d1 <getMonth+0x1b1>
mov    $0xa,%ebp
jmp    12d1 <getMonth+0x1b1>
mov    $0xb,%ebp
jmp    12d1 <getMonth+0x1b1>
mov    $0xc,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
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"
@__const.getMonth.mon = [13 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i32 0, i32 0), i8* null]
define i32 @getMonth(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [13 x i8*]
%5 = alloca i32
store i8* %0, i8** %3
%6 = bitcast [13 x i8*]* %4 to i8*
store i32 0, i32* %5
br label %7
7: ; preds = %25, %1
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [13 x i8*], [13 x i8*]* %4, i64 0, i64 %9
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %28
13: ; preds = %7
%14 = load i8*, i8** %3
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [13 x i8*], [13 x i8*]* %4, i64 0, i64 %16
%18 = load i8*, i8** %17
%19 = call i64 @strncasecmp(i8* %14, i8* %18, i32 3)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %13
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %31
24: ; preds = %13
br label %25
25: ; preds = %24
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %7
28: ; preds = %7
%29 = load i8*, i8** %3
%30 = call i32 @atoi(i8* %29)
store i32 %30, i32* %2
br label %31
31: ; preds = %28, %21
%32 = load i32, i32* %2
ret i32 %32
}

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