// File: BU-DiSC[P]BF-Shared-Hashing/hash/xxhash.cc
// Function: ROCKSDB_XXH32
XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t len, XXH32_hash_t seed)
{
#if 0
    /* Simple version, good for code maintenance, but unfortunately slow for small inputs */
    XXH32_state_t state;
    XXH32_reset(&state, seed);
    XXH32_update(&state, (const xxh_u8*)input, len);
    return XXH32_digest(&state);

#else

    if (XXH_FORCE_ALIGN_CHECK) {
        if ((((size_t)input) & 3) == 0) {   /* Input is 4-bytes aligned, leverage the speed benefit */
            return XXH32_endian_align((const xxh_u8*)input, len, seed, XXH_aligned);
    }   }

    return XXH32_endian_align((const xxh_u8*)input, len, seed, XXH_unaligned);
#endif
}

// Assembly:
subq $0xe8, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movl %edx, 0x14(%rsp)
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rcx
movl 0x14(%rsp), %eax
movq %rdx, 0x60(%rsp)
movq %rcx, 0x58(%rsp)
movl %eax, 0x54(%rsp)
movl $0x1, 0x50(%rsp)
movq 0x60(%rsp), %rax
addq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
cmpq $0x10, 0x58(%rsp)
jb 0x4d181
movq 0x48(%rsp), %rax
addq $-0xf, %rax
movq %rax, 0x38(%rsp)
movl 0x54(%rsp), %eax
addl $0x9e3779b1, %eax       # imm = 0x9E3779B1
addl $0x85ebca77, %eax       # imm = 0x85EBCA77
movl %eax, 0x34(%rsp)
movl 0x54(%rsp), %eax
addl $0x85ebca77, %eax       # imm = 0x85EBCA77
movl %eax, 0x30(%rsp)
movl 0x54(%rsp), %eax
movl %eax, 0x2c(%rsp)
movl 0x54(%rsp), %eax
subl $0x9e3779b1, %eax       # imm = 0x9E3779B1
movl %eax, 0x28(%rsp)
movl 0x34(%rsp), %eax
movl %eax, 0x10(%rsp)
movq 0x60(%rsp), %rcx
movl 0x50(%rsp), %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
cmpl $0x1, 0xcc(%rsp)
jne 0x4cfa6
movq 0xd0(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq 0xe0(%rsp), %rdi
callq 0x5fa70
movl %eax, 0xdc(%rsp)
jmp 0x4cfb7
movq 0xd0(%rsp), %rax
movl (%rax), %eax
movl %eax, 0xdc(%rsp)
movl 0x10(%rsp), %edi
movl 0xdc(%rsp), %esi
callq 0x4d730
movl %eax, 0x34(%rsp)
movq 0x60(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x60(%rsp)
movl 0x30(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x60(%rsp), %rcx
movl 0x50(%rsp), %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
cmpl $0x1, 0xac(%rsp)
jne 0x4d029
movq 0xb0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x5fa70
movl %eax, 0xbc(%rsp)
jmp 0x4d03a
movq 0xb0(%rsp), %rax
movl (%rax), %eax
movl %eax, 0xbc(%rsp)
movl 0xc(%rsp), %edi
movl 0xbc(%rsp), %esi
callq 0x4d730
movl %eax, 0x30(%rsp)
movq 0x60(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x60(%rsp)
movl 0x2c(%rsp), %eax
movl %eax, 0x8(%rsp)
movq 0x60(%rsp), %rcx
movl 0x50(%rsp), %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
cmpl $0x1, 0x8c(%rsp)
jne 0x4d0ac
movq 0x90(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x5fa70
movl %eax, 0x9c(%rsp)
jmp 0x4d0bd
movq 0x90(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x9c(%rsp)
movl 0x8(%rsp), %edi
movl 0x9c(%rsp), %esi
callq 0x4d730
movl %eax, 0x2c(%rsp)
movq 0x60(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x60(%rsp)
movl 0x28(%rsp), %eax
movl %eax, 0x4(%rsp)
movq 0x60(%rsp), %rcx
movl 0x50(%rsp), %eax
movq %rcx, 0x70(%rsp)
movl %eax, 0x6c(%rsp)
cmpl $0x1, 0x6c(%rsp)
jne 0x4d120
movq 0x70(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rdi
callq 0x5fa70
movl %eax, 0x7c(%rsp)
jmp 0x4d12b
movq 0x70(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x7c(%rsp)
movl 0x4(%rsp), %edi
movl 0x7c(%rsp), %esi
callq 0x4d730
movl %eax, 0x28(%rsp)
movq 0x60(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
cmpq 0x38(%rsp), %rax
jb 0x4cf56
movl 0x34(%rsp), %eax
roll %eax
movl 0x30(%rsp), %ecx
roll $0x7, %ecx
addl %ecx, %eax
movl 0x2c(%rsp), %ecx
roll $0xc, %ecx
addl %ecx, %eax
movl 0x28(%rsp), %ecx
roll $0x12, %ecx
addl %ecx, %eax
movl %eax, 0x44(%rsp)
jmp 0x4d18e
movl 0x54(%rsp), %eax
addl $0x165667b1, %eax       # imm = 0x165667B1
movl %eax, 0x44(%rsp)
movq 0x58(%rsp), %rax
addl 0x44(%rsp), %eax
movl %eax, 0x44(%rsp)
movl 0x44(%rsp), %edi
movq 0x60(%rsp), %rsi
movq 0x58(%rsp), %rdx
andq $0xf, %rdx
movl 0x50(%rsp), %ecx
callq 0x4d800
addq $0xe8, %rsp
retq
nop