#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 *, char const *);
int find_index(const char *str) {
  char *haab_mons[19] = {"pop", "no",     "zip",   "zotz",   "tzec",
                         "xul", "yoxkin", "mol",   "chen",   "yax",
                         "zac", "ceh",    "mac",   "kankin", "muan",
                         "pax", "koyab",  "cumhu", "uayet"};
  int i = 0;
  for (; i < 19; i++)
    if (strcmp(haab_mons[i], str) == 0)
      return i;
  return -1;
}


x86 assembly (clang, -O0):
<find_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0xb0(%rbp),%rdi
lea    0x2c43(%rip),%rsi
mov    $0x98,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0xb4(%rbp)
cmpl   $0x13,-0xb4(%rbp)
jge    11a7 <find_index+0x87>
movslq -0xb4(%rbp),%rax
mov    -0xb0(%rbp,%rax,8),%rdi
ff
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    118e <find_index+0x6e>
mov    -0xb4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11ae <find_index+0x8e>
jmp    1193 <find_index+0x73>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    1151 <find_index+0x31>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_index>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xf3a(%rip),%r15
xor    %r12d,%r12d
mov    %r15,%rbx
nopl   0x0(%rax,%rax,1)
movslq (%rbx),%rdi
add    %r15,%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1157 <find_index+0x47>
add    $0x1,%r12
add    $0x4,%rbx
cmp    $0x13,%r12
jne    1130 <find_index+0x20>
mov    $0xffffffff,%r12d
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"pop\00"
@.str.1 = [3 x i8] c"no\00"
@.str.2 = [4 x i8] c"zip\00"
@.str.3 = [5 x i8] c"zotz\00"
@.str.4 = [5 x i8] c"tzec\00"
@.str.5 = [4 x i8] c"xul\00"
@.str.6 = [7 x i8] c"yoxkin\00"
@.str.7 = [4 x i8] c"mol\00"
@.str.8 = [5 x i8] c"chen\00"
@.str.9 = [4 x i8] c"yax\00"
@.str.10 = [4 x i8] c"zac\00"
@.str.11 = [4 x i8] c"ceh\00"
@.str.12 = [4 x i8] c"mac\00"
@.str.13 = [7 x i8] c"kankin\00"
@.str.14 = [5 x i8] c"muan\00"
@.str.15 = [4 x i8] c"pax\00"
@.str.16 = [6 x i8] c"koyab\00"
@.str.17 = [6 x i8] c"cumhu\00"
@.str.18 = [6 x i8] c"uayet\00"
@__const.find_index.haab_mons = [19 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 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 ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 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 ([7 x i8], [7 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 ([5 x i8], [5 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* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 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 ([6 x i8], [6 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i32 0, i32 0)]
define i32 @find_index(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [19 x i8*]
%5 = alloca i32
store i8* %0, i8** %3
%6 = bitcast [19 x i8*]* %4 to i8*
store i32 0, i32* %5
br label %7
7: ; preds = %21, %1
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 19
br i1 %9, label %10, label %24
10: ; preds = %7
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [19 x i8*], [19 x i8*]* %4, i64 0, i64 %12
%14 = load i8*, i8** %13
%15 = load i8*, i8** %3
%16 = call i64 @strcmp(i8* %14, i8* %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %10
%19 = load i32, i32* %5
store i32 %19, i32* %2
br label %25
20: ; preds = %10
br label %21
21: ; preds = %20
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %7
24: ; preds = %7
store i32 -1, i32* %2
br label %25
25: ; preds = %24, %18
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
@.str = [4 x i8] c"pop\00"
@.str.1 = [3 x i8] c"no\00"
@.str.2 = [4 x i8] c"zip\00"
@.str.3 = [5 x i8] c"zotz\00"
@.str.4 = [5 x i8] c"tzec\00"
@.str.5 = [4 x i8] c"xul\00"
@.str.6 = [7 x i8] c"yoxkin\00"
@.str.7 = [4 x i8] c"mol\00"
@.str.8 = [5 x i8] c"chen\00"
@.str.9 = [4 x i8] c"yax\00"
@.str.10 = [4 x i8] c"zac\00"
@.str.11 = [4 x i8] c"ceh\00"
@.str.12 = [4 x i8] c"mac\00"
@.str.13 = [7 x i8] c"kankin\00"
@.str.14 = [5 x i8] c"muan\00"
@.str.15 = [4 x i8] c"pax\00"
@.str.16 = [6 x i8] c"koyab\00"
@.str.17 = [6 x i8] c"cumhu\00"
@.str.18 = [6 x i8] c"uayet\00"
@reltable.find_index = [19 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([19 x i32]* @reltable.find_index to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.1 to i64), i64 ptrtoint ([19 x i32]* @reltable.find_index to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([19 x i32]* @reltable.find_index to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.3 to i64), i64 ptrtoint ([19 x i32]* @reltable.find_index to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.4 to i64), i64 ptrtoint ([19 x i32]* @reltable.find_index to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.5 to i64), i64 ptrtoint ([19 x i32]* @reltable.find_index to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.6 to i64), i64 ptrtoint ([19 x i32]* @reltable.find_index to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.7 to i64), i64 ptrtoint ([19 x i32]* @reltable.find_index to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.8 to i64), i64 ptrtoint ([19 x i32]* @reltable.find_index to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.9 to i64), i64 ptrtoint ([19 x i32]* @reltable.find_index to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.10 to i64), i64 ptrtoint ([19 x i32]* @reltable.find_index to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.11 to i64), i64 ptrtoint ([19 x i32]* @reltable.find_index to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.12 to i64), i64 ptrtoint ([19 x i32]* @reltable.find_index to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.13 to i64), i64 ptrtoint ([19 x i32]* @reltable.find_index to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.14 to i64), i64 ptrtoint ([19 x i32]* @reltable.find_index to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.15 to i64), i64 ptrtoint ([19 x i32]* @reltable.find_index to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.16 to i64), i64 ptrtoint ([19 x i32]* @reltable.find_index to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.17 to i64), i64 ptrtoint ([19 x i32]* @reltable.find_index to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.18 to i64), i64 ptrtoint ([19 x i32]* @reltable.find_index to i64)) to i32)]
define i32 @find_index(i8* %0) {
br label %2
2: ; preds = %1, %8
%3 = phi i64 [ 0, %1 ], [ %9, %8 ]
%4 = shl i64 %3, 2
%5 = call i8* @llvm.load.relative.i64(i8* bitcast ([19 x i32]* @reltable.find_index to i8*), i64 %4)
%6 = tail call i64 @strcmp(i8* %5, i8* %0)
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = add nuw nsw i64 %3, 1
%10 = icmp eq i64 %9, 19
br i1 %10, label %13, label %2
11: ; preds = %2
%12 = trunc i64 %3 to i32
br label %13
13: ; preds = %8, %11
%14 = phi i32 [ %12, %11 ], [ -1, %8 ]
ret i32 %14
}