unsigned int hash(str, len)
register char *str;
register int unsigned len;
{
  static unsigned char asso_values[] = {
      212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212,
      212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212,
      212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212,
      212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212,
      212, 212, 212, 212, 34,  212, 212, 212, 212, 212, 212, 212, 212, 212, 212,
      212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212,
      212, 212, 212, 212, 212, 1,   212, 115, 7,   37,  20,  6,   75,  46,  12,
      13,  212, 1,   15,  8,   61,  91,  58,  212, 19,  8,   1,   20,  65,  6,
      23,  4,   2,   212, 212, 212, 212, 212,
  };
  register int hval = len;
  switch (hval) {
  default:
  case 3:
    hval += asso_values[str[2]];
  case 2:
  case 1:
    hval += asso_values[str[0]];
    break;
  }
  return hval + asso_values[str[len - 1]];
}


x86 assembly (clang, -O0):
<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)
add    $0xffffffff,%eax
sub    $0x2,%eax
jb     1158 <hash+0x58>
jmp    1128 <hash+0x28>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     113e <hash+0x3e>
jmp    1139 <hash+0x39>
jmp    113e <hash+0x3e>
mov    -0x8(%rbp),%rax
movsbq 0x2(%rax),%rcx
lea    0x2ee2(%rip),%rax
movzbl (%rax,%rcx,1),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbq (%rax),%rcx
lea    0x2ec9(%rip),%rax
movzbl (%rax,%rcx,1),%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
movsbq (%rcx,%rdx,1),%rdx
lea    0x2ea4(%rip),%rcx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
lea    -0x1(%rsi),%eax
cmp    $0x2,%eax
jb     111c <hash+0x1c>
movsbq 0x2(%rdi),%rcx
lea    0xeec(%rip),%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %esi,%ecx
mov    %ecx,%esi
movsbq (%rdi),%rcx
lea    0xed9(%rip),%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %esi,%ecx
mov    %eax,%eax
movsbq (%rdi,%rax,1),%rax
movzbl (%rax,%rdx,1),%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
@hash.asso_values = internal global [128 x i8] c"\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\22\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\01\D4s\07%\14\06K.\0C\0D\D4\01\0F\08=[:\D4\13\08\01\14A\06\17\04\02\D4\D4\D4\D4\D4"
define i32 @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 3, label %9
i32 2, label %19
i32 1, label %19
]
8: ; preds = %2
br label %9
9: ; preds = %2, %8
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 2
%12 = load i8, i8* %11
%13 = sext i8 %12 to i64
%14 = getelementptr inbounds [128 x i8], [128 x i8]* @hash.asso_values, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = load i32, i32* %5
%18 = add nsw i32 %17, %16
store i32 %18, i32* %5
br label %19
19: ; preds = %2, %2, %9
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
%23 = sext i8 %22 to i64
%24 = getelementptr inbounds [128 x i8], [128 x i8]* @hash.asso_values, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = load i32, i32* %5
%28 = add nsw i32 %27, %26
store i32 %28, i32* %5
br label %29
29: ; preds = %19
%30 = load i32, i32* %5
%31 = load i8*, i8** %3
%32 = load i32, i32* %4
%33 = sub i32 %32, 1
%34 = zext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %31, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i64
%38 = getelementptr inbounds [128 x i8], [128 x i8]* @hash.asso_values, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = add nsw i32 %30, %40
ret i32 %41
}

LLVM IR (-O2):
@hash.asso_values = internal unnamed_addr constant [128 x i8] c"\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\22\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\D4\01\D4s\07%\14\06K.\0C\0D\D4\01\0F\08=[:\D4\13\08\01\14A\06\17\04\02\D4\D4\D4\D4\D4"
define i32 @hash(i8* nocapture %0, i32 %1) {
%3 = add i32 %1, -1
%4 = icmp ult i32 %3, 2
br i1 %4, label %13, label %5
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %0, i64 2
%7 = load i8, i8* %6
%8 = sext i8 %7 to i64
%9 = getelementptr inbounds [128 x i8], [128 x i8]* @hash.asso_values, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = add nsw i32 %11, %1
br label %13
13: ; preds = %2, %5
%14 = phi i32 [ %12, %5 ], [ %1, %2 ]
%15 = load i8, i8* %0
%16 = sext i8 %15 to i64
%17 = getelementptr inbounds [128 x i8], [128 x i8]* @hash.asso_values, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = add nsw i32 %14, %19
%21 = zext i32 %3 to i64
%22 = getelementptr inbounds i8, i8* %0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i64
%25 = getelementptr inbounds [128 x i8], [128 x i8]* @hash.asso_values, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = add nsw i32 %20, %27
ret i32 %28
}