#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__ strcmp(char const *, char const *);
int strtomonth(int *mm, const char *str) {
  static const char *sname[] = {"jan", "feb", "mar", "apr", "may", "jun", "jul",
                                "aug", "sep", "oct", "nov", "dec", NULL};
  int i;
  for (i = 0; sname[i]; i++) {
    if (strcmp(sname[i], str) == 0) {
      *mm = i + 1;
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<strtomonth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rcx
lea    0x2efe(%rip),%rax
cmpq   $0x0,(%rax,%rcx,8)
je     118a <strtomonth+0x7a>
movslq -0x1c(%rbp),%rcx
lea    0x2ee8(%rip),%rax
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1177 <strtomonth+0x67>
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1191 <strtomonth+0x81>
jmp    117c <strtomonth+0x6c>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1127 <strtomonth+0x17>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtomonth>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xedf(%rip),%rdi
call   1030 <strcmp@plt>
mov    $0x1,%ecx
test   %rax,%rax
je     127c <strtomonth+0x16c>
lea    0xec9(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1238 <strtomonth+0x128>
lea    0xeb5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     123f <strtomonth+0x12f>
lea    0xea1(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1246 <strtomonth+0x136>
lea    0xe8d(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     124d <strtomonth+0x13d>
lea    0xe79(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1254 <strtomonth+0x144>
lea    0xe65(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     125b <strtomonth+0x14b>
lea    0xe51(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1262 <strtomonth+0x152>
lea    0xe3d(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1269 <strtomonth+0x159>
lea    0xe2d(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1270 <strtomonth+0x160>
lea    0xe1d(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1277 <strtomonth+0x167>
lea    0xe0d(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    1284 <strtomonth+0x174>
mov    $0xc,%ecx
jmp    127c <strtomonth+0x16c>
mov    $0x2,%ecx
jmp    127c <strtomonth+0x16c>
mov    $0x3,%ecx
jmp    127c <strtomonth+0x16c>
mov    $0x4,%ecx
jmp    127c <strtomonth+0x16c>
mov    $0x5,%ecx
jmp    127c <strtomonth+0x16c>
mov    $0x6,%ecx
jmp    127c <strtomonth+0x16c>
mov    $0x7,%ecx
jmp    127c <strtomonth+0x16c>
mov    $0x8,%ecx
jmp    127c <strtomonth+0x16c>
mov    $0x9,%ecx
jmp    127c <strtomonth+0x16c>
mov    $0xa,%ecx
jmp    127c <strtomonth+0x16c>
mov    $0xb,%ecx
mov    %ecx,(%r14)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@strtomonth.sname = internal global [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]
@.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 @strtomonth(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 0, i32* %6
br label %7
7: ; preds = %26, %2
%8 = load i32, i32* %6
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [13 x i8*], [13 x i8*]* @strtomonth.sname, i64 0, i64 %9
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %29
13: ; preds = %7
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [13 x i8*], [13 x i8*]* @strtomonth.sname, i64 0, i64 %15
%17 = load i8*, i8** %16
%18 = load i8*, i8** %5
%19 = call i64 @strcmp(i8* %17, i8* %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %13
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
%24 = load i32*, i32** %4
store i32 %23, i32* %24
store i32 1, i32* %3
br label %30
25: ; preds = %13
br label %26
26: ; preds = %25
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %7
29: ; preds = %7
store i32 0, i32* %3
br label %30
30: ; preds = %29, %21
%31 = load i32, i32* %3
ret i32 %31
}

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