#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 u_int64_t;

/* Variables and functions */
u_int64_t int64hash(u_int64_t key) {
  key = (~key) + (key << 21);
  key = key ^ (key >> 24);
  key = (key + (key << 3)) + (key << 8);
  key = key ^ (key >> 14);
  key = (key + (key << 2)) + (key << 4);
  key = key ^ (key >> 28);
  key = key + (key << 31);
  return key;
}


x86 assembly (clang, -O0):
<int64hash>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
mov    -0x4(%rbp),%ecx
shl    $0x15,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x18,%ecx
xor    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x3,%ecx
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0xe,%ecx
xor    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x4,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x1c,%ecx
xor    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x1f,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int64hash>:
mov    %edi,%eax
not    %eax
shl    $0x15,%edi
add    %eax,%edi
mov    %edi,%eax
sar    $0x18,%eax
xor    %edi,%eax
imul   $0x109,%eax,%eax
mov    %eax,%ecx
sar    $0xe,%ecx
xor    %eax,%ecx
lea    (%rcx,%rcx,4),%eax
lea    (%rcx,%rax,4),%ecx
mov    %ecx,%eax
sar    $0x1c,%eax
xor    %ecx,%eax
mov    %eax,%ecx
shl    $0x1f,%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @int64hash(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = xor i32 %3, -1
%5 = load i32, i32* %2
%6 = shl i32 %5, 21
%7 = add nsw i32 %4, %6
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = load i32, i32* %2
%10 = ashr i32 %9, 24
%11 = xor i32 %8, %10
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = load i32, i32* %2
%14 = shl i32 %13, 3
%15 = add nsw i32 %12, %14
%16 = load i32, i32* %2
%17 = shl i32 %16, 8
%18 = add nsw i32 %15, %17
store i32 %18, i32* %2
%19 = load i32, i32* %2
%20 = load i32, i32* %2
%21 = ashr i32 %20, 14
%22 = xor i32 %19, %21
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = load i32, i32* %2
%25 = shl i32 %24, 2
%26 = add nsw i32 %23, %25
%27 = load i32, i32* %2
%28 = shl i32 %27, 4
%29 = add nsw i32 %26, %28
store i32 %29, i32* %2
%30 = load i32, i32* %2
%31 = load i32, i32* %2
%32 = ashr i32 %31, 28
%33 = xor i32 %30, %32
store i32 %33, i32* %2
%34 = load i32, i32* %2
%35 = load i32, i32* %2
%36 = shl i32 %35, 31
%37 = add nsw i32 %34, %36
store i32 %37, i32* %2
%38 = load i32, i32* %2
ret i32 %38
}

LLVM IR (-O2):
define i32 @int64hash(i32 %0) {
%2 = xor i32 %0, -1
%3 = shl i32 %0, 21
%4 = add nsw i32 %3, %2
%5 = ashr i32 %4, 24
%6 = xor i32 %5, %4
%7 = mul i32 %6, 265
%8 = ashr i32 %7, 14
%9 = xor i32 %8, %7
%10 = mul i32 %9, 21
%11 = ashr i32 %10, 28
%12 = xor i32 %11, %10
%13 = mul i32 %12, -2147483647
ret i32 %13
}