#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 */
scalar_t__ strcasecmp(char *, char *);
int get_month_integer(char *month_string) {
  char *month_string_array[] = {"january",   "february", "march",    "april",
                                "may",       "june",     "july",     "august",
                                "september", "october",  "november", "december",
                                (char *)0};
  char **compare_month_pointer = month_string_array;
  int month_integer = 1;
  while (**compare_month_pointer) {
    if (strcasecmp(month_string, *compare_month_pointer) == 0)
      return month_integer;
    compare_month_pointer++;
    month_integer++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<get_month_integer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
lea    0x2c76(%rip),%rsi
mov    $0x68,%edx
call   1040 <memcpy@plt>
lea    -0x80(%rbp),%rax
mov    %rax,-0x88(%rbp)
movl   $0x1,-0x8c(%rbp)
mov    -0x88(%rbp),%rax
mov    (%rax),%rax
cmpb   $0x0,(%rax)
je     11bd <get_month_integer+0x9d>
mov    -0x10(%rbp),%rdi
mov    -0x88(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1197 <get_month_integer+0x77>
mov    -0x8c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11c4 <get_month_integer+0xa4>
mov    -0x88(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x88(%rbp)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    1159 <get_month_integer+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_month_integer>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rdi,%r14
mov    0x2cef(%rip),%rax
mov    %rax,0x60(%rsp)
movaps 0x2cd3(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0x2cb7(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0x2c9b(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0x2c7f(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x2c63(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x2c47(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xe8c(%rip),%rsi
mov    $0x1,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     119c <get_month_integer+0x8c>
mov    (%rsp,%rbx,8),%rsi
add    $0x1,%rbx
cmpb   $0x0,(%rsi)
jne    1180 <get_month_integer+0x70>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"january\00"
@.str.1 = [9 x i8] c"february\00"
@.str.2 = [6 x i8] c"march\00"
@.str.3 = [6 x i8] c"april\00"
@.str.4 = [4 x i8] c"may\00"
@.str.5 = [5 x i8] c"june\00"
@.str.6 = [5 x i8] c"july\00"
@.str.7 = [7 x i8] c"august\00"
@.str.8 = [10 x i8] c"september\00"
@.str.9 = [8 x i8] c"october\00"
@.str.10 = [9 x i8] c"november\00"
@.str.11 = [9 x i8] c"december\00"
@__const.get_month_integer.month_string_array = [13 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 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 ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i32 0, i32 0), i8* null]
define i32 @get_month_integer(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [13 x i8*]
%5 = alloca i8**
%6 = alloca i32
store i8* %0, i8** %3
%7 = bitcast [13 x i8*]* %4 to i8*
%8 = getelementptr inbounds [13 x i8*], [13 x i8*]* %4, i64 0, i64 0
store i8** %8, i8*** %5
store i32 1, i32* %6
br label %9
9: ; preds = %22, %1
%10 = load i8**, i8*** %5
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 0
br i1 %13, label %14, label %27
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = load i8**, i8*** %5
%17 = load i8*, i8** %16
%18 = call i64 @strcasecmp(i8* %15, i8* %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %14
%21 = load i32, i32* %6
store i32 %21, i32* %2
br label %28
22: ; preds = %14
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i32 1
store i8** %24, i8*** %5
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %9
27: ; preds = %9
store i32 0, i32* %2
br label %28
28: ; preds = %27, %20
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
@.str = [8 x i8] c"january\00"
@.str.1 = [9 x i8] c"february\00"
@.str.2 = [6 x i8] c"march\00"
@.str.3 = [6 x i8] c"april\00"
@.str.4 = [4 x i8] c"may\00"
@.str.5 = [5 x i8] c"june\00"
@.str.6 = [5 x i8] c"july\00"
@.str.7 = [7 x i8] c"august\00"
@.str.8 = [10 x i8] c"september\00"
@.str.9 = [8 x i8] c"october\00"
@.str.10 = [9 x i8] c"november\00"
@.str.11 = [9 x i8] c"december\00"
@__const.get_month_integer.month_string_array = [13 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 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 ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i32 0, i32 0), i8* null]
define i32 @get_month_integer(i8* nocapture %0) {
%2 = alloca [13 x i8*]
%3 = bitcast [13 x i8*]* %2 to i8*
%4 = getelementptr inbounds [13 x i8*], [13 x i8*]* %2, i64 0, i64 0
br label %5
5: ; preds = %1, %11
%6 = phi i8* [ %14, %11 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %1 ]
%7 = phi i32 [ %13, %11 ], [ 1, %1 ]
%8 = phi i8** [ %12, %11 ], [ %4, %1 ]
%9 = tail call i64 @strcasecmp(i8* %0, i8* %6)
%10 = icmp eq i64 %9, 0
br i1 %10, label %17, label %11
11: ; preds = %5
%12 = getelementptr inbounds i8*, i8** %8, i64 1
%13 = add nuw nsw i32 %7, 1
%14 = load i8*, i8** %12
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %5
17: ; preds = %5, %11
%18 = phi i32 [ %7, %5 ], [ 0, %11 ]
ret i32 %18
}