#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 /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ key;

/* Variables and functions */
int /*<<< orphan*/ htole64(int /*<<< orphan*/ const);
int /*<<< orphan*/ rgph_xxh64s_finalise(int /*<<< orphan*/ *);
int /*<<< orphan*/ rgph_xxh64s_fmix8(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ rgph_xxh64s_fold(size_t, int /*<<< orphan*/ *);
int /*<<< orphan*/ rgph_xxh64s_init(size_t, uintptr_t, int /*<<< orphan*/ *);
int /*<<< orphan*/ rgph_xxh64s_mix(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
uint64_t rgph_u64_xxh64s_data64(const void *data, size_t len, uintptr_t seed) {
  const uint64_t *key = data;
  const uint64_t *end = key + len;
  uint64_t w[4], h[4];
  rgph_xxh64s_init(len * sizeof(key[0]), seed, h);
  for (; end - key >= 4; key += 4) {
    w[0] = htole64(key[0]);
    w[1] = htole64(key[1]);
    w[2] = htole64(key[2]);
    w[3] = htole64(key[3]);
    rgph_xxh64s_mix(w, h);
  }
  rgph_xxh64s_fold(len * sizeof(key[0]), h);
  for (; end - key >= 1; key += 1)
    rgph_xxh64s_fmix8(htole64(key[0]), h);
  rgph_xxh64s_finalise(h);
  return h[0];
}


x86 assembly (clang, -O0):
<rgph_u64_xxh64s_data64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
shl    $0x2,%rdi
mov    -0x18(%rbp),%rsi
lea    -0x50(%rbp),%rdx
call   1060 <rgph_xxh64s_init@plt>
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
cmp    $0x4,%rax
jl     1216 <rgph_u64_xxh64s_data64+0xb6>
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
call   1080 <htole64@plt>
mov    %eax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%edi
call   1080 <htole64@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%edi
call   1080 <htole64@plt>
mov    %eax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    0xc(%rax),%edi
call   1080 <htole64@plt>
mov    %eax,-0x34(%rbp)
lea    -0x40(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1070 <rgph_xxh64s_mix@plt>
mov    -0x20(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x20(%rbp)
jmp    11a4 <rgph_u64_xxh64s_data64+0x44>
mov    -0x10(%rbp),%rdi
shl    $0x2,%rdi
lea    -0x50(%rbp),%rsi
call   1040 <rgph_xxh64s_fold@plt>
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
cmp    $0x1,%rax
jl     1267 <rgph_u64_xxh64s_data64+0x107>
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
call   1080 <htole64@plt>
mov    %eax,%edi
lea    -0x50(%rbp),%rsi
call   1030 <rgph_xxh64s_fmix8@plt>
mov    -0x20(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
jmp    1227 <rgph_u64_xxh64s_data64+0xc7>
lea    -0x50(%rbp),%rdi
call   1050 <rgph_xxh64s_finalise@plt>
mov    -0x50(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rgph_u64_xxh64s_data64>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r15
mov    %rdi,%r13
lea    0x0(,%rsi,4),%r14
mov    %rsp,%rax
mov    %r14,%rdi
mov    %rdx,%rsi
mov    %rax,%rdx
call   1060 <rgph_xxh64s_init@plt>
cmp    $0xc,%r14
jle    11fa <rgph_u64_xxh64s_data64+0x9a>
lea    0x10(%rsp),%r15
mov    %rsp,%r12
mov    %r14,%rbp
mov    %r13,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%edi
call   1080 <htole64@plt>
mov    %eax,0x10(%rsp)
mov    0x4(%rbx),%edi
call   1080 <htole64@plt>
mov    %eax,0x14(%rsp)
mov    0x8(%rbx),%edi
call   1080 <htole64@plt>
mov    %eax,0x18(%rsp)
mov    0xc(%rbx),%edi
call   1080 <htole64@plt>
mov    %eax,0x1c(%rsp)
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <rgph_xxh64s_mix@plt>
add    $0x10,%rbx
add    $0xfffffffffffffff0,%rbp
cmp    $0xc,%rbp
jg     11b0 <rgph_u64_xxh64s_data64+0x50>
jmp    120b <rgph_u64_xxh64s_data64+0xab>
lea    0x0(,%r15,4),%rbp
add    %r13,%rbp
sub    %r13,%rbp
mov    %r13,%rbx
mov    %rsp,%rsi
mov    %r14,%rdi
call   1040 <rgph_xxh64s_fold@plt>
test   %rbp,%rbp
jle    124e <rgph_u64_xxh64s_data64+0xee>
add    %r14,%r13
sub    %rbx,%r13
mov    %rsp,%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rbx),%edi
call   1080 <htole64@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1030 <rgph_xxh64s_fmix8@plt>
add    $0x4,%rbx
add    $0xfffffffffffffffc,%r13
test   %r13,%r13
jg     1230 <rgph_u64_xxh64s_data64+0xd0>
mov    %rsp,%rdi
call   1050 <rgph_xxh64s_finalise@plt>
mov    (%rsp),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @rgph_u64_xxh64s_data64(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca [4 x i32]
%10 = alloca [4 x i32]
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%11 = load i8*, i8** %4
%12 = bitcast i8* %11 to i32*
store i32* %12, i32** %7
%13 = load i32*, i32** %7
%14 = load i64, i64* %5
%15 = getelementptr inbounds i32, i32* %13, i64 %14
store i32* %15, i32** %8
%16 = load i64, i64* %5
%17 = mul i64 %16, 4
%18 = load i64, i64* %6
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 0
%20 = call i32 @rgph_xxh64s_init(i64 %17, i64 %18, i32* %19)
br label %21
21: ; preds = %53, %3
%22 = load i32*, i32** %8
%23 = load i32*, i32** %7
%24 = ptrtoint i32* %22 to i64
%25 = ptrtoint i32* %23 to i64
%26 = sub i64 %24, %25
%27 = sdiv exact i64 %26, 4
%28 = icmp sge i64 %27, 4
br i1 %28, label %29, label %56
29: ; preds = %21
%30 = load i32*, i32** %7
%31 = getelementptr inbounds i32, i32* %30, i64 0
%32 = load i32, i32* %31
%33 = call i32 @htole64(i32 %32)
%34 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
store i32 %33, i32* %34
%35 = load i32*, i32** %7
%36 = getelementptr inbounds i32, i32* %35, i64 1
%37 = load i32, i32* %36
%38 = call i32 @htole64(i32 %37)
%39 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 1
store i32 %38, i32* %39
%40 = load i32*, i32** %7
%41 = getelementptr inbounds i32, i32* %40, i64 2
%42 = load i32, i32* %41
%43 = call i32 @htole64(i32 %42)
%44 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 2
store i32 %43, i32* %44
%45 = load i32*, i32** %7
%46 = getelementptr inbounds i32, i32* %45, i64 3
%47 = load i32, i32* %46
%48 = call i32 @htole64(i32 %47)
%49 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 3
store i32 %48, i32* %49
%50 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%51 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 0
%52 = call i32 @rgph_xxh64s_mix(i32* %50, i32* %51)
br label %53
53: ; preds = %29
%54 = load i32*, i32** %7
%55 = getelementptr inbounds i32, i32* %54, i64 4
store i32* %55, i32** %7
br label %21
56: ; preds = %21
%57 = load i64, i64* %5
%58 = mul i64 %57, 4
%59 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 0
%60 = call i32 @rgph_xxh64s_fold(i64 %58, i32* %59)
br label %61
61: ; preds = %76, %56
%62 = load i32*, i32** %8
%63 = load i32*, i32** %7
%64 = ptrtoint i32* %62 to i64
%65 = ptrtoint i32* %63 to i64
%66 = sub i64 %64, %65
%67 = sdiv exact i64 %66, 4
%68 = icmp sge i64 %67, 1
br i1 %68, label %69, label %79
69: ; preds = %61
%70 = load i32*, i32** %7
%71 = getelementptr inbounds i32, i32* %70, i64 0
%72 = load i32, i32* %71
%73 = call i32 @htole64(i32 %72)
%74 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 0
%75 = call i32 @rgph_xxh64s_fmix8(i32 %73, i32* %74)
br label %76
76: ; preds = %69
%77 = load i32*, i32** %7
%78 = getelementptr inbounds i32, i32* %77, i64 1
store i32* %78, i32** %7
br label %61
79: ; preds = %61
%80 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 0
%81 = call i32 @rgph_xxh64s_finalise(i32* %80)
%82 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 0
%83 = load i32, i32* %82
ret i32 %83
}

LLVM IR (-O2):
define i32 @rgph_u64_xxh64s_data64(i8* %0, i64 %1, i64 %2) {
%4 = alloca [4 x i32]
%5 = alloca [4 x i32]
%6 = bitcast i8* %0 to i32*
%7 = getelementptr inbounds i32, i32* %6, i64 %1
%8 = bitcast [4 x i32]* %4 to i8*
%9 = bitcast [4 x i32]* %5 to i8*
%10 = shl i64 %1, 2
%11 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%12 = call i32 @rgph_xxh64s_init(i64 %10, i64 %2, i32* %11)
%13 = ptrtoint i32* %7 to i64
%14 = ptrtoint i8* %0 to i64
%15 = sub i64 %13, %14
%16 = icmp sgt i64 %15, 12
br i1 %16, label %20, label %17
17: ; preds = %3
%18 = ptrtoint i8* %0 to i64
%19 = sub i64 %13, %18
br label %43
20: ; preds = %3
%21 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 1
%23 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 2
%24 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 3
br label %25
25: ; preds = %20, %25
%26 = phi i32* [ %6, %20 ], [ %39, %25 ]
%27 = load i32, i32* %26
%28 = call i32 @htole64(i32 %27)
store i32 %28, i32* %21
%29 = getelementptr inbounds i32, i32* %26, i64 1
%30 = load i32, i32* %29
%31 = call i32 @htole64(i32 %30)
store i32 %31, i32* %22
%32 = getelementptr inbounds i32, i32* %26, i64 2
%33 = load i32, i32* %32
%34 = call i32 @htole64(i32 %33)
store i32 %34, i32* %23
%35 = getelementptr inbounds i32, i32* %26, i64 3
%36 = load i32, i32* %35
%37 = call i32 @htole64(i32 %36)
store i32 %37, i32* %24
%38 = call i32 @rgph_xxh64s_mix(i32* %21, i32* %11)
%39 = getelementptr inbounds i32, i32* %26, i64 4
%40 = ptrtoint i32* %39 to i64
%41 = sub i64 %13, %40
%42 = icmp sgt i64 %41, 12
br i1 %42, label %25, label %43
43: ; preds = %25, %17
%44 = phi i64 [ %19, %17 ], [ %41, %25 ]
%45 = phi i32* [ %6, %17 ], [ %39, %25 ]
%46 = call i32 @rgph_xxh64s_fold(i64 %10, i32* %11)
%47 = icmp sgt i64 %44, 0
br i1 %47, label %48, label %57
48: ; preds = %43, %48
%49 = phi i32* [ %53, %48 ], [ %45, %43 ]
%50 = load i32, i32* %49
%51 = call i32 @htole64(i32 %50)
%52 = call i32 @rgph_xxh64s_fmix8(i32 %51, i32* %11)
%53 = getelementptr inbounds i32, i32* %49, i64 1
%54 = ptrtoint i32* %53 to i64
%55 = sub i64 %13, %54
%56 = icmp sgt i64 %55, 0
br i1 %56, label %48, label %57
57: ; preds = %48, %43
%58 = call i32 @rgph_xxh64s_finalise(i32* %11)
%59 = load i32, i32* %11
ret i32 %59
}