unsigned int hash(str, len)
register char *str;
register int unsigned len;
{
  static unsigned char asso_values[] = {
      173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
      173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
      173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
      173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
      173, 173, 173, 173, 1,   173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
      173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
      173, 173, 173, 173, 173, 1,   173, 74,  18,  54,  1,   30,  26,  1,   1,
      42,  173, 3,   61,  28,  57,  15,  2,   173, 5,   50,  1,   56,  3,   7,
      32,  9,   173, 173, 173, 173, 173, 173,
  };
  register int hval = len;
  switch (hval) {
  default:
  case 4:
    hval += asso_values[str[3]];
  case 3:
  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    $0x3,%eax
jb     1158 <hash+0x58>
jmp    1128 <hash+0x28>
mov    -0x14(%rbp),%eax
sub    $0x4,%eax
je     113e <hash+0x3e>
jmp    1139 <hash+0x39>
jmp    113e <hash+0x3e>
mov    -0x8(%rbp),%rax
movsbq 0x3(%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    $0x3,%eax
jb     111c <hash+0x1c>
movsbq 0x3(%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"\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\01\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\01\ADJ\126\01\1E\1A\01\01*\AD\03=\1C9\0F\02\AD\052\018\03\07 \09\AD\AD\AD\AD\AD\AD"
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 4, label %9
i32 3, label %19
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 3
%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, %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"\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\01\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\AD\01\ADJ\126\01\1E\1A\01\01*\AD\03=\1C9\0F\02\AD\052\018\03\07 \09\AD\AD\AD\AD\AD\AD"
define i32 @hash(i8* nocapture %0, i32 %1) {
%3 = add i32 %1, -1
%4 = icmp ult i32 %3, 3
br i1 %4, label %13, label %5
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %0, i64 3
%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
}