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

/* Variables and functions */
int hash32(char const *, size_t);
int muxhash(int, int);
uint32_t encode_refalt_hash(const char *ref, size_t sizeref, const char *alt,
                            size_t sizealt) {
  uint32_t h =
      muxhash(hash32(alt, sizealt), muxhash(0x3, hash32(ref, sizeref)));
  h ^= h >> 16;
  h *= 0x85ebca6b;
  h ^= h >> 13;
  h *= 0xc2b2ae35;
  h ^= h >> 16;
  return ((h >> 1) | 0x1);
}


x86 assembly (clang, -O0):
<encode_refalt_hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <hash32@plt>
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <hash32@plt>
mov    %eax,%esi
mov    $0x3,%edi
call   1040 <muxhash@plt>
mov    -0x28(%rbp),%edi
mov    %eax,%esi
call   1040 <muxhash@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
sar    $0x10,%eax
xor    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
imul   $0x85ebca6b,-0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
sar    $0xd,%eax
xor    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
imul   $0xc2b2ae35,-0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
sar    $0x10,%eax
xor    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
sar    $0x1,%eax
or     $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encode_refalt_hash>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rdx,%rdi
mov    %rcx,%rsi
call   1030 <hash32@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <hash32@plt>
mov    $0x3,%edi
mov    %eax,%esi
call   1040 <muxhash@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <muxhash@plt>
mov    %eax,%ecx
sar    $0x10,%ecx
xor    %eax,%ecx
imul   $0x85ebca6b,%ecx,%eax
mov    %eax,%ecx
sar    $0xd,%ecx
xor    %eax,%ecx
imul   $0xc2b2ae35,%ecx,%eax
mov    %eax,%ecx
sar    $0x11,%ecx
sar    %eax
xor    %ecx,%eax
or     $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @encode_refalt_hash(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%10 = load i8*, i8** %7
%11 = load i64, i64* %8
%12 = call i32 @hash32(i8* %10, i64 %11)
%13 = load i8*, i8** %5
%14 = load i64, i64* %6
%15 = call i32 @hash32(i8* %13, i64 %14)
%16 = call i32 @muxhash(i32 3, i32 %15)
%17 = call i32 @muxhash(i32 %12, i32 %16)
store i32 %17, i32* %9
%18 = load i32, i32* %9
%19 = ashr i32 %18, 16
%20 = load i32, i32* %9
%21 = xor i32 %20, %19
store i32 %21, i32* %9
%22 = load i32, i32* %9
%23 = mul i32 %22, -2048144789
store i32 %23, i32* %9
%24 = load i32, i32* %9
%25 = ashr i32 %24, 13
%26 = load i32, i32* %9
%27 = xor i32 %26, %25
store i32 %27, i32* %9
%28 = load i32, i32* %9
%29 = mul i32 %28, -1028477387
store i32 %29, i32* %9
%30 = load i32, i32* %9
%31 = ashr i32 %30, 16
%32 = load i32, i32* %9
%33 = xor i32 %32, %31
store i32 %33, i32* %9
%34 = load i32, i32* %9
%35 = ashr i32 %34, 1
%36 = or i32 %35, 1
ret i32 %36
}

LLVM IR (-O2):
define i32 @encode_refalt_hash(i8* %0, i64 %1, i8* %2, i64 %3) {
%5 = tail call i32 @hash32(i8* %2, i64 %3)
%6 = tail call i32 @hash32(i8* %0, i64 %1)
%7 = tail call i32 @muxhash(i32 3, i32 %6)
%8 = tail call i32 @muxhash(i32 %5, i32 %7)
%9 = ashr i32 %8, 16
%10 = xor i32 %9, %8
%11 = mul i32 %10, -2048144789
%12 = ashr i32 %11, 13
%13 = xor i32 %12, %11
%14 = mul i32 %13, -1028477387
%15 = ashr i32 %14, 17
%16 = ashr i32 %14, 1
%17 = xor i32 %15, %16
%18 = or i32 %17, 1
ret i32 %18
}