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

/* Variables and functions */
uint64_t twhash_64(uint64_t val, unsigned int bits) {
  uint64_t hash = val;
  uint64_t n = hash;
  n <<= 18;
  hash -= n;
  n <<= 33;
  hash -= n;
  n <<= 3;
  hash += n;
  n <<= 3;
  hash -= n;
  n <<= 4;
  hash += n;
  n <<= 2;
  hash += n;
  return hash >> (64 - bits);
}


x86 assembly (clang, -O0):
<twhash_64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x12,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x21,%ecx
shl    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x3,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x3,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x40,%ecx
sub    -0x8(%rbp),%ecx
sar    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<twhash_64>:
ret

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

LLVM IR (-O2):
define i32 @twhash_64(i32 %0, i32 %1) {
ret i32 poison
}