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

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ burn(int /*<<< orphan*/);
int /*<<< orphan*/ const get32(int /*<<< orphan*/ const *, size_t);
int /*<<< orphan*/ is_aligned32(void const *);
int /*<<< orphan*/ mixin(int /*<<< orphan*/, int /*<<< orphan*/ const);
int /*<<< orphan*/ remix(int /*<<< orphan*/);
uint32_t murmur3_32(const void *key, size_t size, uint32_t seed) {
  assert(is_aligned32(key));
  const uint32_t *cursor = (const uint32_t *)key;
  const uint32_t *tail = cursor + size / 4;
  uint32_t hash = seed;
  for (; cursor < tail; ++cursor) {
    hash = mixin(hash, *cursor);
    hash = remix(hash);
  }
  hash = mixin(hash, get32((const uint8_t *)tail, size % 4));
  hash ^= (uint32_t)size;
  hash = burn(hash);
  return hash;
}


x86 assembly (clang, -O0):
<murmur3_32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <is_aligned32@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
shr    $0x2,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    11e3 <murmur3_32+0x83>
mov    -0x2c(%rbp),%edi
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
call   1030 <mixin@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%edi
call   1080 <remix@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x20(%rbp)
jmp    11a8 <murmur3_32+0x48>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
and    $0x3,%rsi
call   1060 <get32@plt>
mov    -0x30(%rbp),%edi
mov    %eax,%esi
call   1030 <mixin@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
xor    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%edi
call   1070 <burn@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<murmur3_32>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <is_aligned32@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    %r14,%r15
and    $0xfffffffffffffffc,%r15
add    %rbx,%r15
cmp    %rbx,%r15
jbe    11ab <murmur3_32+0x4b>
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%esi
mov    %ebp,%edi
call   1030 <mixin@plt>
mov    %eax,%edi
call   1080 <remix@plt>
mov    %eax,%ebp
add    $0x4,%rbx
cmp    %r15,%rbx
jb     1190 <murmur3_32+0x30>
mov    %r14d,%esi
and    $0x3,%esi
mov    %r15,%rdi
call   1060 <get32@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <mixin@plt>
xor    %eax,%r14d
mov    %r14d,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <burn@plt>

LLVM IR (-O0):
define i32 @murmur3_32(i8* %0, i64 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%10 = load i8*, i8** %4
%11 = call i32 @is_aligned32(i8* %10)
%12 = call i32 @assert(i32 %11)
%13 = load i8*, i8** %4
%14 = bitcast i8* %13 to i32*
store i32* %14, i32** %7
%15 = load i32*, i32** %7
%16 = load i64, i64* %5
%17 = udiv i64 %16, 4
%18 = getelementptr inbounds i32, i32* %15, i64 %17
store i32* %18, i32** %8
%19 = load i32, i32* %6
store i32 %19, i32* %9
br label %20
20: ; preds = %31, %3
%21 = load i32*, i32** %7
%22 = load i32*, i32** %8
%23 = icmp ult i32* %21, %22
br i1 %23, label %24, label %34
24: ; preds = %20
%25 = load i32, i32* %9
%26 = load i32*, i32** %7
%27 = load i32, i32* %26
%28 = call i32 @mixin(i32 %25, i32 %27)
store i32 %28, i32* %9
%29 = load i32, i32* %9
%30 = call i32 @remix(i32 %29)
store i32 %30, i32* %9
br label %31
31: ; preds = %24
%32 = load i32*, i32** %7
%33 = getelementptr inbounds i32, i32* %32, i32 1
store i32* %33, i32** %7
br label %20
34: ; preds = %20
%35 = load i32, i32* %9
%36 = load i32*, i32** %8
%37 = load i64, i64* %5
%38 = urem i64 %37, 4
%39 = call i32 @get32(i32* %36, i64 %38)
%40 = call i32 @mixin(i32 %35, i32 %39)
store i32 %40, i32* %9
%41 = load i64, i64* %5
%42 = trunc i64 %41 to i32
%43 = load i32, i32* %9
%44 = xor i32 %43, %42
store i32 %44, i32* %9
%45 = load i32, i32* %9
%46 = call i32 @burn(i32 %45)
store i32 %46, i32* %9
%47 = load i32, i32* %9
ret i32 %47
}

LLVM IR (-O2):
define i32 @murmur3_32(i8* %0, i64 %1, i32 %2) {
%4 = tail call i32 @is_aligned32(i8* %0)
%5 = tail call i32 @assert(i32 %4)
%6 = bitcast i8* %0 to i32*
%7 = lshr i64 %1, 2
%8 = getelementptr inbounds i32, i32* %6, i64 %7
%9 = icmp ugt i32* %8, %6
br i1 %9, label %10, label %18
10: ; preds = %3, %10
%11 = phi i32 [ %15, %10 ], [ %2, %3 ]
%12 = phi i32* [ %16, %10 ], [ %6, %3 ]
%13 = load i32, i32* %12
%14 = tail call i32 @mixin(i32 %11, i32 %13)
%15 = tail call i32 @remix(i32 %14)
%16 = getelementptr inbounds i32, i32* %12, i64 1
%17 = icmp ult i32* %16, %8
br i1 %17, label %10, label %18
18: ; preds = %10, %3
%19 = phi i32 [ %2, %3 ], [ %15, %10 ]
%20 = and i64 %1, 3
%21 = tail call i32 @get32(i32* %8, i64 %20)
%22 = tail call i32 @mixin(i32 %19, i32 %21)
%23 = trunc i64 %1 to i32
%24 = xor i32 %22, %23
%25 = tail call i32 @burn(i32 %24)
ret i32 %25
}