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

/* Variables and functions */
int /*<<< orphan*/ htole32(uintptr_t const);
int /*<<< orphan*/ rgph_murmur32s_finalise(size_t, uintptr_t *);
int /*<<< orphan*/ rgph_murmur32s_mix(int /*<<< orphan*/, uintptr_t *, int);
uint32_t rgph_u32_murmur32s_data32(const void *data, size_t len,
                                   uintptr_t seed) {
  const uint32_t *key = data;
  const uint32_t *end = key + len;
  uint32_t h[1] = {seed};
  for (; key != end; key += 1)
    rgph_murmur32s_mix(htole32(key[0]), h, 0);
  rgph_murmur32s_mix(0, h, 1);
  rgph_murmur32s_finalise(len * sizeof(key[0]), h);
  return h[0];
}


x86 assembly (clang, -O0):
<rgph_u32_murmur32s_data32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
je     119f <rgph_u32_murmur32s_data32+0x6f>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
call   1030 <htole32@plt>
mov    %eax,%edi
lea    -0x30(%rbp),%rsi
xor    %edx,%edx
call   1040 <rgph_murmur32s_mix@plt>
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
jmp    1167 <rgph_u32_murmur32s_data32+0x37>
lea    -0x30(%rbp),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1040 <rgph_murmur32s_mix@plt>
mov    -0x10(%rbp),%rdi
shl    $0x3,%rdi
lea    -0x30(%rbp),%rsi
call   1050 <rgph_murmur32s_finalise@plt>
mov    -0x30(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rgph_u32_murmur32s_data32>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
shl    $0x3,%r14
mov    %rdx,(%rsp)
test   %r14,%r14
je     116e <rgph_u32_murmur32s_data32+0x3e>
mov    %rdi,%r12
xor    %ebx,%ebx
mov    %rsp,%r15
mov    (%r12,%rbx,1),%rdi
call   1030 <htole32@plt>
mov    %eax,%edi
mov    %r15,%rsi
xor    %edx,%edx
call   1040 <rgph_murmur32s_mix@plt>
add    $0x8,%rbx
cmp    %rbx,%r14
jne    1150 <rgph_u32_murmur32s_data32+0x20>
mov    %rsp,%rbx
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1040 <rgph_murmur32s_mix@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <rgph_murmur32s_finalise@plt>
mov    (%rsp),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @rgph_u32_murmur32s_data32(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64*
%8 = alloca i64*
%9 = alloca [1 x i64]
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i64*
store i64* %11, i64** %7
%12 = load i64*, i64** %7
%13 = load i64, i64* %5
%14 = getelementptr inbounds i64, i64* %12, i64 %13
store i64* %14, i64** %8
%15 = getelementptr inbounds [1 x i64], [1 x i64]* %9, i64 0, i64 0
%16 = load i64, i64* %6
store i64 %16, i64* %15
br label %17
17: ; preds = %28, %3
%18 = load i64*, i64** %7
%19 = load i64*, i64** %8
%20 = icmp ne i64* %18, %19
br i1 %20, label %21, label %31
21: ; preds = %17
%22 = load i64*, i64** %7
%23 = getelementptr inbounds i64, i64* %22, i64 0
%24 = load i64, i64* %23
%25 = call i32 @htole32(i64 %24)
%26 = getelementptr inbounds [1 x i64], [1 x i64]* %9, i64 0, i64 0
%27 = call i32 @rgph_murmur32s_mix(i32 %25, i64* %26, i32 0)
br label %28
28: ; preds = %21
%29 = load i64*, i64** %7
%30 = getelementptr inbounds i64, i64* %29, i64 1
store i64* %30, i64** %7
br label %17
31: ; preds = %17
%32 = getelementptr inbounds [1 x i64], [1 x i64]* %9, i64 0, i64 0
%33 = call i32 @rgph_murmur32s_mix(i32 0, i64* %32, i32 1)
%34 = load i64, i64* %5
%35 = mul i64 %34, 8
%36 = getelementptr inbounds [1 x i64], [1 x i64]* %9, i64 0, i64 0
%37 = call i32 @rgph_murmur32s_finalise(i64 %35, i64* %36)
%38 = getelementptr inbounds [1 x i64], [1 x i64]* %9, i64 0, i64 0
%39 = load i64, i64* %38
ret i64 %39
}

LLVM IR (-O2):
define i64 @rgph_u32_murmur32s_data32(i8* %0, i64 %1, i64 %2) {
%4 = alloca [1 x i64]
%5 = bitcast i8* %0 to i64*
%6 = getelementptr inbounds i64, i64* %5, i64 %1
%7 = bitcast [1 x i64]* %4 to i8*
%8 = getelementptr inbounds [1 x i64], [1 x i64]* %4, i64 0, i64 0
store i64 %2, i64* %8
%9 = icmp eq i64* %6, %5
br i1 %9, label %17, label %10
10: ; preds = %3, %10
%11 = phi i64* [ %15, %10 ], [ %5, %3 ]
%12 = load i64, i64* %11
%13 = call i32 @htole32(i64 %12)
%14 = call i32 @rgph_murmur32s_mix(i32 %13, i64* %8, i32 0)
%15 = getelementptr inbounds i64, i64* %11, i64 1
%16 = icmp eq i64* %15, %6
br i1 %16, label %17, label %10
17: ; preds = %10, %3
%18 = call i32 @rgph_murmur32s_mix(i32 0, i64* %8, i32 1)
%19 = shl i64 %1, 3
%20 = call i32 @rgph_murmur32s_finalise(i64 %19, i64* %8)
%21 = load i64, i64* %8
ret i64 %21
}