#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 */
unsigned int tag_hash(register const char *str, register size_t len) {
  static unsigned short asso_values[] = {
      707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
      707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
      707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
      707, 707, 707, 707, 12,  9,   7,   6,   5,   4,   707, 707, 707, 707, 707,
      707, 707, 707, 707, 707, 8,   139, 215, 186, 13,  32,  213, 219, 107, 4,
      159, 117, 21,  54,  52,  51,  3,   3,   34,  8,   248, 58,  52,  48,  152,
      707, 707, 707, 707, 707, 707, 707, 8,   139, 215, 186, 13,  32,  213, 219,
      107, 4,   159, 117, 21,  54,  52,  51,  3,   3,   34,  8,   248, 58,  52,
      48,  152, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
      707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
      707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
      707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
      707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
      707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
      707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
      707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
      707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707, 707,
      707};
  register unsigned int hval = len;
  switch (hval) {
  default:
    hval += asso_values[(unsigned char)str[2]];
  case 2:
    hval += asso_values[(unsigned char)str[1]];
  case 1:
    hval += asso_values[(unsigned char)str[0]];
    break;
  }
  return hval + asso_values[(unsigned char)str[len - 1]];
}


x86 assembly (clang, -O0):
<tag_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x1,%eax
je     116d <tag_hash+0x6d>
jmp    1126 <tag_hash+0x26>
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
je     1152 <tag_hash+0x52>
jmp    1137 <tag_hash+0x37>
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%eax
mov    %eax,%ecx
lea    0x2ee8(%rip),%rax
movzwl (%rax,%rcx,2),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
mov    %eax,%ecx
lea    0x2ecd(%rip),%rax
movzwl (%rax,%rcx,2),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,%ecx
lea    0x2eb3(%rip),%rax
movzwl (%rax,%rcx,2),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rdx
sub    $0x1,%rdx
movzbl (%rcx,%rdx,1),%ecx
mov    %ecx,%edx
lea    0x2e8d(%rip),%rcx
movzwl (%rcx,%rdx,2),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tag_hash>:
cmp    $0x1,%esi
je     110e <tag_hash+0xe>
cmp    $0x2,%esi
jne    1112 <tag_hash+0x12>
mov    %esi,%eax
jmp    1123 <tag_hash+0x23>
mov    %esi,%ecx
jmp    1134 <tag_hash+0x34>
movzbl 0x2(%rdi),%eax
lea    0xee3(%rip),%rcx
movzwl (%rcx,%rax,2),%eax
add    %esi,%eax
movzbl 0x1(%rdi),%ecx
lea    0xed2(%rip),%rdx
movzwl (%rdx,%rcx,2),%ecx
add    %eax,%ecx
movzbl (%rdi),%eax
lea    0xec2(%rip),%r8
movzwl (%r8,%rax,2),%edx
add    %ecx,%edx
movzbl -0x1(%rsi,%rdi,1),%eax
movzwl (%r8,%rax,2),%eax
add    %edx,%eax
ret

LLVM IR (-O0):
@tag_hash.asso_values = internal global [256 x i16] [i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 12, i16 9, i16 7, i16 6, i16 5, i16 4, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 8, i16 139, i16 215, i16 186, i16 13, i16 32, i16 213, i16 219, i16 107, i16 4, i16 159, i16 117, i16 21, i16 54, i16 52, i16 51, i16 3, i16 3, i16 34, i16 8, i16 248, i16 58, i16 52, i16 48, i16 152, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 8, i16 139, i16 215, i16 186, i16 13, i16 32, i16 213, i16 219, i16 107, i16 4, i16 159, i16 117, i16 21, i16 54, i16 52, i16 51, i16 3, i16 3, i16 34, i16 8, i16 248, i16 58, i16 52, i16 48, i16 152, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707]
define i32 @tag_hash(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = trunc i64 %6 to i32
store i32 %7, i32* %5
%8 = load i32, i32* %5
switch i32 %8, label %9 [
i32 2, label %19
i32 1, label %29
]
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 2
%12 = load i8, i8* %11
%13 = zext i8 %12 to i64
%14 = getelementptr inbounds [256 x i16], [256 x i16]* @tag_hash.asso_values, i64 0, i64 %13
%15 = load i16, i16* %14
%16 = zext i16 %15 to i32
%17 = load i32, i32* %5
%18 = add i32 %17, %16
store i32 %18, i32* %5
br label %19
19: ; preds = %2, %9
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = load i8, i8* %21
%23 = zext i8 %22 to i64
%24 = getelementptr inbounds [256 x i16], [256 x i16]* @tag_hash.asso_values, i64 0, i64 %23
%25 = load i16, i16* %24
%26 = zext i16 %25 to i32
%27 = load i32, i32* %5
%28 = add i32 %27, %26
store i32 %28, i32* %5
br label %29
29: ; preds = %2, %19
%30 = load i8*, i8** %3
%31 = getelementptr inbounds i8, i8* %30, i64 0
%32 = load i8, i8* %31
%33 = zext i8 %32 to i64
%34 = getelementptr inbounds [256 x i16], [256 x i16]* @tag_hash.asso_values, i64 0, i64 %33
%35 = load i16, i16* %34
%36 = zext i16 %35 to i32
%37 = load i32, i32* %5
%38 = add i32 %37, %36
store i32 %38, i32* %5
br label %39
39: ; preds = %29
%40 = load i32, i32* %5
%41 = load i8*, i8** %3
%42 = load i64, i64* %4
%43 = sub i64 %42, 1
%44 = getelementptr inbounds i8, i8* %41, i64 %43
%45 = load i8, i8* %44
%46 = zext i8 %45 to i64
%47 = getelementptr inbounds [256 x i16], [256 x i16]* @tag_hash.asso_values, i64 0, i64 %46
%48 = load i16, i16* %47
%49 = zext i16 %48 to i32
%50 = add i32 %40, %49
ret i32 %50
}

LLVM IR (-O2):
@tag_hash.asso_values = internal unnamed_addr constant [256 x i16] [i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 12, i16 9, i16 7, i16 6, i16 5, i16 4, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 8, i16 139, i16 215, i16 186, i16 13, i16 32, i16 213, i16 219, i16 107, i16 4, i16 159, i16 117, i16 21, i16 54, i16 52, i16 51, i16 3, i16 3, i16 34, i16 8, i16 248, i16 58, i16 52, i16 48, i16 152, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 8, i16 139, i16 215, i16 186, i16 13, i16 32, i16 213, i16 219, i16 107, i16 4, i16 159, i16 117, i16 21, i16 54, i16 52, i16 51, i16 3, i16 3, i16 34, i16 8, i16 248, i16 58, i16 52, i16 48, i16 152, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707, i16 707]
define i32 @tag_hash(i8* nocapture %0, i64 %1) {
%3 = trunc i64 %1 to i32
switch i32 %3, label %4 [
i32 2, label %12
i32 1, label %21
]
4: ; preds = %2
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
%8 = getelementptr inbounds [256 x i16], [256 x i16]* @tag_hash.asso_values, i64 0, i64 %7
%9 = load i16, i16* %8
%10 = zext i16 %9 to i32
%11 = add i32 %10, %3
br label %12
12: ; preds = %2, %4
%13 = phi i32 [ %11, %4 ], [ %3, %2 ]
%14 = getelementptr inbounds i8, i8* %0, i64 1
%15 = load i8, i8* %14
%16 = zext i8 %15 to i64
%17 = getelementptr inbounds [256 x i16], [256 x i16]* @tag_hash.asso_values, i64 0, i64 %16
%18 = load i16, i16* %17
%19 = zext i16 %18 to i32
%20 = add i32 %13, %19
br label %21
21: ; preds = %2, %12
%22 = phi i32 [ %20, %12 ], [ %3, %2 ]
%23 = load i8, i8* %0
%24 = zext i8 %23 to i64
%25 = getelementptr inbounds [256 x i16], [256 x i16]* @tag_hash.asso_values, i64 0, i64 %24
%26 = load i16, i16* %25
%27 = zext i16 %26 to i32
%28 = add i32 %22, %27
%29 = add i64 %1, -1
%30 = getelementptr inbounds i8, i8* %0, i64 %29
%31 = load i8, i8* %30
%32 = zext i8 %31 to i64
%33 = getelementptr inbounds [256 x i16], [256 x i16]* @tag_hash.asso_values, i64 0, i64 %32
%34 = load i16, i16* %33
%35 = zext i16 %34 to i32
%36 = add i32 %28, %35
ret i32 %36
}