#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*/ nll_puterr2(char *, char *);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
char toupper(char);
int Month2Int(char *cmonth) {
  int i;
  for (i = 0; i < strlen(cmonth); i++)
    cmonth[i] = toupper(cmonth[i]);
  if (strcmp(cmonth, "JAN") == 0)
    return (1);
  if (strcmp(cmonth, "FEB") == 0)
    return (2);
  if (strcmp(cmonth, "MAR") == 0)
    return (3);
  if (strcmp(cmonth, "APR") == 0)
    return (4);
  if (strcmp(cmonth, "MAY") == 0)
    return (5);
  if (strcmp(cmonth, "JUN") == 0)
    return (6);
  if (strcmp(cmonth, "JUL") == 0)
    return (7);
  if (strcmp(cmonth, "AUG") == 0)
    return (8);
  if (strcmp(cmonth, "SEP") == 0)
    return (9);
  if (strcmp(cmonth, "OCT") == 0)
    return (10);
  if (strcmp(cmonth, "NOV") == 0)
    return (11);
  if (strcmp(cmonth, "DEC") == 0)
    return (12);
  nll_puterr2("ERROR: unrecognized charcter month", cmonth);
  return (0);
}


x86 assembly (clang, -O0):
<Month2Int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    119b <Month2Int+0x5b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <toupper@plt>
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1153 <Month2Int+0x13>
mov    -0x10(%rbp),%rdi
lea    0xe5a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11c1 <Month2Int+0x81>
movl   $0x1,-0x4(%rbp)
jmp    137a <Month2Int+0x23a>
mov    -0x10(%rbp),%rdi
lea    0xe38(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11e7 <Month2Int+0xa7>
movl   $0x2,-0x4(%rbp)
jmp    137a <Month2Int+0x23a>
mov    -0x10(%rbp),%rdi
lea    0xe16(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    120d <Month2Int+0xcd>
movl   $0x3,-0x4(%rbp)
jmp    137a <Month2Int+0x23a>
mov    -0x10(%rbp),%rdi
lea    0xdf4(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1233 <Month2Int+0xf3>
movl   $0x4,-0x4(%rbp)
jmp    137a <Month2Int+0x23a>
mov    -0x10(%rbp),%rdi
lea    0xdd2(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1259 <Month2Int+0x119>
movl   $0x5,-0x4(%rbp)
jmp    137a <Month2Int+0x23a>
mov    -0x10(%rbp),%rdi
lea    0xdb0(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    127f <Month2Int+0x13f>
movl   $0x6,-0x4(%rbp)
jmp    137a <Month2Int+0x23a>
mov    -0x10(%rbp),%rdi
lea    0xd8e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12a5 <Month2Int+0x165>
movl   $0x7,-0x4(%rbp)
jmp    137a <Month2Int+0x23a>
mov    -0x10(%rbp),%rdi
lea    0xd6c(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12cb <Month2Int+0x18b>
movl   $0x8,-0x4(%rbp)
jmp    137a <Month2Int+0x23a>
mov    -0x10(%rbp),%rdi
lea    0xd4a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12f1 <Month2Int+0x1b1>
movl   $0x9,-0x4(%rbp)
jmp    137a <Month2Int+0x23a>
mov    -0x10(%rbp),%rdi
lea    0xd28(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1317 <Month2Int+0x1d7>
movl   $0xa,-0x4(%rbp)
jmp    137a <Month2Int+0x23a>
mov    -0x10(%rbp),%rdi
lea    0xd06(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    133d <Month2Int+0x1fd>
movl   $0xb,-0x4(%rbp)
jmp    137a <Month2Int+0x23a>
mov    -0x10(%rbp),%rdi
lea    0xce4(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1363 <Month2Int+0x223>
movl   $0xc,-0x4(%rbp)
jmp    137a <Month2Int+0x23a>
mov    -0x10(%rbp),%rsi
lea    0xcc2(%rip),%rdi
call   1060 <nll_puterr2@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Month2Int>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
test   %eax,%eax
jle    1181 <Month2Int+0x41>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%r14,%rbx,1),%edi
call   1030 <toupper@plt>
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1160 <Month2Int+0x20>
lea    0xe78(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12a8 <Month2Int+0x168>
lea    0xe64(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12af <Month2Int+0x16f>
lea    0xe50(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12b6 <Month2Int+0x176>
lea    0xe3c(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12bd <Month2Int+0x17d>
lea    0xe28(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12c4 <Month2Int+0x184>
lea    0xe14(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12cb <Month2Int+0x18b>
lea    0xe00(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12d2 <Month2Int+0x192>
lea    0xdec(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12d9 <Month2Int+0x199>
lea    0xdd8(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12e0 <Month2Int+0x1a0>
lea    0xdc4(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12e7 <Month2Int+0x1a7>
lea    0xdb4(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12ee <Month2Int+0x1ae>
lea    0xda4(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12f5 <Month2Int+0x1b5>
lea    0xd94(%rip),%rdi
mov    %r14,%rsi
call   1060 <nll_puterr2@plt>
xor    %eax,%eax
jmp    12fa <Month2Int+0x1ba>
mov    $0x1,%eax
jmp    12fa <Month2Int+0x1ba>
mov    $0x2,%eax
jmp    12fa <Month2Int+0x1ba>
mov    $0x3,%eax
jmp    12fa <Month2Int+0x1ba>
mov    $0x4,%eax
jmp    12fa <Month2Int+0x1ba>
mov    $0x5,%eax
jmp    12fa <Month2Int+0x1ba>
mov    $0x6,%eax
jmp    12fa <Month2Int+0x1ba>
mov    $0x7,%eax
jmp    12fa <Month2Int+0x1ba>
mov    $0x8,%eax
jmp    12fa <Month2Int+0x1ba>
mov    $0x9,%eax
jmp    12fa <Month2Int+0x1ba>
mov    $0xa,%eax
jmp    12fa <Month2Int+0x1ba>
mov    $0xb,%eax
jmp    12fa <Month2Int+0x1ba>
mov    $0xc,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
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"
@.str.12 = [35 x i8] c"ERROR: unrecognized charcter month\00"
define i32 @Month2Int(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
br label %5
5: ; preds = %21, %1
%6 = load i32, i32* %4
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = icmp slt i32 %6, %8
br i1 %9, label %10, label %24
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = call signext i8 @toupper(i8 signext %15)
%17 = load i8*, i8** %3
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
store i8 %16, i8* %20
br label %21
21: ; preds = %10
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %5
24: ; preds = %5
%25 = load i8*, i8** %3
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %24
store i32 1, i32* %2
br label %87
29: ; preds = %24
%30 = load i8*, i8** %3
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %29
store i32 2, i32* %2
br label %87
34: ; preds = %29
%35 = load i8*, i8** %3
%36 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %34
store i32 3, i32* %2
br label %87
39: ; preds = %34
%40 = load i8*, i8** %3
%41 = call i64 @strcmp(i8* %40, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %44
43: ; preds = %39
store i32 4, i32* %2
br label %87
44: ; preds = %39
%45 = load i8*, i8** %3
%46 = call i64 @strcmp(i8* %45, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %44
store i32 5, i32* %2
br label %87
49: ; preds = %44
%50 = load i8*, i8** %3
%51 = call i64 @strcmp(i8* %50, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %54
53: ; preds = %49
store i32 6, i32* %2
br label %87
54: ; preds = %49
%55 = load i8*, i8** %3
%56 = call i64 @strcmp(i8* %55, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %59
58: ; preds = %54
store i32 7, i32* %2
br label %87
59: ; preds = %54
%60 = load i8*, i8** %3
%61 = call i64 @strcmp(i8* %60, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %64
63: ; preds = %59
store i32 8, i32* %2
br label %87
64: ; preds = %59
%65 = load i8*, i8** %3
%66 = call i64 @strcmp(i8* %65, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %69
68: ; preds = %64
store i32 9, i32* %2
br label %87
69: ; preds = %64
%70 = load i8*, i8** %3
%71 = call i64 @strcmp(i8* %70, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%72 = icmp eq i64 %71, 0
br i1 %72, label %73, label %74
73: ; preds = %69
store i32 10, i32* %2
br label %87
74: ; preds = %69
%75 = load i8*, i8** %3
%76 = call i64 @strcmp(i8* %75, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %79
78: ; preds = %74
store i32 11, i32* %2
br label %87
79: ; preds = %74
%80 = load i8*, i8** %3
%81 = call i64 @strcmp(i8* %80, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%82 = icmp eq i64 %81, 0
br i1 %82, label %83, label %84
83: ; preds = %79
store i32 12, i32* %2
br label %87
84: ; preds = %79
%85 = load i8*, i8** %3
%86 = call i32 @nll_puterr2(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.12, i64 0, i64 0), i8* %85)
store i32 0, i32* %2
br label %87
87: ; preds = %84, %83, %78, %73, %68, %63, %58, %53, %48, %43, %38, %33, %28
%88 = load i32, i32* %2
ret i32 %88
}

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"
@.str.12 = [35 x i8] c"ERROR: unrecognized charcter month\00"
define i32 @Month2Int(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = tail call signext i8 @toupper(i8 signext %7)
store i8 %8, i8* %6
%9 = add nuw nsw i64 %5, 1
%10 = tail call i32 @strlen(i8* %0)
%11 = sext i32 %10 to i64
%12 = icmp slt i64 %9, %11
br i1 %12, label %4, label %13
13: ; preds = %4, %1
%14 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %51, label %16
16: ; preds = %13
%17 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %51, label %19
19: ; preds = %16
%20 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %51, label %22
22: ; preds = %19
%23 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %51, label %25
25: ; preds = %22
%26 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %51, label %28
28: ; preds = %25
%29 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %51, label %31
31: ; preds = %28
%32 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %51, label %34
34: ; preds = %31
%35 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %51, label %37
37: ; preds = %34
%38 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %51, label %40
40: ; preds = %37
%41 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %51, label %43
43: ; preds = %40
%44 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %51, label %46
46: ; preds = %43
%47 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %51, label %49
49: ; preds = %46
%50 = tail call i32 @nll_puterr2(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.12, i64 0, i64 0), i8* %0)
br label %51
51: ; preds = %46, %43, %40, %37, %34, %31, %28, %25, %22, %19, %16, %13, %49
%52 = phi i32 [ 0, %49 ], [ 1, %13 ], [ 2, %16 ], [ 3, %19 ], [ 4, %22 ], [ 5, %25 ], [ 6, %28 ], [ 7, %31 ], [ 8, %34 ], [ 9, %37 ], [ 10, %40 ], [ 11, %43 ], [ 12, %46 ]
ret i32 %52
}