#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 */
typedef int uint8_t;

/* Variables and functions */
size_t hfunc_pearson(const uint8_t *key, const size_t klen) {
  size_t i, j;
  size_t out = 0;
  uint8_t h;
  const uint8_t T[] = {
      1,   87,  49,  12,  176, 178, 102, 166, 121, 193, 6,   84,  249, 230, 44,
      163, 14,  197, 213, 181, 161, 85,  218, 80,  64,  239, 24,  226, 236, 142,
      38,  200, 110, 177, 104, 103, 141, 253, 255, 50,  77,  101, 81,  18,  45,
      96,  31,  222, 25,  107, 190, 70,  86,  237, 240, 34,  72,  242, 20,  214,
      244, 227, 149, 235, 97,  234, 57,  22,  60,  250, 82,  175, 208, 5,   127,
      199, 111, 62,  135, 248, 174, 169, 211, 58,  66,  154, 106, 195, 245, 171,
      17,  187, 182, 179, 0,   243, 132, 56,  148, 75,  128, 133, 158, 100, 130,
      126, 91,  13,  153, 246, 216, 219, 119, 68,  223, 78,  83,  88,  201, 99,
      122, 11,  92,  32,  136, 114, 52,  10,  138, 30,  48,  183, 156, 35,  61,
      26,  143, 74,  251, 94,  129, 162, 63,  152, 170, 7,   115, 167, 241, 206,
      3,   150, 55,  59,  151, 220, 90,  53,  23,  131, 125, 173, 15,  238, 79,
      95,  89,  16,  105, 137, 225, 224, 217, 160, 37,  123, 118, 73,  2,   157,
      46,  116, 9,   145, 134, 228, 207, 212, 202, 215, 69,  229, 27,  188, 67,
      124, 168, 252, 42,  4,   29,  108, 21,  247, 19,  205, 39,  203, 233, 40,
      186, 147, 198, 192, 155, 33,  164, 191, 98,  204, 165, 180, 117, 76,  140,
      36,  210, 172, 41,  54,  159, 8,   185, 232, 113, 196, 231, 47,  146, 120,
      51,  65,  28,  144, 254, 221, 93,  189, 194, 139, 112, 43,  71,  109, 184,
      209};
  for (j = 0; j < sizeof(size_t); j++) {
    h = T[(key[0] + j) & 0xff];
    for (i = 1; i < klen; i++)
      h = T[h ^ key[i]];
    out <<= 8;
    out |= h;
  }
  return out;
}


x86 assembly (clang, -O0):
<hfunc_pearson>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x28(%rbp)
lea    -0x430(%rbp),%rdi
lea    0xec7(%rip),%rsi
mov    $0x400,%edx
call   1030 <memcpy@plt>
movq   $0x0,-0x20(%rbp)
cmpq   $0x8,-0x20(%rbp)
jae    11db <hfunc_pearson+0xcb>
mov    -0x8(%rbp),%rax
movslq (%rax),%rax
add    -0x20(%rbp),%rax
and    $0xff,%rax
mov    -0x430(%rbp,%rax,4),%eax
mov    %eax,-0x2c(%rbp)
movq   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11b2 <hfunc_pearson+0xa2>
mov    -0x2c(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rdx
xor    (%rcx,%rdx,4),%eax
cltq
mov    -0x430(%rbp,%rax,4),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1179 <hfunc_pearson+0x69>
mov    -0x28(%rbp),%rax
shl    $0x8,%rax
mov    %rax,-0x28(%rbp)
movslq -0x2c(%rbp),%rax
or     -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    114b <hfunc_pearson+0x3b>
mov    -0x28(%rbp),%rax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hfunc_pearson>:
push   %r15
push   %r14
push   %rbx
mov    (%rdi),%r9d
lea    -0x1(%rsi),%r10
lea    -0x2(%rsi),%r8
mov    %r10d,%r14d
and    $0x3,%r14d
and    $0xfffffffffffffffc,%r10
xor    %eax,%eax
lea    0xedc(%rip),%r15
xor    %r11d,%r11d
jmp    114b <hfunc_pearson+0x4b>
nopl   0x0(%rax)
mov    %rax,%rcx
shl    $0x8,%rcx
movslq %ebx,%rax
or     %rcx,%rax
add    $0x1,%r11
cmp    $0x8,%r11
je     11d8 <hfunc_pearson+0xd8>
lea    (%r11,%r9,1),%ecx
movzbl %cl,%ecx
mov    (%r15,%rcx,4),%ebx
cmp    $0x2,%rsi
jb     1130 <hfunc_pearson+0x30>
mov    $0x1,%edx
cmp    $0x3,%r8
jb     11a9 <hfunc_pearson+0xa9>
xor    %edx,%edx
nopl   0x0(%rax)
xor    0x4(%rdi,%rdx,4),%ebx
movslq %ebx,%rcx
mov    0x8(%rdi,%rdx,4),%ebx
xor    (%r15,%rcx,4),%ebx
mov    0xc(%rdi,%rdx,4),%ecx
movslq %ebx,%rbx
xor    (%r15,%rbx,4),%ecx
movslq %ecx,%rcx
mov    0x10(%rdi,%rdx,4),%ebx
xor    (%r15,%rcx,4),%ebx
movslq %ebx,%rcx
mov    (%r15,%rcx,4),%ebx
add    $0x4,%rdx
cmp    %rdx,%r10
jne    1170 <hfunc_pearson+0x70>
add    $0x1,%rdx
test   %r14,%r14
je     1130 <hfunc_pearson+0x30>
lea    (%rdi,%rdx,4),%rdx
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    (%rdx,%rcx,4),%ebx
movslq %ebx,%rbx
mov    (%r15,%rbx,4),%ebx
add    $0x1,%rcx
cmp    %rcx,%r14
jne    11c0 <hfunc_pearson+0xc0>
jmp    1130 <hfunc_pearson+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.hfunc_pearson.T = [256 x i32] [i32 1, i32 87, i32 49, i32 12, i32 176, i32 178, i32 102, i32 166, i32 121, i32 193, i32 6, i32 84, i32 249, i32 230, i32 44, i32 163, i32 14, i32 197, i32 213, i32 181, i32 161, i32 85, i32 218, i32 80, i32 64, i32 239, i32 24, i32 226, i32 236, i32 142, i32 38, i32 200, i32 110, i32 177, i32 104, i32 103, i32 141, i32 253, i32 255, i32 50, i32 77, i32 101, i32 81, i32 18, i32 45, i32 96, i32 31, i32 222, i32 25, i32 107, i32 190, i32 70, i32 86, i32 237, i32 240, i32 34, i32 72, i32 242, i32 20, i32 214, i32 244, i32 227, i32 149, i32 235, i32 97, i32 234, i32 57, i32 22, i32 60, i32 250, i32 82, i32 175, i32 208, i32 5, i32 127, i32 199, i32 111, i32 62, i32 135, i32 248, i32 174, i32 169, i32 211, i32 58, i32 66, i32 154, i32 106, i32 195, i32 245, i32 171, i32 17, i32 187, i32 182, i32 179, i32 0, i32 243, i32 132, i32 56, i32 148, i32 75, i32 128, i32 133, i32 158, i32 100, i32 130, i32 126, i32 91, i32 13, i32 153, i32 246, i32 216, i32 219, i32 119, i32 68, i32 223, i32 78, i32 83, i32 88, i32 201, i32 99, i32 122, i32 11, i32 92, i32 32, i32 136, i32 114, i32 52, i32 10, i32 138, i32 30, i32 48, i32 183, i32 156, i32 35, i32 61, i32 26, i32 143, i32 74, i32 251, i32 94, i32 129, i32 162, i32 63, i32 152, i32 170, i32 7, i32 115, i32 167, i32 241, i32 206, i32 3, i32 150, i32 55, i32 59, i32 151, i32 220, i32 90, i32 53, i32 23, i32 131, i32 125, i32 173, i32 15, i32 238, i32 79, i32 95, i32 89, i32 16, i32 105, i32 137, i32 225, i32 224, i32 217, i32 160, i32 37, i32 123, i32 118, i32 73, i32 2, i32 157, i32 46, i32 116, i32 9, i32 145, i32 134, i32 228, i32 207, i32 212, i32 202, i32 215, i32 69, i32 229, i32 27, i32 188, i32 67, i32 124, i32 168, i32 252, i32 42, i32 4, i32 29, i32 108, i32 21, i32 247, i32 19, i32 205, i32 39, i32 203, i32 233, i32 40, i32 186, i32 147, i32 198, i32 192, i32 155, i32 33, i32 164, i32 191, i32 98, i32 204, i32 165, i32 180, i32 117, i32 76, i32 140, i32 36, i32 210, i32 172, i32 41, i32 54, i32 159, i32 8, i32 185, i32 232, i32 113, i32 196, i32 231, i32 47, i32 146, i32 120, i32 51, i32 65, i32 28, i32 144, i32 254, i32 221, i32 93, i32 189, i32 194, i32 139, i32 112, i32 43, i32 71, i32 109, i32 184, i32 209]
define i64 @hfunc_pearson(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
%9 = alloca [256 x i32]
store i32* %0, i32** %3
store i64 %1, i64* %4
store i64 0, i64* %7
%10 = bitcast [256 x i32]* %9 to i8*
store i64 0, i64* %6
br label %11
11: ; preds = %48, %2
%12 = load i64, i64* %6
%13 = icmp ult i64 %12, 8
br i1 %13, label %14, label %51
14: ; preds = %11
%15 = load i32*, i32** %3
%16 = getelementptr inbounds i32, i32* %15, i64 0
%17 = load i32, i32* %16
%18 = sext i32 %17 to i64
%19 = load i64, i64* %6
%20 = add i64 %18, %19
%21 = and i64 %20, 255
%22 = getelementptr inbounds [256 x i32], [256 x i32]* %9, i64 0, i64 %21
%23 = load i32, i32* %22
store i32 %23, i32* %8
store i64 1, i64* %5
br label %24
24: ; preds = %38, %14
%25 = load i64, i64* %5
%26 = load i64, i64* %4
%27 = icmp ult i64 %25, %26
br i1 %27, label %28, label %41
28: ; preds = %24
%29 = load i32, i32* %8
%30 = load i32*, i32** %3
%31 = load i64, i64* %5
%32 = getelementptr inbounds i32, i32* %30, i64 %31
%33 = load i32, i32* %32
%34 = xor i32 %29, %33
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [256 x i32], [256 x i32]* %9, i64 0, i64 %35
%37 = load i32, i32* %36
store i32 %37, i32* %8
br label %38
38: ; preds = %28
%39 = load i64, i64* %5
%40 = add i64 %39, 1
store i64 %40, i64* %5
br label %24
41: ; preds = %24
%42 = load i64, i64* %7
%43 = shl i64 %42, 8
store i64 %43, i64* %7
%44 = load i32, i32* %8
%45 = sext i32 %44 to i64
%46 = load i64, i64* %7
%47 = or i64 %46, %45
store i64 %47, i64* %7
br label %48
48: ; preds = %41
%49 = load i64, i64* %6
%50 = add i64 %49, 1
store i64 %50, i64* %6
br label %11
51: ; preds = %11
%52 = load i64, i64* %7
ret i64 %52
}

LLVM IR (-O2):
@__const.hfunc_pearson.T = [256 x i32] [i32 1, i32 87, i32 49, i32 12, i32 176, i32 178, i32 102, i32 166, i32 121, i32 193, i32 6, i32 84, i32 249, i32 230, i32 44, i32 163, i32 14, i32 197, i32 213, i32 181, i32 161, i32 85, i32 218, i32 80, i32 64, i32 239, i32 24, i32 226, i32 236, i32 142, i32 38, i32 200, i32 110, i32 177, i32 104, i32 103, i32 141, i32 253, i32 255, i32 50, i32 77, i32 101, i32 81, i32 18, i32 45, i32 96, i32 31, i32 222, i32 25, i32 107, i32 190, i32 70, i32 86, i32 237, i32 240, i32 34, i32 72, i32 242, i32 20, i32 214, i32 244, i32 227, i32 149, i32 235, i32 97, i32 234, i32 57, i32 22, i32 60, i32 250, i32 82, i32 175, i32 208, i32 5, i32 127, i32 199, i32 111, i32 62, i32 135, i32 248, i32 174, i32 169, i32 211, i32 58, i32 66, i32 154, i32 106, i32 195, i32 245, i32 171, i32 17, i32 187, i32 182, i32 179, i32 0, i32 243, i32 132, i32 56, i32 148, i32 75, i32 128, i32 133, i32 158, i32 100, i32 130, i32 126, i32 91, i32 13, i32 153, i32 246, i32 216, i32 219, i32 119, i32 68, i32 223, i32 78, i32 83, i32 88, i32 201, i32 99, i32 122, i32 11, i32 92, i32 32, i32 136, i32 114, i32 52, i32 10, i32 138, i32 30, i32 48, i32 183, i32 156, i32 35, i32 61, i32 26, i32 143, i32 74, i32 251, i32 94, i32 129, i32 162, i32 63, i32 152, i32 170, i32 7, i32 115, i32 167, i32 241, i32 206, i32 3, i32 150, i32 55, i32 59, i32 151, i32 220, i32 90, i32 53, i32 23, i32 131, i32 125, i32 173, i32 15, i32 238, i32 79, i32 95, i32 89, i32 16, i32 105, i32 137, i32 225, i32 224, i32 217, i32 160, i32 37, i32 123, i32 118, i32 73, i32 2, i32 157, i32 46, i32 116, i32 9, i32 145, i32 134, i32 228, i32 207, i32 212, i32 202, i32 215, i32 69, i32 229, i32 27, i32 188, i32 67, i32 124, i32 168, i32 252, i32 42, i32 4, i32 29, i32 108, i32 21, i32 247, i32 19, i32 205, i32 39, i32 203, i32 233, i32 40, i32 186, i32 147, i32 198, i32 192, i32 155, i32 33, i32 164, i32 191, i32 98, i32 204, i32 165, i32 180, i32 117, i32 76, i32 140, i32 36, i32 210, i32 172, i32 41, i32 54, i32 159, i32 8, i32 185, i32 232, i32 113, i32 196, i32 231, i32 47, i32 146, i32 120, i32 51, i32 65, i32 28, i32 144, i32 254, i32 221, i32 93, i32 189, i32 194, i32 139, i32 112, i32 43, i32 71, i32 109, i32 184, i32 209]
define i64 @hfunc_pearson(i32* nocapture %0, i64 %1) {
%3 = load i32, i32* %0
%4 = zext i32 %3 to i64
%5 = icmp ugt i64 %1, 1
%6 = add i64 %1, -1
%7 = add i64 %1, -2
%8 = and i64 %6, 3
%9 = icmp ult i64 %7, 3
%10 = and i64 %6, -4
%11 = icmp eq i64 %8, 0
br label %12
12: ; preds = %2, %71
%13 = phi i64 [ 0, %2 ], [ %75, %71 ]
%14 = phi i64 [ 0, %2 ], [ %76, %71 ]
%15 = add nuw nsw i64 %14, %4
%16 = and i64 %15, 255
%17 = getelementptr inbounds [256 x i32], [256 x i32]* @__const.hfunc_pearson.T, i64 0, i64 %16
%18 = load i32, i32* %17
br i1 %5, label %19, label %71
19: ; preds = %12
br i1 %9, label %54, label %20
20: ; preds = %19, %20
%21 = phi i32 [ %51, %20 ], [ %18, %19 ]
%22 = phi i64 [ %49, %20 ], [ 1, %19 ]
%23 = phi i64 [ %52, %20 ], [ 0, %19 ]
%24 = getelementptr inbounds i32, i32* %0, i64 %22
%25 = load i32, i32* %24
%26 = xor i32 %25, %21
%27 = sext i32 %26 to i64
%28 = add nuw nsw i64 %22, 1
%29 = getelementptr inbounds [256 x i32], [256 x i32]* @__const.hfunc_pearson.T, i64 0, i64 %27
%30 = load i32, i32* %29
%31 = getelementptr inbounds i32, i32* %0, i64 %28
%32 = load i32, i32* %31
%33 = xor i32 %32, %30
%34 = sext i32 %33 to i64
%35 = add nuw nsw i64 %22, 2
%36 = getelementptr inbounds [256 x i32], [256 x i32]* @__const.hfunc_pearson.T, i64 0, i64 %34
%37 = load i32, i32* %36
%38 = getelementptr inbounds i32, i32* %0, i64 %35
%39 = load i32, i32* %38
%40 = xor i32 %39, %37
%41 = sext i32 %40 to i64
%42 = add nuw i64 %22, 3
%43 = getelementptr inbounds [256 x i32], [256 x i32]* @__const.hfunc_pearson.T, i64 0, i64 %41
%44 = load i32, i32* %43
%45 = getelementptr inbounds i32, i32* %0, i64 %42
%46 = load i32, i32* %45
%47 = xor i32 %46, %44
%48 = sext i32 %47 to i64
%49 = add nuw i64 %22, 4
%50 = getelementptr inbounds [256 x i32], [256 x i32]* @__const.hfunc_pearson.T, i64 0, i64 %48
%51 = load i32, i32* %50
%52 = add i64 %23, 4
%53 = icmp eq i64 %52, %10
br i1 %53, label %54, label %20
54: ; preds = %20, %19
%55 = phi i32 [ undef, %19 ], [ %51, %20 ]
%56 = phi i32 [ %18, %19 ], [ %51, %20 ]
%57 = phi i64 [ 1, %19 ], [ %49, %20 ]
br i1 %11, label %71, label %58
58: ; preds = %54, %58
%59 = phi i32 [ %68, %58 ], [ %56, %54 ]
%60 = phi i64 [ %66, %58 ], [ %57, %54 ]
%61 = phi i64 [ %69, %58 ], [ 0, %54 ]
%62 = getelementptr inbounds i32, i32* %0, i64 %60
%63 = load i32, i32* %62
%64 = xor i32 %63, %59
%65 = sext i32 %64 to i64
%66 = add nuw i64 %60, 1
%67 = getelementptr inbounds [256 x i32], [256 x i32]* @__const.hfunc_pearson.T, i64 0, i64 %65
%68 = load i32, i32* %67
%69 = add i64 %61, 1
%70 = icmp eq i64 %69, %8
br i1 %70, label %71, label %58
71: ; preds = %54, %58, %12
%72 = phi i32 [ %18, %12 ], [ %55, %54 ], [ %68, %58 ]
%73 = shl i64 %13, 8
%74 = sext i32 %72 to i64
%75 = or i64 %73, %74
%76 = add nuw nsw i64 %14, 1
%77 = icmp eq i64 %76, 8
br i1 %77, label %78, label %12
78: ; preds = %71
ret i64 %75
}