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

/* Variables and functions */
int UINT32_MAX;
int htole64(int /*<<< orphan*/ const);
int /*<<< orphan*/ rgph_xxh32s_finalise(int *);
int /*<<< orphan*/ rgph_xxh32s_fmix4(int, int *);
int /*<<< orphan*/ rgph_xxh32s_fold(size_t, int *);
int /*<<< orphan*/ rgph_xxh32s_init(size_t, uintptr_t, int *);
int /*<<< orphan*/ rgph_xxh32s_mix(int *, int *);
uint32_t rgph_u32_xxh32s_data64(const void *data, size_t len, uintptr_t seed) {
  const uint64_t *key = data;
  const uint64_t *end = key + len;
  uint32_t w[4], h[4];
  rgph_xxh32s_init(len * sizeof(key[0]), seed, h);
  for (; end - key >= 2; key += 2) {
    w[0] = htole64(key[0]) & UINT32_MAX;
    w[1] = htole64(key[0]) >> 32;
    w[2] = htole64(key[1]) & UINT32_MAX;
    w[3] = htole64(key[1]) >> 32;
    rgph_xxh32s_mix(w, h);
  }
  rgph_xxh32s_fold(len * sizeof(key[0]), h);
  if (end != key) {
    rgph_xxh32s_fmix4(htole64(key[0]) & UINT32_MAX, h);
    rgph_xxh32s_fmix4(htole64(key[0]) >> 32, h);
  }
  rgph_xxh32s_finalise(h);
  return h[0];
}


x86 assembly (clang, -O0):
<rgph_u32_xxh32s_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   1050 <rgph_xxh32s_init@plt>
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
cmp    $0x2,%rax
jl     1235 <rgph_u32_xxh32s_data64+0xd5>
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
call   1080 <htole64@plt>
mov    0x2e29(%rip),%rcx
and    (%rcx),%eax
mov    %eax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
call   1080 <htole64@plt>
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%edi
call   1080 <htole64@plt>
mov    0x2dfc(%rip),%rcx
and    (%rcx),%eax
mov    %eax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%edi
call   1080 <htole64@plt>
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,-0x34(%rbp)
lea    -0x40(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1040 <rgph_xxh32s_mix@plt>
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
jmp    11a4 <rgph_u32_xxh32s_data64+0x44>
mov    -0x10(%rbp),%rdi
shl    $0x2,%rdi
lea    -0x50(%rbp),%rsi
call   1070 <rgph_xxh32s_fold@plt>
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
je     1290 <rgph_u32_xxh32s_data64+0x130>
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
call   1080 <htole64@plt>
mov    %eax,%edi
mov    0x2d90(%rip),%rax
and    (%rax),%edi
lea    -0x50(%rbp),%rsi
call   1060 <rgph_xxh32s_fmix4@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
call   1080 <htole64@plt>
mov    %eax,%edi
mov    $0x20,%ecx
sar    %cl,%edi
lea    -0x50(%rbp),%rsi
call   1060 <rgph_xxh32s_fmix4@plt>
lea    -0x50(%rbp),%rdi
call   1030 <rgph_xxh32s_finalise@plt>
mov    -0x50(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rgph_u32_xxh32s_data64>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r13
mov    %rdi,%rbx
lea    (%rdi,%rsi,4),%rbp
shl    $0x2,%r13
mov    %rsp,%rax
mov    %r13,%rdi
mov    %rdx,%rsi
mov    %rax,%rdx
call   1050 <rgph_xxh32s_init@plt>
cmp    $0x5,%r13
jl     11fa <rgph_u32_xxh32s_data64+0x9a>
mov    %rbp,0x18(%rsp)
mov    0x2e59(%rip),%rbp
lea    0x20(%rsp),%r15
mov    %rsp,%r12
mov    %r13,%r14
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%edi
call   1080 <htole64@plt>
and    0x0(%rbp),%eax
mov    %eax,0x20(%rsp)
mov    (%rbx),%edi
call   1080 <htole64@plt>
mov    0x4(%rbx),%edi
call   1080 <htole64@plt>
and    0x0(%rbp),%eax
mov    %eax,0x28(%rsp)
mov    0x4(%rbx),%edi
call   1080 <htole64@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <rgph_xxh32s_mix@plt>
add    $0x8,%rbx
add    $0xfffffffffffffff8,%r14
cmp    $0x4,%r14
jg     11b0 <rgph_u32_xxh32s_data64+0x50>
mov    0x18(%rsp),%rbp
mov    %rsp,%rsi
mov    %r13,%rdi
call   1070 <rgph_xxh32s_fold@plt>
cmp    %rbx,%rbp
je     1236 <rgph_u32_xxh32s_data64+0xd6>
mov    (%rbx),%edi
call   1080 <htole64@plt>
mov    0x2de0(%rip),%rcx
and    (%rcx),%eax
mov    %rsp,%r14
mov    %eax,%edi
mov    %r14,%rsi
call   1060 <rgph_xxh32s_fmix4@plt>
mov    (%rbx),%edi
call   1080 <htole64@plt>
mov    %r14,%rsi
call   1060 <rgph_xxh32s_fmix4@plt>
mov    %rsp,%rdi
call   1030 <rgph_xxh32s_finalise@plt>
mov    (%rsp),%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@UINT32_MAX = global i32 0
define i32 @rgph_u32_xxh32s_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_xxh32s_init(i64 %17, i64 %18, i32* %19)
br label %21
21: ; preds = %59, %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, 2
br i1 %28, label %29, label %62
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 = load i32, i32* @UINT32_MAX
%35 = and i32 %33, %34
%36 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
store i32 %35, i32* %36
%37 = load i32*, i32** %7
%38 = getelementptr inbounds i32, i32* %37, i64 0
%39 = load i32, i32* %38
%40 = call i32 @htole64(i32 %39)
%41 = ashr i32 %40, 32
%42 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 1
store i32 %41, i32* %42
%43 = load i32*, i32** %7
%44 = getelementptr inbounds i32, i32* %43, i64 1
%45 = load i32, i32* %44
%46 = call i32 @htole64(i32 %45)
%47 = load i32, i32* @UINT32_MAX
%48 = and i32 %46, %47
%49 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 2
store i32 %48, i32* %49
%50 = load i32*, i32** %7
%51 = getelementptr inbounds i32, i32* %50, i64 1
%52 = load i32, i32* %51
%53 = call i32 @htole64(i32 %52)
%54 = ashr i32 %53, 32
%55 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 3
store i32 %54, i32* %55
%56 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%57 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 0
%58 = call i32 @rgph_xxh32s_mix(i32* %56, i32* %57)
br label %59
59: ; preds = %29
%60 = load i32*, i32** %7
%61 = getelementptr inbounds i32, i32* %60, i64 2
store i32* %61, i32** %7
br label %21
62: ; preds = %21
%63 = load i64, i64* %5
%64 = mul i64 %63, 4
%65 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 0
%66 = call i32 @rgph_xxh32s_fold(i64 %64, i32* %65)
%67 = load i32*, i32** %8
%68 = load i32*, i32** %7
%69 = icmp ne i32* %67, %68
br i1 %69, label %70, label %86
70: ; preds = %62
%71 = load i32*, i32** %7
%72 = getelementptr inbounds i32, i32* %71, i64 0
%73 = load i32, i32* %72
%74 = call i32 @htole64(i32 %73)
%75 = load i32, i32* @UINT32_MAX
%76 = and i32 %74, %75
%77 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 0
%78 = call i32 @rgph_xxh32s_fmix4(i32 %76, i32* %77)
%79 = load i32*, i32** %7
%80 = getelementptr inbounds i32, i32* %79, i64 0
%81 = load i32, i32* %80
%82 = call i32 @htole64(i32 %81)
%83 = ashr i32 %82, 32
%84 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 0
%85 = call i32 @rgph_xxh32s_fmix4(i32 %83, i32* %84)
br label %86
86: ; preds = %70, %62
%87 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 0
%88 = call i32 @rgph_xxh32s_finalise(i32* %87)
%89 = getelementptr inbounds [4 x i32], [4 x i32]* %10, i64 0, i64 0
%90 = load i32, i32* %89
ret i32 %90
}

LLVM IR (-O2):
@UINT32_MAX = global i32 0
define i32 @rgph_u32_xxh32s_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_xxh32s_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, 4
br i1 %16, label %17, label %40
17: ; preds = %3
%18 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 2
br label %20
20: ; preds = %17, %20
%21 = phi i32* [ %6, %17 ], [ %36, %20 ]
%22 = load i32, i32* %21
%23 = call i32 @htole64(i32 %22)
%24 = load i32, i32* @UINT32_MAX
%25 = and i32 %24, %23
store i32 %25, i32* %18
%26 = load i32, i32* %21
%27 = call i32 @htole64(i32 %26)
%28 = getelementptr inbounds i32, i32* %21, i64 1
%29 = load i32, i32* %28
%30 = call i32 @htole64(i32 %29)
%31 = load i32, i32* @UINT32_MAX
%32 = and i32 %31, %30
store i32 %32, i32* %19
%33 = load i32, i32* %28
%34 = call i32 @htole64(i32 %33)
%35 = call i32 @rgph_xxh32s_mix(i32* %18, i32* %11)
%36 = getelementptr inbounds i32, i32* %21, i64 2
%37 = ptrtoint i32* %36 to i64
%38 = sub i64 %13, %37
%39 = icmp sgt i64 %38, 4
br i1 %39, label %20, label %40
40: ; preds = %20, %3
%41 = phi i32* [ %6, %3 ], [ %36, %20 ]
%42 = call i32 @rgph_xxh32s_fold(i64 %10, i32* %11)
%43 = icmp eq i32* %7, %41
br i1 %43, label %53, label %44
44: ; preds = %40
%45 = load i32, i32* %41
%46 = call i32 @htole64(i32 %45)
%47 = load i32, i32* @UINT32_MAX
%48 = and i32 %47, %46
%49 = call i32 @rgph_xxh32s_fmix4(i32 %48, i32* %11)
%50 = load i32, i32* %41
%51 = call i32 @htole64(i32 %50)
%52 = call i32 @rgph_xxh32s_fmix4(i32 poison, i32* %11)
br label %53
53: ; preds = %44, %40
%54 = call i32 @rgph_xxh32s_finalise(i32* %11)
%55 = load i32, i32* %11
ret i32 %55
}