#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 */
typedef int uint32_t;

/* Variables and functions */
int strlen(char const *);
int lime_str_to_id(const char *s) {
  const uint32_t LUT[] = {
      0x00000062, 0x00000063, 0x00006368, 0x00000064, 0x00000066, 0x00000067,
      0x00000068, 0x0000006a, 0x0000006b, 0x0000006c, 0x0000006d, 0x0000006e,
      0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00007368, 0x00000074,
      0x00000077, 0x00000078, 0x00000079, 0x0000007a, 0x00007a68, 0x00000061,
      0x00006169, 0x0000616e, 0x00616e67, 0x0000616f, 0x00000065, 0x00006569,
      0x0000656e, 0x00656e67, 0x00006572, 0x00000069, 0x00006961, 0x0069616e,
      0x69616e67, 0x0069616f, 0x00006965, 0x0000696e, 0x00696e67, 0x696f6e67,
      0x00006975, 0x0000006f, 0x006f6e67, 0x00006f75, 0x00000075, 0x00007561,
      0x00756169, 0x0075616e, 0x75616e67, 0x00007565, 0x00007569, 0x0000756e,
      0x0000756f, 0x00000076,
  };
  int i;
  int n;
  uint32_t v;
  n = strlen(s);
  if (n > 4) {
    return -1;
  }
  v = 0;
  for (i = 0; i < n; i++) {
    v = (v << 8) | s[i];
  }
  for (i = 0; i < 57; i++) {
    if (LUT[i] == v) {
      return i + 1;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<lime_str_to_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0xf0(%rbp),%rdi
lea    0xec3(%rip),%rsi
mov    $0xe0,%edx
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xf8(%rbp)
cmpl   $0x4,-0xf8(%rbp)
jle    116f <lime_str_to_id+0x4f>
movl   $0xffffffff,-0x4(%rbp)
jmp    122b <lime_str_to_id+0x10b>
movl   $0x0,-0xfc(%rbp)
movl   $0x0,-0xf4(%rbp)
mov    -0xf4(%rbp),%eax
cmp    -0xf8(%rbp),%eax
jge    11c9 <lime_str_to_id+0xa9>
mov    -0xfc(%rbp),%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%rcx
movslq -0xf4(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
or     %ecx,%eax
mov    %eax,-0xfc(%rbp)
mov    -0xf4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf4(%rbp)
jmp    1183 <lime_str_to_id+0x63>
movl   $0x0,-0xf4(%rbp)
cmpl   $0x39,-0xf4(%rbp)
jge    1224 <lime_str_to_id+0x104>
movslq -0xf4(%rbp),%rax
mov    -0xf0(%rbp,%rax,4),%eax
cmp    -0xfc(%rbp),%eax
jne    120b <lime_str_to_id+0xeb>
mov    -0xf4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    122b <lime_str_to_id+0x10b>
jmp    1210 <lime_str_to_id+0xf0>
mov    -0xf4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf4(%rbp)
jmp    11d3 <lime_str_to_id+0xb3>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lime_str_to_id>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    $0x4,%ecx
jle    1127 <lime_str_to_id+0x17>
pop    %rbx
ret
test   %ecx,%ecx
jle    115e <lime_str_to_id+0x4e>
movsbl (%rbx),%edx
cmp    $0x1,%ecx
je     1160 <lime_str_to_id+0x50>
mov    %edx,%esi
shl    $0x8,%esi
movsbl 0x1(%rbx),%edx
or     %esi,%edx
cmp    $0x2,%ecx
je     1160 <lime_str_to_id+0x50>
mov    %edx,%esi
shl    $0x8,%esi
movsbl 0x2(%rbx),%edx
or     %esi,%edx
cmp    $0x3,%ecx
je     1160 <lime_str_to_id+0x50>
shl    $0x8,%edx
movsbl 0x3(%rbx),%ecx
or     %ecx,%edx
jmp    1160 <lime_str_to_id+0x50>
xor    %edx,%edx
mov    $0x2,%ecx
lea    0xe94(%rip),%rsi
nopl   0x0(%rax)
cmp    %edx,-0x8(%rsi,%rcx,4)
je     118d <lime_str_to_id+0x7d>
cmp    %edx,-0x4(%rsi,%rcx,4)
je     1193 <lime_str_to_id+0x83>
cmp    %edx,(%rsi,%rcx,4)
je     1197 <lime_str_to_id+0x87>
add    $0x3,%rcx
cmp    $0x3b,%rcx
jne    1170 <lime_str_to_id+0x60>
jmp    1125 <lime_str_to_id+0x15>
add    $0xfffffffffffffffe,%rcx
jmp    1197 <lime_str_to_id+0x87>
add    $0xffffffffffffffff,%rcx
add    $0x1,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.lime_str_to_id.LUT = [56 x i32] [i32 98, i32 99, i32 25448, i32 100, i32 102, i32 103, i32 104, i32 106, i32 107, i32 108, i32 109, i32 110, i32 112, i32 113, i32 114, i32 115, i32 29544, i32 116, i32 119, i32 120, i32 121, i32 122, i32 31336, i32 97, i32 24937, i32 24942, i32 6385255, i32 24943, i32 101, i32 25961, i32 25966, i32 6647399, i32 25970, i32 105, i32 26977, i32 6906222, i32 1767992935, i32 6906223, i32 26981, i32 26990, i32 6909543, i32 1768910439, i32 26997, i32 111, i32 7302759, i32 28533, i32 117, i32 30049, i32 7692649, i32 7692654, i32 1969319527, i32 30053, i32 30057, i32 30062, i32 30063, i32 118]
define i32 @lime_str_to_id(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [56 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
%8 = bitcast [56 x i32]* %4 to i8*
%9 = load i8*, i8** %3
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp sgt i32 %11, 4
br i1 %12, label %13, label %14
13: ; preds = %1
store i32 -1, i32* %2
br label %51
14: ; preds = %1
store i32 0, i32* %7
store i32 0, i32* %5
br label %15
15: ; preds = %29, %14
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %32
19: ; preds = %15
%20 = load i32, i32* %7
%21 = shl i32 %20, 8
%22 = load i8*, i8** %3
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = or i32 %21, %27
store i32 %28, i32* %7
br label %29
29: ; preds = %19
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %15
32: ; preds = %15
store i32 0, i32* %5
br label %33
33: ; preds = %47, %32
%34 = load i32, i32* %5
%35 = icmp slt i32 %34, 57
br i1 %35, label %36, label %50
36: ; preds = %33
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [56 x i32], [56 x i32]* %4, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = load i32, i32* %7
%42 = icmp eq i32 %40, %41
br i1 %42, label %43, label %46
43: ; preds = %36
%44 = load i32, i32* %5
%45 = add nsw i32 %44, 1
store i32 %45, i32* %2
br label %51
46: ; preds = %36
br label %47
47: ; preds = %46
%48 = load i32, i32* %5
%49 = add nsw i32 %48, 1
store i32 %49, i32* %5
br label %33
50: ; preds = %33
store i32 -1, i32* %2
br label %51
51: ; preds = %50, %43, %13
%52 = load i32, i32* %2
ret i32 %52
}

LLVM IR (-O2):
@__const.lime_str_to_id.LUT = [56 x i32] [i32 98, i32 99, i32 25448, i32 100, i32 102, i32 103, i32 104, i32 106, i32 107, i32 108, i32 109, i32 110, i32 112, i32 113, i32 114, i32 115, i32 29544, i32 116, i32 119, i32 120, i32 121, i32 122, i32 31336, i32 97, i32 24937, i32 24942, i32 6385255, i32 24943, i32 101, i32 25961, i32 25966, i32 6647399, i32 25970, i32 105, i32 26977, i32 6906222, i32 1767992935, i32 6906223, i32 26981, i32 26990, i32 6909543, i32 1768910439, i32 26997, i32 111, i32 7302759, i32 28533, i32 117, i32 30049, i32 7692649, i32 7692654, i32 1969319527, i32 30053, i32 30057, i32 30062, i32 30063, i32 118]
define i32 @lime_str_to_id(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 4
br i1 %3, label %54, label %4
4: ; preds = %1
%5 = icmp sgt i32 %2, 0
br i1 %5, label %8, label %6
6: ; preds = %8, %12, %19, %26, %4
%7 = phi i32 [ 0, %4 ], [ %10, %8 ], [ %17, %12 ], [ %24, %19 ], [ %31, %26 ]
br label %32
8: ; preds = %4
%9 = load i8, i8* %0
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %2, 1
br i1 %11, label %6, label %12
12: ; preds = %8
%13 = shl nsw i32 %10, 8
%14 = getelementptr inbounds i8, i8* %0, i64 1
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = or i32 %13, %16
%18 = icmp eq i32 %2, 2
br i1 %18, label %6, label %19
19: ; preds = %12
%20 = shl nsw i32 %17, 8
%21 = getelementptr inbounds i8, i8* %0, i64 2
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = or i32 %20, %23
%25 = icmp eq i32 %2, 3
br i1 %25, label %6, label %26
26: ; preds = %19
%27 = shl nsw i32 %24, 8
%28 = getelementptr inbounds i8, i8* %0, i64 3
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = or i32 %27, %30
br label %6
32: ; preds = %51, %6
%33 = phi i64 [ 0, %6 ], [ %52, %51 ]
%34 = getelementptr inbounds [56 x i32], [56 x i32]* @__const.lime_str_to_id.LUT, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = icmp eq i32 %35, %7
br i1 %36, label %37, label %41
37: ; preds = %46, %41, %32
%38 = phi i64 [ %33, %32 ], [ %42, %41 ], [ %47, %46 ]
%39 = trunc i64 %38 to i32
%40 = add nuw nsw i32 %39, 1
br label %54
41: ; preds = %32
%42 = add nuw nsw i64 %33, 1
%43 = getelementptr inbounds [56 x i32], [56 x i32]* @__const.lime_str_to_id.LUT, i64 0, i64 %42
%44 = load i32, i32* %43
%45 = icmp eq i32 %44, %7
br i1 %45, label %37, label %46
46: ; preds = %41
%47 = add nuw nsw i64 %33, 2
%48 = getelementptr inbounds [56 x i32], [56 x i32]* @__const.lime_str_to_id.LUT, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = icmp eq i32 %49, %7
br i1 %50, label %37, label %51
51: ; preds = %46
%52 = add nuw nsw i64 %33, 3
%53 = icmp eq i64 %52, 57
br i1 %53, label %54, label %32
54: ; preds = %51, %1, %37
%55 = phi i32 [ %40, %37 ], [ -1, %1 ], [ -1, %51 ]
ret i32 %55
}