#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 */
int HashLen16(int, int);
int Rotate(int, int);
uint64_t HashLen17to32(const char *s, size_t len) {
  uint64_t a = (*(const uint64_t *)(s)) * (0xb492b66fbe98f273ULL);
  uint64_t b = (*(const uint64_t *)(s + 8));
  uint64_t c = (*(const uint64_t *)(s + len - 8)) * (0x9ae16a3b2f90404fULL);
  uint64_t d = (*(const uint64_t *)(s + len - 16)) * (0xc3a5c85c97cb3127ULL);
  return HashLen16(Rotate(a - b, 43) + Rotate(c, 30) + d,
                   a + Rotate(b ^ (0xc949d7c7509e6557ULL), 20) - c + len);
}


x86 assembly (clang, -O0):
<HashLen17to32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq (%rax),%rax
movabs $0xb492b66fbe98f273,%rcx
b6 92 b4
imul   %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x8(%rax,%rcx,1),%rax
movabs $0x9ae16a3b2f90404f,%rcx
6a e1 9a
imul   %rcx,%rax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x10(%rax,%rcx,1),%rax
movabs $0xc3a5c85c97cb3127,%rcx
c8 a5 c3
imul   %rcx,%rax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
sub    -0x18(%rbp),%edi
mov    $0x2b,%esi
call   1030 <Rotate@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x1c(%rbp),%edi
mov    $0x1e,%esi
call   1030 <Rotate@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
add    %ecx,%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
movslq -0x18(%rbp),%rax
movabs $0xc949d7c7509e6557,%rcx
d7 49 c9
xor    %rcx,%rax
mov    %eax,%edi
mov    $0x14,%esi
call   1030 <Rotate@plt>
mov    -0x28(%rbp),%edi
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
sub    -0x1c(%rbp),%eax
cltq
add    -0x10(%rbp),%rax
mov    %eax,%esi
call   1040 <HashLen16@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HashLen17to32>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
imul   $0xbe98f273,(%rdi),%r12d
imul   $0x2f90404f,-0x8(%rdi,%rsi,1),%r14d
90 2f
mov    0x8(%rdi),%r15d
imul   $0x97cb3127,-0x10(%rdi,%rsi,1),%r13d
cb 97
mov    %r12d,%edi
sub    %r15d,%edi
mov    $0x2b,%esi
call   1030 <Rotate@plt>
mov    %eax,%ebp
mov    %r14d,%edi
mov    $0x1e,%esi
call   1030 <Rotate@plt>
add    %r13d,%ebp
add    %eax,%ebp
xor    $0x509e6557,%r15d
mov    %r15d,%edi
mov    $0x14,%esi
call   1030 <Rotate@plt>
add    %r12d,%ebx
sub    %r14d,%ebx
add    %eax,%ebx
mov    %ebp,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <HashLen16@plt>

LLVM IR (-O0):
define i32 @HashLen17to32(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %3
store i64 %1, i64* %4
%9 = load i8*, i8** %3
%10 = bitcast i8* %9 to i32*
%11 = load i32, i32* %10
%12 = sext i32 %11 to i64
%13 = mul i64 %12, -5435081209227447693
%14 = trunc i64 %13 to i32
store i32 %14, i32* %5
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 8
%17 = bitcast i8* %16 to i32*
%18 = load i32, i32* %17
store i32 %18, i32* %6
%19 = load i8*, i8** %3
%20 = load i64, i64* %4
%21 = getelementptr inbounds i8, i8* %19, i64 %20
%22 = getelementptr inbounds i8, i8* %21, i64 -8
%23 = bitcast i8* %22 to i32*
%24 = load i32, i32* %23
%25 = sext i32 %24 to i64
%26 = mul i64 %25, -7286425919675154353
%27 = trunc i64 %26 to i32
store i32 %27, i32* %7
%28 = load i8*, i8** %3
%29 = load i64, i64* %4
%30 = getelementptr inbounds i8, i8* %28, i64 %29
%31 = getelementptr inbounds i8, i8* %30, i64 -16
%32 = bitcast i8* %31 to i32*
%33 = load i32, i32* %32
%34 = sext i32 %33 to i64
%35 = mul i64 %34, -4348849565147123417
%36 = trunc i64 %35 to i32
store i32 %36, i32* %8
%37 = load i32, i32* %5
%38 = load i32, i32* %6
%39 = sub nsw i32 %37, %38
%40 = call i32 @Rotate(i32 %39, i32 43)
%41 = load i32, i32* %7
%42 = call i32 @Rotate(i32 %41, i32 30)
%43 = add nsw i32 %40, %42
%44 = load i32, i32* %8
%45 = add nsw i32 %43, %44
%46 = load i32, i32* %5
%47 = load i32, i32* %6
%48 = sext i32 %47 to i64
%49 = xor i64 %48, -3942382747735136937
%50 = trunc i64 %49 to i32
%51 = call i32 @Rotate(i32 %50, i32 20)
%52 = add nsw i32 %46, %51
%53 = load i32, i32* %7
%54 = sub nsw i32 %52, %53
%55 = sext i32 %54 to i64
%56 = load i64, i64* %4
%57 = add i64 %55, %56
%58 = trunc i64 %57 to i32
%59 = call i32 @HashLen16(i32 %45, i32 %58)
ret i32 %59
}

LLVM IR (-O2):
define i32 @HashLen17to32(i8* nocapture %0, i64 %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = mul i32 %4, -1097272717
%6 = getelementptr inbounds i8, i8* %0, i64 8
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %7
%9 = getelementptr inbounds i8, i8* %0, i64 %1
%10 = getelementptr inbounds i8, i8* %9, i64 -8
%11 = bitcast i8* %10 to i32*
%12 = load i32, i32* %11
%13 = mul i32 %12, 797982799
%14 = getelementptr inbounds i8, i8* %9, i64 -16
%15 = bitcast i8* %14 to i32*
%16 = load i32, i32* %15
%17 = mul i32 %16, -1748291289
%18 = sub nsw i32 %5, %8
%19 = tail call i32 @Rotate(i32 %18, i32 43)
%20 = tail call i32 @Rotate(i32 %13, i32 30)
%21 = add i32 %17, %19
%22 = add i32 %21, %20
%23 = xor i32 %8, 1352557911
%24 = tail call i32 @Rotate(i32 %23, i32 20)
%25 = trunc i64 %1 to i32
%26 = add i32 %5, %25
%27 = sub i32 %26, %13
%28 = add i32 %27, %24
%29 = tail call i32 @HashLen16(i32 %22, i32 %28)
ret i32 %29
}