#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 hash(register const char *str, register size_t len) {
  static const unsigned short asso_values[] = {
      272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
      272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
      272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
      272, 272, 272, 272, 9,   7,   6,   4,   4,   3,   4,   3,   3,   272, 272,
      272, 272, 272, 272, 272, 70,  83,  152, 7,   16,  61,  98,  5,   76,  102,
      126, 12,  19,  54,  54,  31,  97,  3,   4,   9,   33,  136, 113, 86,  15,
      272, 272, 272, 272, 272, 272, 272, 70,  83,  152, 7,   16,  61,  98,  5,
      76,  102, 126, 12,  19,  54,  54,  31,  97,  3,   4,   9,   33,  136, 113,
      86,  15,  272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
      272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
      272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
      272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
      272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
      272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
      272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
      272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
      272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
      272, 272, 272, 272};
  register unsigned int hval = len;
  switch (hval) {
  default:
    hval += asso_values[(unsigned char)str[1] + 3];
  case 1:
    hval += asso_values[(unsigned char)str[0]];
    break;
  }
  return hval + asso_values[(unsigned char)str[len - 1]];
}


x86 assembly (clang, -O0):
<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
sub    $0x1,%eax
je     1142 <hash+0x42>
jmp    1123 <hash+0x23>
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
add    $0x3,%eax
movslq %eax,%rcx
lea    0xec8(%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    0xeae(%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    0xe88(%rip),%rcx
movzwl (%rcx,%rdx,2),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    $0x1,%eax
cmp    $0x1,%esi
je     111c <hash+0x1c>
movzbl 0x1(%rdi),%eax
lea    0xeeb(%rip),%rcx
movzwl 0x6(%rcx,%rax,2),%eax
add    %esi,%eax
movzbl (%rdi),%ecx
lea    0xeda(%rip),%rdx
movzwl (%rdx,%rcx,2),%ecx
add    %eax,%ecx
movzbl -0x1(%rsi,%rdi,1),%eax
movzwl (%rdx,%rax,2),%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
@hash.asso_values = internal constant [259 x i16] [i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 9, i16 7, i16 6, i16 4, i16 4, i16 3, i16 4, i16 3, i16 3, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 70, i16 83, i16 152, i16 7, i16 16, i16 61, i16 98, i16 5, i16 76, i16 102, i16 126, i16 12, i16 19, i16 54, i16 54, i16 31, i16 97, i16 3, i16 4, i16 9, i16 33, i16 136, i16 113, i16 86, i16 15, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 70, i16 83, i16 152, i16 7, i16 16, i16 61, i16 98, i16 5, i16 76, i16 102, i16 126, i16 12, i16 19, i16 54, i16 54, i16 31, i16 97, i16 3, i16 4, i16 9, i16 33, i16 136, i16 113, i16 86, i16 15, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272]
define i32 @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 1, label %21
]
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = add nsw i32 %13, 3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [259 x i16], [259 x i16]* @hash.asso_values, i64 0, i64 %15
%17 = load i16, i16* %16
%18 = zext i16 %17 to i32
%19 = load i32, i32* %5
%20 = add i32 %19, %18
store i32 %20, i32* %5
br label %21
21: ; preds = %2, %9
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i64 0
%24 = load i8, i8* %23
%25 = zext i8 %24 to i64
%26 = getelementptr inbounds [259 x i16], [259 x i16]* @hash.asso_values, i64 0, i64 %25
%27 = load i16, i16* %26
%28 = zext i16 %27 to i32
%29 = load i32, i32* %5
%30 = add i32 %29, %28
store i32 %30, i32* %5
br label %31
31: ; preds = %21
%32 = load i32, i32* %5
%33 = load i8*, i8** %3
%34 = load i64, i64* %4
%35 = sub i64 %34, 1
%36 = getelementptr inbounds i8, i8* %33, i64 %35
%37 = load i8, i8* %36
%38 = zext i8 %37 to i64
%39 = getelementptr inbounds [259 x i16], [259 x i16]* @hash.asso_values, i64 0, i64 %38
%40 = load i16, i16* %39
%41 = zext i16 %40 to i32
%42 = add i32 %32, %41
ret i32 %42
}

LLVM IR (-O2):
@hash.asso_values = internal unnamed_addr constant [259 x i16] [i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 9, i16 7, i16 6, i16 4, i16 4, i16 3, i16 4, i16 3, i16 3, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 70, i16 83, i16 152, i16 7, i16 16, i16 61, i16 98, i16 5, i16 76, i16 102, i16 126, i16 12, i16 19, i16 54, i16 54, i16 31, i16 97, i16 3, i16 4, i16 9, i16 33, i16 136, i16 113, i16 86, i16 15, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 70, i16 83, i16 152, i16 7, i16 16, i16 61, i16 98, i16 5, i16 76, i16 102, i16 126, i16 12, i16 19, i16 54, i16 54, i16 31, i16 97, i16 3, i16 4, i16 9, i16 33, i16 136, i16 113, i16 86, i16 15, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272, i16 272]
define i32 @hash(i8* nocapture %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = icmp eq i32 %3, 1
br i1 %4, label %14, label %5
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = zext i8 %7 to i64
%9 = add nuw nsw i64 %8, 3
%10 = getelementptr inbounds [259 x i16], [259 x i16]* @hash.asso_values, i64 0, i64 %9
%11 = load i16, i16* %10
%12 = zext i16 %11 to i32
%13 = add i32 %12, %3
br label %14
14: ; preds = %2, %5
%15 = phi i32 [ 1, %2 ], [ %13, %5 ]
%16 = load i8, i8* %0
%17 = zext i8 %16 to i64
%18 = getelementptr inbounds [259 x i16], [259 x i16]* @hash.asso_values, i64 0, i64 %17
%19 = load i16, i16* %18
%20 = zext i16 %19 to i32
%21 = add i32 %15, %20
%22 = add i64 %1, -1
%23 = getelementptr inbounds i8, i8* %0, i64 %22
%24 = load i8, i8* %23
%25 = zext i8 %24 to i64
%26 = getelementptr inbounds [259 x i16], [259 x i16]* @hash.asso_values, i64 0, i64 %25
%27 = load i16, i16* %26
%28 = zext i16 %27 to i32
%29 = add i32 %21, %28
ret i32 %29
}