#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;
typedef int uint32_t;
typedef int /*<<< orphan*/ cluster2;
typedef int /*<<< orphan*/ cluster;

/* Variables and functions */
uint32_t cluster_f(uint8_t *data, uint32_t length) {
  uint32_t hash;
  uint32_t iv;
  uint32_t temp;
  uint32_t rounds;
  uint8_t cluster[] = {0x31, 0x24, 0x13, 0x41, 0x37, 0x6D,
                       0x73, 0xFF, 0x00, 0xCC, 0x99, 0x01};
  uint8_t cluster2[] = {0x11, 0x01, 0x22, 0x06, 0x33, 0x20,
                        0x44, 0xD0, 0x55, 0x0F, 0x6E, 0x00};
  rounds = length < 16 ? 16 : length;
  iv = 0x10F00F01;
  hash = iv;
  while (rounds) {
    iv ^= data[rounds % length];
    iv <<= 8;
    iv ^= cluster[rounds % sizeof(cluster)];
    iv <<= 3;
    iv ^= cluster2[rounds % sizeof(cluster2)];
    hash ^= iv;
    temp = hash;
    temp ^= cluster2[(temp << 2) % sizeof(cluster2)];
    hash <<= 1;
    hash += cluster[iv % sizeof(cluster)];
    hash <<= 1;
    hash ^= cluster[(temp & 0xFF00) % sizeof(cluster)];
    temp <<= 1;
    temp ^= cluster[(temp << 2) % sizeof(cluster2)];
    hash += temp;
    --rounds;
  }
  return hash;
}


x86 assembly (clang, -O0):
<cluster_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xed3(%rip),%rsi
mov    $0x30,%edx
call   1030 <memcpy@plt>
lea    -0x80(%rbp),%rdi
lea    0xeee(%rip),%rsi
mov    $0x30,%edx
call   1030 <memcpy@plt>
cmpl   $0x10,-0xc(%rbp)
jge    1166 <cluster_f+0x56>
mov    $0x10,%eax
mov    %eax,-0x84(%rbp)
jmp    116f <cluster_f+0x5f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x10f00f01,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     12a5 <cluster_f+0x195>
mov    -0x8(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x1c(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    -0x90(%rbp),%rax
movslq %edx,%rcx
mov    (%rax,%rcx,4),%eax
xor    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x14(%rbp)
movslq -0x1c(%rbp),%rax
mov    $0x30,%ecx
xor    %edx,%edx
div    %rcx
mov    -0x50(%rbp,%rdx,4),%eax
xor    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x3,%eax
mov    %eax,-0x14(%rbp)
movslq -0x1c(%rbp),%rax
mov    $0x30,%ecx
xor    %edx,%edx
div    %rcx
mov    -0x80(%rbp,%rdx,4),%eax
xor    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x2,%eax
cltq
mov    $0x30,%ecx
xor    %edx,%edx
div    %rcx
mov    -0x80(%rbp,%rdx,4),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x10(%rbp)
movslq -0x14(%rbp),%rax
mov    $0x30,%ecx
xor    %edx,%edx
div    %rcx
mov    -0x50(%rbp,%rdx,4),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
and    $0xff00,%eax
cltq
mov    $0x30,%ecx
xor    %edx,%edx
div    %rcx
mov    -0x50(%rbp,%rdx,4),%eax
xor    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x2,%eax
cltq
mov    $0x30,%ecx
xor    %edx,%edx
div    %rcx
mov    -0x50(%rbp,%rdx,4),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    1185 <cluster_f+0x75>
mov    -0x10(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cluster_f>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x11,%esi
mov    $0x10,%r8d
cmovge %esi,%r8d
lea    0x0(,%r8,4),%r10
mov    $0x10f00f01,%ecx
movabs $0xaaaaaaaaaaaaaaab,%r11
aa aa aa
lea    0xecd(%rip),%r15
lea    0xef6(%rip),%r14
mov    $0x10f00f01,%ebp
nop
mov    %r8,%rax
mul    %r11
add    %rdx,%rdx
and    $0xffffffffffffffc0,%rdx
lea    (%rdx,%rdx,2),%r9
mov    %r10,%rbx
mov    %r8d,%eax
cltd
idiv   %esi
movslq %edx,%rax
xor    (%rdi,%rax,4),%ebp
sub    %r9,%rbx
mov    (%r15,%rbx,1),%r12d
shl    $0xb,%ebp
shl    $0x3,%r12d
xor    %ebp,%r12d
xor    (%r14,%rbx,1),%r12d
xor    %r12d,%ecx
lea    0x0(,%rcx,4),%eax
movslq %eax,%r9
mov    %r9,%rax
mul    %r11
shr    %rdx
and    $0xfffffffffffffff0,%rdx
lea    (%rdx,%rdx,2),%rax
sub    %rax,%r9
mov    (%r14,%r9,4),%ebx
xor    %ecx,%ebx
add    %ecx,%ecx
movslq %r12d,%r9
mov    %r9,%rax
mul    %r11
shr    %rdx
and    $0xfffffffffffffff0,%rdx
lea    (%rdx,%rdx,2),%rax
sub    %rax,%r9
add    (%r15,%r9,4),%ecx
add    %ecx,%ecx
mov    %ebx,%eax
and    $0xffffff00,%eax
mov    %ebx,%edx
and    $0xff00,%edx
imul   $0xaaab,%edx,%edx
shr    $0x11,%edx
and    $0xfffffff0,%edx
lea    (%rdx,%rdx,2),%edx
sub    %edx,%eax
movzwl %ax,%eax
mov    %ecx,%ebp
xor    (%r15,%rax,4),%ebp
lea    (%rbx,%rbx,1),%ecx
shl    $0x3,%ebx
movslq %ebx,%r9
mov    %r9,%rax
mul    %r11
shr    %rdx
and    $0xfffffffffffffff0,%rdx
lea    (%rdx,%rdx,2),%rax
sub    %rax,%r9
xor    (%r15,%r9,4),%ecx
add    %ebp,%ecx
add    $0xfffffffffffffffc,%r10
mov    %r12d,%ebp
add    $0xffffffffffffffff,%r8
jne    1140 <cluster_f+0x40>
mov    %ecx,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.cluster_f.cluster = [12 x i32] [i32 49, i32 36, i32 19, i32 65, i32 55, i32 109, i32 115, i32 255, i32 0, i32 204, i32 153, i32 1]
@__const.cluster_f.cluster2 = [12 x i32] [i32 17, i32 1, i32 34, i32 6, i32 51, i32 32, i32 68, i32 208, i32 85, i32 15, i32 110, i32 0]
define i32 @cluster_f(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [12 x i32]
%10 = alloca [12 x i32]
store i32* %0, i32** %3
store i32 %1, i32* %4
%11 = bitcast [12 x i32]* %9 to i8*
%12 = bitcast [12 x i32]* %10 to i8*
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 16
br i1 %14, label %15, label %16
15: ; preds = %2
br label %18
16: ; preds = %2
%17 = load i32, i32* %4
br label %18
18: ; preds = %16, %15
%19 = phi i32 [ 16, %15 ], [ %17, %16 ]
store i32 %19, i32* %8
store i32 284167937, i32* %6
%20 = load i32, i32* %6
store i32 %20, i32* %5
br label %21
21: ; preds = %24, %18
%22 = load i32, i32* %8
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %98
24: ; preds = %21
%25 = load i32*, i32** %3
%26 = load i32, i32* %8
%27 = load i32, i32* %4
%28 = srem i32 %26, %27
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %25, i64 %29
%31 = load i32, i32* %30
%32 = load i32, i32* %6
%33 = xor i32 %32, %31
store i32 %33, i32* %6
%34 = load i32, i32* %6
%35 = shl i32 %34, 8
store i32 %35, i32* %6
%36 = load i32, i32* %8
%37 = sext i32 %36 to i64
%38 = urem i64 %37, 48
%39 = getelementptr inbounds [12 x i32], [12 x i32]* %9, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = load i32, i32* %6
%42 = xor i32 %41, %40
store i32 %42, i32* %6
%43 = load i32, i32* %6
%44 = shl i32 %43, 3
store i32 %44, i32* %6
%45 = load i32, i32* %8
%46 = sext i32 %45 to i64
%47 = urem i64 %46, 48
%48 = getelementptr inbounds [12 x i32], [12 x i32]* %10, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = load i32, i32* %6
%51 = xor i32 %50, %49
store i32 %51, i32* %6
%52 = load i32, i32* %6
%53 = load i32, i32* %5
%54 = xor i32 %53, %52
store i32 %54, i32* %5
%55 = load i32, i32* %5
store i32 %55, i32* %7
%56 = load i32, i32* %7
%57 = shl i32 %56, 2
%58 = sext i32 %57 to i64
%59 = urem i64 %58, 48
%60 = getelementptr inbounds [12 x i32], [12 x i32]* %10, i64 0, i64 %59
%61 = load i32, i32* %60
%62 = load i32, i32* %7
%63 = xor i32 %62, %61
store i32 %63, i32* %7
%64 = load i32, i32* %5
%65 = shl i32 %64, 1
store i32 %65, i32* %5
%66 = load i32, i32* %6
%67 = sext i32 %66 to i64
%68 = urem i64 %67, 48
%69 = getelementptr inbounds [12 x i32], [12 x i32]* %9, i64 0, i64 %68
%70 = load i32, i32* %69
%71 = load i32, i32* %5
%72 = add nsw i32 %71, %70
store i32 %72, i32* %5
%73 = load i32, i32* %5
%74 = shl i32 %73, 1
store i32 %74, i32* %5
%75 = load i32, i32* %7
%76 = and i32 %75, 65280
%77 = sext i32 %76 to i64
%78 = urem i64 %77, 48
%79 = getelementptr inbounds [12 x i32], [12 x i32]* %9, i64 0, i64 %78
%80 = load i32, i32* %79
%81 = load i32, i32* %5
%82 = xor i32 %81, %80
store i32 %82, i32* %5
%83 = load i32, i32* %7
%84 = shl i32 %83, 1
store i32 %84, i32* %7
%85 = load i32, i32* %7
%86 = shl i32 %85, 2
%87 = sext i32 %86 to i64
%88 = urem i64 %87, 48
%89 = getelementptr inbounds [12 x i32], [12 x i32]* %9, i64 0, i64 %88
%90 = load i32, i32* %89
%91 = load i32, i32* %7
%92 = xor i32 %91, %90
store i32 %92, i32* %7
%93 = load i32, i32* %7
%94 = load i32, i32* %5
%95 = add nsw i32 %94, %93
store i32 %95, i32* %5
%96 = load i32, i32* %8
%97 = add nsw i32 %96, -1
store i32 %97, i32* %8
br label %21
98: ; preds = %21
%99 = load i32, i32* %5
ret i32 %99
}

LLVM IR (-O2):
@__const.cluster_f.cluster = [12 x i32] [i32 49, i32 36, i32 19, i32 65, i32 55, i32 109, i32 115, i32 255, i32 0, i32 204, i32 153, i32 1]
@__const.cluster_f.cluster2 = [12 x i32] [i32 17, i32 1, i32 34, i32 6, i32 51, i32 32, i32 68, i32 208, i32 85, i32 15, i32 110, i32 0]
define i32 @cluster_f(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 16
%4 = select i1 %3, i32 %1, i32 16
%5 = zext i32 %4 to i64
br label %6
6: ; preds = %2, %6
%7 = phi i64 [ %5, %2 ], [ %54, %6 ]
%8 = phi i32 [ 284167937, %2 ], [ %53, %6 ]
%9 = phi i32 [ 284167937, %2 ], [ %24, %6 ]
%10 = trunc i64 %7 to i32
%11 = srem i32 %10, %1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %0, i64 %12
%14 = load i32, i32* %13
%15 = xor i32 %14, %9
%16 = urem i64 %7, 48
%17 = getelementptr inbounds [12 x i32], [12 x i32]* @__const.cluster_f.cluster, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = shl i32 %15, 11
%20 = shl i32 %18, 3
%21 = xor i32 %19, %20
%22 = getelementptr inbounds [12 x i32], [12 x i32]* @__const.cluster_f.cluster2, i64 0, i64 %16
%23 = load i32, i32* %22
%24 = xor i32 %21, %23
%25 = xor i32 %24, %8
%26 = shl i32 %25, 2
%27 = sext i32 %26 to i64
%28 = urem i64 %27, 48
%29 = getelementptr inbounds [12 x i32], [12 x i32]* @__const.cluster_f.cluster2, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = xor i32 %25, %30
%32 = shl i32 %25, 1
%33 = sext i32 %24 to i64
%34 = urem i64 %33, 48
%35 = getelementptr inbounds [12 x i32], [12 x i32]* @__const.cluster_f.cluster, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = add nsw i32 %32, %36
%38 = shl i32 %37, 1
%39 = trunc i32 %31 to i16
%40 = and i16 %39, -256
%41 = urem i16 %40, 48
%42 = zext i16 %41 to i64
%43 = getelementptr inbounds [12 x i32], [12 x i32]* @__const.cluster_f.cluster, i64 0, i64 %42
%44 = load i32, i32* %43
%45 = xor i32 %38, %44
%46 = shl i32 %31, 1
%47 = shl i32 %31, 3
%48 = sext i32 %47 to i64
%49 = urem i64 %48, 48
%50 = getelementptr inbounds [12 x i32], [12 x i32]* @__const.cluster_f.cluster, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = xor i32 %46, %51
%53 = add nsw i32 %45, %52
%54 = add nsw i64 %7, -1
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %6
56: ; preds = %6
ret i32 %53
}