#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*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcasecmp(char *, char *);
int month_convert(char *in, char *out) {
  char *month1[12] = {"January",   "February", "March",    "April",
                      "May",       "June",     "July",     "August",
                      "September", "October",  "November", "December"};
  char *month2[12] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
                      "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
  int i, found = -1;
  for (i = 0; i < 12 && found == -1; ++i) {
    if (!strcasecmp(in, month1[i]))
      found = i;
    if (!strcasecmp(in, month2[i]))
      found = i;
  }
  if (found == -1)
    return 0;
  if (found > 8)
    sprintf(out, "%d", found + 1);
  else
    sprintf(out, "0%d", found + 1);
  return 1;
}


x86 assembly (clang, -O0):
<month_convert>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x80(%rbp),%rdi
lea    0x2c12(%rip),%rsi
mov    $0x60,%edx
call   1040 <memcpy@plt>
lea    -0xe0(%rbp),%rdi
lea    0x2c5a(%rip),%rsi
mov    $0x60,%edx
call   1040 <memcpy@plt>
movl   $0xffffffff,-0xe8(%rbp)
ff ff ff
movl   $0x0,-0xe4(%rbp)
xor    %eax,%eax
cmpl   $0xc,-0xe4(%rbp)
mov    %al,-0xe9(%rbp)
jge    11a9 <month_convert+0x79>
cmpl   $0xffffffff,-0xe8(%rbp)
sete   %al
mov    %al,-0xe9(%rbp)
mov    -0xe9(%rbp),%al
test   $0x1,%al
jne    11bc <month_convert+0x8c>
jmp    122c <month_convert+0xfc>
mov    -0x10(%rbp),%rdi
movslq -0xe4(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    11e6 <month_convert+0xb6>
mov    -0xe4(%rbp),%eax
mov    %eax,-0xe8(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0xe4(%rbp),%rax
mov    -0xe0(%rbp,%rax,8),%rsi
ff
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1213 <month_convert+0xe3>
mov    -0xe4(%rbp),%eax
mov    %eax,-0xe8(%rbp)
jmp    1218 <month_convert+0xe8>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    1184 <month_convert+0x54>
cmpl   $0xffffffff,-0xe8(%rbp)
jne    1245 <month_convert+0x115>
movl   $0x0,-0x4(%rbp)
jmp    1290 <month_convert+0x160>
cmpl   $0x8,-0xe8(%rbp)
jle    1270 <month_convert+0x140>
mov    -0x18(%rbp),%rdi
mov    -0xe8(%rbp),%edx
add    $0x1,%edx
lea    0xe1d(%rip),%rsi
call   1050 <sprintf@plt>
jmp    1289 <month_convert+0x159>
mov    -0x18(%rbp),%rdi
mov    -0xe8(%rbp),%edx
add    $0x1,%edx
lea    0xdfe(%rip),%rsi
call   1050 <sprintf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<month_convert>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,(%rsp)
mov    %rdi,%r15
xor    %ebx,%ebx
lea    0xf4d(%rip),%r12
lea    0xf76(%rip),%r13
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nop
movslq (%rbx,%r12,1),%rsi
add    %r12,%rsi
mov    %r15,%rdi
call   1030 <strcasecmp@plt>
mov    %eax,%ebp
movslq (%rbx,%r13,1),%rsi
add    %r13,%rsi
mov    %r15,%rdi
call   1030 <strcasecmp@plt>
neg    %ebp
sbb    %ecx,%ecx
test   %eax,%eax
je     1190 <month_convert+0x70>
or     %r14d,%ecx
cmp    $0xa,%r14
jbe    1199 <month_convert+0x79>
jmp    11a6 <month_convert+0x86>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14d,%ecx
cmp    $0xa,%r14
ja     11a6 <month_convert+0x86>
add    $0x1,%r14
add    $0x4,%rbx
cmp    $0xffffffff,%ecx
je     1150 <month_convert+0x30>
cmp    $0xffffffff,%ecx
je     11d3 <month_convert+0xb3>
lea    0x1(%rcx),%edx
cmp    $0x9,%ecx
lea    0xecb(%rip),%rax
lea    0xec3(%rip),%rsi
cmovae %rax,%rsi
mov    (%rsp),%rdi
call   1040 <sprintf@plt>
mov    $0x1,%eax
jmp    11d5 <month_convert+0xb5>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
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.month_convert.month1 = [12 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)]
@.str.12 = [4 x i8] c"Jan\00"
@.str.13 = [4 x i8] c"Feb\00"
@.str.14 = [4 x i8] c"Mar\00"
@.str.15 = [4 x i8] c"Apr\00"
@.str.16 = [4 x i8] c"Jun\00"
@.str.17 = [4 x i8] c"Jul\00"
@.str.18 = [4 x i8] c"Aug\00"
@.str.19 = [4 x i8] c"Sep\00"
@.str.20 = [4 x i8] c"Oct\00"
@.str.21 = [4 x i8] c"Nov\00"
@.str.22 = [4 x i8] c"Dec\00"
@__const.month_convert.month2 = [12 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, 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.16, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.22, i32 0, i32 0)]
@.str.23 = [3 x i8] c"%d\00"
@.str.24 = [4 x i8] c"0%d\00"
define i32 @month_convert(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [12 x i8*]
%7 = alloca [12 x i8*]
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%10 = bitcast [12 x i8*]* %6 to i8*
%11 = bitcast [12 x i8*]* %7 to i8*
store i32 -1, i32* %9
store i32 0, i32* %8
br label %12
12: ; preds = %41, %2
%13 = load i32, i32* %8
%14 = icmp slt i32 %13, 12
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* %9
%17 = icmp eq i32 %16, -1
br label %18
18: ; preds = %15, %12
%19 = phi i1 [ false, %12 ], [ %17, %15 ]
br i1 %19, label %20, label %44
20: ; preds = %18
%21 = load i8*, i8** %4
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [12 x i8*], [12 x i8*]* %6, i64 0, i64 %23
%25 = load i8*, i8** %24
%26 = call i32 @strcasecmp(i8* %21, i8* %25)
%27 = icmp ne i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %20
%29 = load i32, i32* %8
store i32 %29, i32* %9
br label %30
30: ; preds = %28, %20
%31 = load i8*, i8** %4
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [12 x i8*], [12 x i8*]* %7, i64 0, i64 %33
%35 = load i8*, i8** %34
%36 = call i32 @strcasecmp(i8* %31, i8* %35)
%37 = icmp ne i32 %36, 0
br i1 %37, label %40, label %38
38: ; preds = %30
%39 = load i32, i32* %8
store i32 %39, i32* %9
br label %40
40: ; preds = %38, %30
br label %41
41: ; preds = %40
%42 = load i32, i32* %8
%43 = add nsw i32 %42, 1
store i32 %43, i32* %8
br label %12
44: ; preds = %18
%45 = load i32, i32* %9
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %48
47: ; preds = %44
store i32 0, i32* %3
br label %62
48: ; preds = %44
%49 = load i32, i32* %9
%50 = icmp sgt i32 %49, 8
br i1 %50, label %51, label %56
51: ; preds = %48
%52 = load i8*, i8** %5
%53 = load i32, i32* %9
%54 = add nsw i32 %53, 1
%55 = call i32 @sprintf(i8* %52, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.23, i64 0, i64 0), i32 %54)
br label %61
56: ; preds = %48
%57 = load i8*, i8** %5
%58 = load i32, i32* %9
%59 = add nsw i32 %58, 1
%60 = call i32 @sprintf(i8* %57, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.24, i64 0, i64 0), i32 %59)
br label %61
61: ; preds = %56, %51
store i32 1, i32* %3
br label %62
62: ; preds = %61, %47
%63 = load i32, i32* %3
ret i32 %63
}

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"
@reltable.month_convert = [12 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.1 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.2 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.3 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.4 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.5 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.6 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.7 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.8 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.9 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.10 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.11 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert to i64)) to i32)]
@.str.12 = [4 x i8] c"Jan\00"
@.str.13 = [4 x i8] c"Feb\00"
@.str.14 = [4 x i8] c"Mar\00"
@.str.15 = [4 x i8] c"Apr\00"
@.str.16 = [4 x i8] c"Jun\00"
@.str.17 = [4 x i8] c"Jul\00"
@.str.18 = [4 x i8] c"Aug\00"
@.str.19 = [4 x i8] c"Sep\00"
@.str.20 = [4 x i8] c"Oct\00"
@.str.21 = [4 x i8] c"Nov\00"
@.str.22 = [4 x i8] c"Dec\00"
@reltable.month_convert.25 = [12 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.12 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert.25 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.13 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert.25 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.14 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert.25 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.15 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert.25 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.4 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert.25 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.16 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert.25 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.17 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert.25 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.18 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert.25 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.19 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert.25 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.20 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert.25 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.21 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert.25 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.22 to i64), i64 ptrtoint ([12 x i32]* @reltable.month_convert.25 to i64)) to i32)]
@.str.23 = [3 x i8] c"%d\00"
@.str.24 = [4 x i8] c"0%d\00"
define i32 @month_convert(i8* nocapture %0, i8* nocapture writeonly %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i64 [ 0, %2 ], [ %16, %3 ]
%5 = shl i64 %4, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([12 x i32]* @reltable.month_convert to i8*), i64 %5)
%7 = tail call i32 @strcasecmp(i8* %0, i8* %6)
%8 = icmp eq i32 %7, 0
%9 = shl i64 %4, 2
%10 = call i8* @llvm.load.relative.i64(i8* bitcast ([12 x i32]* @reltable.month_convert.25 to i8*), i64 %9)
%11 = tail call i32 @strcasecmp(i8* %0, i8* %10)
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i1 true, i1 %8
%14 = trunc i64 %4 to i32
%15 = select i1 %13, i32 %14, i32 -1
%16 = add nuw nsw i64 %4, 1
%17 = icmp ult i64 %4, 11
%18 = icmp eq i32 %15, -1
%19 = select i1 %17, i1 %18, i1 false
br i1 %19, label %3, label %20
20: ; preds = %3
br i1 %18, label %26, label %21
21: ; preds = %20
%22 = icmp ugt i32 %15, 8
%23 = add nuw nsw i32 %15, 1
%24 = select i1 %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.23, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.24, i64 0, i64 0)
%25 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) %24, i32 %23)
br label %26
26: ; preds = %21, %20
%27 = phi i32 [ 0, %20 ], [ 1, %21 ]
ret i32 %27
}