unsigned int tag_hash(register const char *str, register unsigned int len) {
  static unsigned short asso_values[] = {
      705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705,
      705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705,
      705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705,
      705, 705, 705, 705, 22,  17,  12,  11,  9,   5,   705, 705, 705, 705, 705,
      705, 705, 705, 705, 705, 15,  182, 165, 120, 17,  25,  160, 261, 124, 7,
      214, 142, 13,  61,  54,  58,  6,   4,   48,  9,   204, 14,  49,  199, 136,
      705, 705, 705, 705, 705, 705, 705, 15,  182, 165, 120, 17,  25,  160, 261,
      124, 7,   214, 142, 13,  61,  54,  58,  6,   4,   48,  9,   204, 14,  49,
      199, 136, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705,
      705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705,
      705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705,
      705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705,
      705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705,
      705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705,
      705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705,
      705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705,
      705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, 705,
      705};
  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    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     116c <tag_hash+0x6c>
jmp    1125 <tag_hash+0x25>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     1151 <tag_hash+0x51>
jmp    1136 <tag_hash+0x36>
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%eax
mov    %eax,%ecx
lea    0x2ee9(%rip),%rax
movzwl (%rax,%rcx,2),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
mov    %eax,%ecx
lea    0x2ece(%rip),%rax
movzwl (%rax,%rcx,2),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,%ecx
lea    0x2eb4(%rip),%rax
movzwl (%rax,%rcx,2),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
mov    %edx,%edx
movzbl (%rcx,%rdx,1),%ecx
mov    %ecx,%edx
lea    0x2e8e(%rip),%rcx
movzwl (%rcx,%rdx,2),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tag_hash>:
mov    %esi,%ecx
cmp    $0x1,%esi
je     1130 <tag_hash+0x30>
mov    %esi,%eax
cmp    $0x2,%esi
je     111f <tag_hash+0x1f>
movzbl 0x2(%rdi),%eax
lea    0xee7(%rip),%rcx
movzwl (%rcx,%rax,2),%eax
add    %esi,%eax
movzbl 0x1(%rdi),%ecx
lea    0xed6(%rip),%rdx
movzwl (%rdx,%rcx,2),%ecx
add    %eax,%ecx
movzbl (%rdi),%eax
lea    0xec6(%rip),%r8
movzwl (%r8,%rax,2),%edx
add    %ecx,%edx
add    $0xffffffff,%esi
movzbl (%rdi,%rsi,1),%eax
movzwl (%r8,%rax,2),%eax
add    %edx,%eax
ret

LLVM IR (-O0):
@tag_hash.asso_values = internal global [256 x i16] [i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 22, i16 17, i16 12, i16 11, i16 9, i16 5, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 15, i16 182, i16 165, i16 120, i16 17, i16 25, i16 160, i16 261, i16 124, i16 7, i16 214, i16 142, i16 13, i16 61, i16 54, i16 58, i16 6, i16 4, i16 48, i16 9, i16 204, i16 14, i16 49, i16 199, i16 136, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 15, i16 182, i16 165, i16 120, i16 17, i16 25, i16 160, i16 261, i16 124, i16 7, i16 214, i16 142, i16 13, i16 61, i16 54, i16 58, i16 6, i16 4, i16 48, i16 9, i16 204, i16 14, i16 49, i16 199, i16 136, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705]
define i32 @tag_hash(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
store i32 %6, i32* %5
%7 = load i32, i32* %5
switch i32 %7, label %8 [
i32 2, label %18
i32 1, label %28
]
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i64
%13 = getelementptr inbounds [256 x i16], [256 x i16]* @tag_hash.asso_values, i64 0, i64 %12
%14 = load i16, i16* %13
%15 = zext i16 %14 to i32
%16 = load i32, i32* %5
%17 = add i32 %16, %15
store i32 %17, i32* %5
br label %18
18: ; preds = %2, %8
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 1
%21 = load i8, i8* %20
%22 = zext i8 %21 to i64
%23 = getelementptr inbounds [256 x i16], [256 x i16]* @tag_hash.asso_values, i64 0, i64 %22
%24 = load i16, i16* %23
%25 = zext i16 %24 to i32
%26 = load i32, i32* %5
%27 = add i32 %26, %25
store i32 %27, i32* %5
br label %28
28: ; preds = %2, %18
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i64 0
%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 = load i32, i32* %5
%37 = add i32 %36, %35
store i32 %37, i32* %5
br label %38
38: ; preds = %28
%39 = load i32, i32* %5
%40 = load i8*, i8** %3
%41 = load i32, i32* %4
%42 = sub i32 %41, 1
%43 = zext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %40, 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 %39, %49
ret i32 %50
}

LLVM IR (-O2):
@tag_hash.asso_values = internal unnamed_addr constant [256 x i16] [i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 22, i16 17, i16 12, i16 11, i16 9, i16 5, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 15, i16 182, i16 165, i16 120, i16 17, i16 25, i16 160, i16 261, i16 124, i16 7, i16 214, i16 142, i16 13, i16 61, i16 54, i16 58, i16 6, i16 4, i16 48, i16 9, i16 204, i16 14, i16 49, i16 199, i16 136, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 15, i16 182, i16 165, i16 120, i16 17, i16 25, i16 160, i16 261, i16 124, i16 7, i16 214, i16 142, i16 13, i16 61, i16 54, i16 58, i16 6, i16 4, i16 48, i16 9, i16 204, i16 14, i16 49, i16 199, i16 136, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705, i16 705]
define i32 @tag_hash(i8* nocapture %0, i32 %1) {
switch i32 %1, label %3 [
i32 2, label %11
i32 1, label %20
]
3: ; preds = %2
%4 = getelementptr inbounds i8, i8* %0, i64 2
%5 = load i8, i8* %4
%6 = zext i8 %5 to i64
%7 = getelementptr inbounds [256 x i16], [256 x i16]* @tag_hash.asso_values, i64 0, i64 %6
%8 = load i16, i16* %7
%9 = zext i16 %8 to i32
%10 = add i32 %9, %1
br label %11
11: ; preds = %2, %3
%12 = phi i32 [ %10, %3 ], [ %1, %2 ]
%13 = getelementptr inbounds i8, i8* %0, i64 1
%14 = load i8, i8* %13
%15 = zext i8 %14 to i64
%16 = getelementptr inbounds [256 x i16], [256 x i16]* @tag_hash.asso_values, i64 0, i64 %15
%17 = load i16, i16* %16
%18 = zext i16 %17 to i32
%19 = add i32 %12, %18
br label %20
20: ; preds = %2, %11
%21 = phi i32 [ %19, %11 ], [ %1, %2 ]
%22 = load i8, i8* %0
%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 = add i32 %21, %26
%28 = add i32 %1, -1
%29 = zext i32 %28 to i64
%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 %27, %35
ret i32 %36
}