// File: BU-DiSC[P]BF-Shared-Hashing/hash/xxhash.cc
// Function: ROCKSDB_XXH64_update
XXH_PUBLIC_API XXH_errorcode
XXH64_update (XXH64_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 += len;

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

        if (state->memsize) {   /* tmp buffer is full */
            XXH_memcpy(((xxh_u8*)state->mem64) + state->memsize, input, 32-state->memsize);
            state->v1 = XXH64_round(state->v1, XXH_readLE64(state->mem64+0));
            state->v2 = XXH64_round(state->v2, XXH_readLE64(state->mem64+1));
            state->v3 = XXH64_round(state->v3, XXH_readLE64(state->mem64+2));
            state->v4 = XXH64_round(state->v4, XXH_readLE64(state->mem64+3));
            p += 32-state->memsize;
            state->memsize = 0;
        }

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

            do {
                v1 = XXH64_round(v1, XXH_readLE64(p)); p+=8;
                v2 = XXH64_round(v2, XXH_readLE64(p)); p+=8;
                v3 = XXH64_round(v3, XXH_readLE64(p)); p+=8;
                v4 = XXH64_round(v4, XXH_readLE64(p)); p+=8;
            } while ((uintptr_t)p <= limit);

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

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

    return XXH_OK;
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, 0x88(%rsp)
movq %rsi, 0x80(%rsp)
movq %rdx, 0x78(%rsp)
cmpq $0x0, 0x80(%rsp)
jne 0x4e5d7
movl $0x1, 0x94(%rsp)
jmp 0x4ea4b
movq 0x80(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rax
addq 0x78(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x78(%rsp), %rcx
movq 0x88(%rsp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq 0x88(%rsp), %rax
movl 0x48(%rax), %eax
addq 0x78(%rsp), %rax
cmpq $0x20, %rax
jae 0x4e66d
movq 0x88(%rsp), %rdi
addq $0x28, %rdi
movq 0x88(%rsp), %rax
movl 0x48(%rax), %eax
addq %rax, %rdi
movq 0x80(%rsp), %rsi
movq 0x78(%rsp), %rdx
callq 0x4d6f0
movq 0x78(%rsp), %rax
movl %eax, %ecx
movq 0x88(%rsp), %rax
addl 0x48(%rax), %ecx
movl %ecx, 0x48(%rax)
movl $0x0, 0x94(%rsp)
jmp 0x4ea4b
movq 0x88(%rsp), %rax
cmpl $0x0, 0x48(%rax)
je 0x4e82c
movq 0x88(%rsp), %rdi
addq $0x28, %rdi
movq 0x88(%rsp), %rax
movl 0x48(%rax), %eax
addq %rax, %rdi
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rcx
movl $0x20, %eax
subl 0x48(%rcx), %eax
movl %eax, %eax
movl %eax, %edx
callq 0x4d6f0
movq 0x88(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x88(%rsp), %rax
addq $0x28, %rax
movq %rax, 0xd0(%rsp)
movq 0xd0(%rsp), %rdi
callq 0x5fae0
movq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0x4ea60
movq %rax, %rcx
movq 0x88(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x88(%rsp), %rax
addq $0x28, %rax
addq $0x8, %rax
movq %rax, 0xc8(%rsp)
movq 0xc8(%rsp), %rdi
callq 0x5fae0
movq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x4ea60
movq %rax, %rcx
movq 0x88(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x88(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x88(%rsp), %rax
addq $0x28, %rax
addq $0x10, %rax
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x5fae0
movq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0x4ea60
movq %rax, %rcx
movq 0x88(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x88(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x88(%rsp), %rax
addq $0x28, %rax
addq $0x18, %rax
movq %rax, 0xb8(%rsp)
movq 0xb8(%rsp), %rdi
callq 0x5fae0
movq 0x38(%rsp), %rdi
movq %rax, %rsi
callq 0x4ea60
movq %rax, %rcx
movq 0x88(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x88(%rsp), %rax
movl $0x20, %ecx
subl 0x48(%rax), %ecx
movq 0x70(%rsp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, 0x70(%rsp)
movq 0x88(%rsp), %rax
movl $0x0, 0x48(%rax)
movq 0x70(%rsp), %rax
addq $0x20, %rax
movq 0x68(%rsp), %rcx
cmpq %rcx, %rax
ja 0x4e9f7
movq 0x68(%rsp), %rax
subq $0x20, %rax
movq %rax, 0x60(%rsp)
movq 0x88(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x58(%rsp)
movq 0x88(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x50(%rsp)
movq 0x88(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x48(%rsp)
movq 0x88(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x58(%rsp), %rax
movq %rax, (%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0xb0(%rsp), %rdi
callq 0x5fae0
movq (%rsp), %rdi
movq %rax, %rsi
callq 0x4ea60
movq %rax, 0x58(%rsp)
movq 0x70(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x70(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rdi
callq 0x5fae0
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x4ea60
movq %rax, 0x50(%rsp)
movq 0x70(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x70(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x5fae0
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x4ea60
movq %rax, 0x48(%rsp)
movq 0x70(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x70(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0x98(%rsp), %rdi
callq 0x5fae0
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x4ea60
movq %rax, 0x40(%rsp)
movq 0x70(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rax
cmpq 0x60(%rsp), %rax
jbe 0x4e895
movq 0x58(%rsp), %rcx
movq 0x88(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x50(%rsp), %rcx
movq 0x88(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x48(%rsp), %rcx
movq 0x88(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x40(%rsp), %rcx
movq 0x88(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x70(%rsp), %rax
cmpq 0x68(%rsp), %rax
jae 0x4ea40
movq 0x88(%rsp), %rdi
addq $0x28, %rdi
movq 0x70(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq 0x70(%rsp), %rax
subq %rax, %rdx
callq 0x4d6f0
movq 0x68(%rsp), %rax
movq 0x70(%rsp), %rcx
subq %rcx, %rax
movl %eax, %ecx
movq 0x88(%rsp), %rax
movl %ecx, 0x48(%rax)
movl $0x0, 0x94(%rsp)
movl 0x94(%rsp), %eax
addq $0xd8, %rsp
retq
nopw (%rax,%rax)