unsigned int directive_hash(register const char *str,
                            register unsigned int len) {
  static const unsigned char asso_values[] = {
      37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
      37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
      37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
      37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
      37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
      37, 37, 37, 37, 37, 37, 37, 10, 37, 37, 20, 0,  5,  5,  20, 15, 37, 37,
      5,  5,  0,  5,  5,  37, 5,  0,  37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
      37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
      37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
      37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
      37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
      37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
      37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
      37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
      37, 37, 37, 37};
  register int hval = len;
  switch (hval) {
  default:
    hval += asso_values[(unsigned char)str[3]];
  case 3:
  case 2:
    hval += asso_values[(unsigned char)str[1]];
    break;
  }
  return hval;
}


x86 assembly (clang, -O0):
<directive_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
add    $0xfffffffe,%eax
sub    $0x2,%eax
jb     1140 <directive_hash+0x40>
jmp    1125 <directive_hash+0x25>
mov    -0x8(%rbp),%rax
movzbl 0x3(%rax),%eax
mov    %eax,%ecx
lea    0xeca(%rip),%rax
movzbl (%rax,%rcx,1),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
mov    %eax,%ecx
lea    0xeaf(%rip),%rax
movzbl (%rax,%rcx,1),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<directive_hash>:
mov    %esi,%eax
and    $0xfffffffe,%eax
cmp    $0x2,%eax
je     111b <directive_hash+0x1b>
movzbl 0x3(%rdi),%eax
lea    0xeeb(%rip),%rcx
movzbl (%rax,%rcx,1),%eax
add    %eax,%esi
movzbl 0x1(%rdi),%eax
lea    0xeda(%rip),%rcx
movzbl (%rax,%rcx,1),%eax
add    %esi,%eax
ret

LLVM IR (-O0):
@directive_hash.asso_values = internal constant [256 x i8] c"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\0A%%\14\00\05\05\14\0F%%\05\05\00\05\05%\05\00%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
define i32 @directive_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 %18
i32 2, label %18
]
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 3
%11 = load i8, i8* %10
%12 = zext i8 %11 to i64
%13 = getelementptr inbounds [256 x i8], [256 x i8]* @directive_hash.asso_values, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = load i32, i32* %5
%17 = add nsw i32 %16, %15
store i32 %17, i32* %5
br label %18
18: ; preds = %2, %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 i8], [256 x i8]* @directive_hash.asso_values, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = load i32, i32* %5
%27 = add nsw i32 %26, %25
store i32 %27, i32* %5
br label %28
28: ; preds = %18
%29 = load i32, i32* %5
ret i32 %29
}

LLVM IR (-O2):
@directive_hash.asso_values = internal unnamed_addr constant [256 x i8] c"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\0A%%\14\00\05\05\14\0F%%\05\05\00\05\05%\05\00%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
define i32 @directive_hash(i8* nocapture %0, i32 %1) {
%3 = and i32 %1, -2
%4 = icmp eq i32 %3, 2
br i1 %4, label %13, label %5
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %0, i64 3
%7 = load i8, i8* %6
%8 = zext i8 %7 to i64
%9 = getelementptr inbounds [256 x i8], [256 x i8]* @directive_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 = getelementptr inbounds i8, i8* %0, i64 1
%16 = load i8, i8* %15
%17 = zext i8 %16 to i64
%18 = getelementptr inbounds [256 x i8], [256 x i8]* @directive_hash.asso_values, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = add nsw i32 %14, %20
ret i32 %21
}