// File: BU-DiSC[P]BF-Shared-Hashing/hash/xxhash.cc
// Function: ROCKSDB_XXH32_update
XXH_PUBLIC_API XXH_errorcode
XXH32_update(XXH32_state_t* state, const void* input, size_t len)
{
    if (input==NULL)
#if defined(XXH_ACCEPT_NULL_INPUT_POINTER) && (XXH_ACCEPT_NULL_INPUT_POINTER>=1)
        return XXH_OK;
#else
        return XXH_ERROR;
#endif

    {   const xxh_u8* p = (const xxh_u8*)input;
        const xxh_u8* const bEnd = p + len;

        state->total_len_32 += (XXH32_hash_t)len;
        state->large_len |= (XXH32_hash_t)((len>=16) | (state->total_len_32>=16));

        if (state->memsize + len < 16)  {   /* fill in tmp buffer */
            XXH_memcpy((xxh_u8*)(state->mem32) + state->memsize, input, len);
            state->memsize += (XXH32_hash_t)len;
            return XXH_OK;
        }

        if (state->memsize) {   /* some data left from previous update */
            XXH_memcpy((xxh_u8*)(state->mem32) + state->memsize, input, 16-state->memsize);
            {   const xxh_u32* p32 = state->mem32;
                state->v1 = XXH32_round(state->v1, XXH_readLE32(p32)); p32++;
                state->v2 = XXH32_round(state->v2, XXH_readLE32(p32)); p32++;
                state->v3 = XXH32_round(state->v3, XXH_readLE32(p32)); p32++;
                state->v4 = XXH32_round(state->v4, XXH_readLE32(p32));
            }
            p += 16-state->memsize;
            state->memsize = 0;
        }

        // uintptr_t casts added to avoid array-bounds error on
        // some inlined calls
        if ((uintptr_t)p <= (uintptr_t)bEnd - 16) {
            const uintptr_t limit = (uintptr_t)bEnd - 16;
            xxh_u32 v1 = state->v1;
            xxh_u32 v2 = state->v2;
            xxh_u32 v3 = state->v3;
            xxh_u32 v4 = state->v4;

            do {
                v1 = XXH32_round(v1, XXH_readLE32(p)); p+=4;
                v2 = XXH32_round(v2, XXH_readLE32(p)); p+=4;
                v3 = XXH32_round(v3, XXH_readLE32(p)); p+=4;
                v4 = XXH32_round(v4, XXH_readLE32(p)); p+=4;
            } while ((uintptr_t)p <= limit);

            state->v1 = v1;
            state->v2 = v2;
            state->v3 = v3;
            state->v4 = v4;
        }

        if (p < bEnd) {
            XXH_memcpy(state->mem32, p, (size_t)(bEnd-p));
            state->memsize = (unsigned)(bEnd-p);
        }
    }

    return XXH_OK;
}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
movq %rdx, 0x58(%rsp)
cmpq $0x0, 0x60(%rsp)
jne 0x4d2db
movl $0x1, 0x74(%rsp)
jmp 0x4d6e4
movq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
addq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x58(%rsp), %rax
movl %eax, %ecx
movq 0x68(%rsp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
cmpq $0x10, 0x58(%rsp)
setae %al
andb $0x1, %al
movzbl %al, %ecx
movq 0x68(%rsp), %rax
cmpl $0x10, (%rax)
setae %al
andb $0x1, %al
movzbl %al, %eax
orl %eax, %ecx
movq 0x68(%rsp), %rax
orl 0x4(%rax), %ecx
movl %ecx, 0x4(%rax)
movq 0x68(%rsp), %rax
movl 0x28(%rax), %eax
addq 0x58(%rsp), %rax
cmpq $0x10, %rax
jae 0x4d384
movq 0x68(%rsp), %rdi
addq $0x18, %rdi
movq 0x68(%rsp), %rax
movl 0x28(%rax), %eax
addq %rax, %rdi
movq 0x60(%rsp), %rsi
movq 0x58(%rsp), %rdx
callq 0x4d6f0
movq 0x58(%rsp), %rax
movl %eax, %ecx
movq 0x68(%rsp), %rax
addl 0x28(%rax), %ecx
movl %ecx, 0x28(%rax)
movl $0x0, 0x74(%rsp)
jmp 0x4d6e4
movq 0x68(%rsp), %rax
cmpl $0x0, 0x28(%rax)
je 0x4d50e
movq 0x68(%rsp), %rdi
addq $0x18, %rdi
movq 0x68(%rsp), %rax
movl 0x28(%rax), %eax
addq %rax, %rdi
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rcx
movl $0x10, %eax
subl 0x28(%rcx), %eax
movl %eax, %eax
movl %eax, %edx
callq 0x4d6f0
movq 0x68(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x40(%rsp)
movq 0x68(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, 0x18(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0xb0(%rsp), %rdi
callq 0x5fa70
movl 0x18(%rsp), %edi
movl %eax, %esi
callq 0x4d730
movl %eax, %ecx
movq 0x68(%rsp), %rax
movl %ecx, 0x8(%rax)
movq 0x40(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x40(%rsp)
movq 0x68(%rsp), %rax
movl 0xc(%rax), %eax
movl %eax, 0x1c(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rdi
callq 0x5fa70
movl 0x1c(%rsp), %edi
movl %eax, %esi
callq 0x4d730
movl %eax, %ecx
movq 0x68(%rsp), %rax
movl %ecx, 0xc(%rax)
movq 0x40(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x40(%rsp)
movq 0x68(%rsp), %rax
movl 0x10(%rax), %eax
movl %eax, 0x20(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x5fa70
movl 0x20(%rsp), %edi
movl %eax, %esi
callq 0x4d730
movl %eax, %ecx
movq 0x68(%rsp), %rax
movl %ecx, 0x10(%rax)
movq 0x40(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x40(%rsp)
movq 0x68(%rsp), %rax
movl 0x14(%rax), %eax
movl %eax, 0x24(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0x98(%rsp), %rdi
callq 0x5fa70
movl 0x24(%rsp), %edi
movl %eax, %esi
callq 0x4d730
movl %eax, %ecx
movq 0x68(%rsp), %rax
movl %ecx, 0x14(%rax)
movq 0x68(%rsp), %rax
movl $0x10, %ecx
subl 0x28(%rax), %ecx
movq 0x50(%rsp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, 0x50(%rsp)
movq 0x68(%rsp), %rax
movl $0x0, 0x28(%rax)
movq 0x50(%rsp), %rax
movq 0x48(%rsp), %rcx
subq $0x10, %rcx
cmpq %rcx, %rax
ja 0x4d699
movq 0x48(%rsp), %rax
subq $0x10, %rax
movq %rax, 0x38(%rsp)
movq 0x68(%rsp), %rax
movl 0x8(%rax), %eax
movl %eax, 0x34(%rsp)
movq 0x68(%rsp), %rax
movl 0xc(%rax), %eax
movl %eax, 0x30(%rsp)
movq 0x68(%rsp), %rax
movl 0x10(%rax), %eax
movl %eax, 0x2c(%rsp)
movq 0x68(%rsp), %rax
movl 0x14(%rax), %eax
movl %eax, 0x28(%rsp)
movl 0x34(%rsp), %eax
movl %eax, 0x8(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x90(%rsp), %rdi
callq 0x5fa70
movl 0x8(%rsp), %edi
movl %eax, %esi
callq 0x4d730
movl %eax, 0x34(%rsp)
movq 0x50(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x50(%rsp)
movl 0x30(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x88(%rsp), %rdi
callq 0x5fa70
movl 0xc(%rsp), %edi
movl %eax, %esi
callq 0x4d730
movl %eax, 0x30(%rsp)
movq 0x50(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x50(%rsp)
movl 0x2c(%rsp), %eax
movl %eax, 0x10(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rdi
callq 0x5fa70
movl 0x10(%rsp), %edi
movl %eax, %esi
callq 0x4d730
movl %eax, 0x2c(%rsp)
movq 0x50(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x50(%rsp)
movl 0x28(%rsp), %eax
movl %eax, 0x14(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x78(%rsp), %rdi
callq 0x5fa70
movl 0x14(%rsp), %edi
movl %eax, %esi
callq 0x4d730
movl %eax, 0x28(%rsp)
movq 0x50(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
cmpq 0x38(%rsp), %rax
jbe 0x4d563
movl 0x34(%rsp), %ecx
movq 0x68(%rsp), %rax
movl %ecx, 0x8(%rax)
movl 0x30(%rsp), %ecx
movq 0x68(%rsp), %rax
movl %ecx, 0xc(%rax)
movl 0x2c(%rsp), %ecx
movq 0x68(%rsp), %rax
movl %ecx, 0x10(%rax)
movl 0x28(%rsp), %ecx
movq 0x68(%rsp), %rax
movl %ecx, 0x14(%rax)
movq 0x50(%rsp), %rax
cmpq 0x48(%rsp), %rax
jae 0x4d6dc
movq 0x68(%rsp), %rdi
addq $0x18, %rdi
movq 0x50(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0x50(%rsp), %rax
subq %rax, %rdx
callq 0x4d6f0
movq 0x48(%rsp), %rax
movq 0x50(%rsp), %rcx
subq %rcx, %rax
movl %eax, %ecx
movq 0x68(%rsp), %rax
movl %ecx, 0x28(%rax)
movl $0x0, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0xb8, %rsp
retq