// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/src/extra/xxhash/xxhash.c
// Function: XXH64_update
FORCE_INLINE
XXH_errorcode XXH64_update_endian (XXH64_state_t* state, const void* input, size_t len, XXH_endianess endian)
{
    const BYTE* p = (const BYTE*)input;
    const BYTE* const bEnd = p + 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

    state->total_len += len;

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

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

    if (p+32 <= bEnd) {
        const BYTE* const limit = bEnd - 32;
        U64 v1 = state->v1;
        U64 v2 = state->v2;
        U64 v3 = state->v3;
        U64 v4 = state->v4;

        do {
            v1 = XXH64_round(v1, XXH_readLE64(p, endian)); p+=8;
            v2 = XXH64_round(v2, XXH_readLE64(p, endian)); p+=8;
            v3 = XXH64_round(v3, XXH_readLE64(p, endian)); p+=8;
            v4 = XXH64_round(v4, XXH_readLE64(p, endian)); p+=8;
        } while (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:
testq %rsi, %rsi
je 0x2d022
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
addq %rdx, (%rdi)
movl 0x48(%rdi), %eax
leaq (%rax,%rdx), %rcx
cmpq $0x1f, %rcx
ja 0x2d026
leaq (%r14,%rax), %rdi
addq $0x28, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0xb420
addl 0x48(%r14), %ebx
jmp 0x2d173
pushq $0x1
popq %rax
retq
addq %r15, %rbx
movabsq $-0x3d4d51c2d82b14b1, %r12 # imm = 0xC2B2AE3D27D4EB4F
movabsq $-0x61c8864e7a143579, %r13 # imm = 0x9E3779B185EBCA87
testq %rax, %rax
je 0x2d0c9
leaq (%r14,%rax), %rdi
addq $0x28, %rdi
pushq $0x20
popq %rbp
movl %ebp, %edx
subl %eax, %edx
movq %r15, %rsi
callq 0xb420
movq 0x28(%r14), %rax
imulq %r12, %rax
addq 0x8(%r14), %rax
rolq $0x1f, %rax
imulq %r13, %rax
movq %rax, 0x8(%r14)
movq 0x30(%r14), %rax
imulq %r12, %rax
addq 0x10(%r14), %rax
rolq $0x1f, %rax
imulq %r13, %rax
movq %rax, 0x10(%r14)
movq 0x38(%r14), %rax
imulq %r12, %rax
addq 0x18(%r14), %rax
rolq $0x1f, %rax
imulq %r13, %rax
movq %rax, 0x18(%r14)
movq 0x40(%r14), %rax
imulq %r12, %rax
addq 0x20(%r14), %rax
rolq $0x1f, %rax
imulq %r13, %rax
movq %rax, 0x20(%r14)
subl 0x48(%r14), %ebp
addq %rbp, %r15
andl $0x0, 0x48(%r14)
leaq 0x20(%r15), %rax
cmpq %rbx, %rax
ja 0x2d15a
leaq -0x20(%rbx), %rax
movq 0x8(%r14), %rcx
movq 0x10(%r14), %rdx
movq 0x18(%r14), %rdi
movq 0x20(%r14), %rsi
movq (%r15), %r8
imulq %r12, %r8
addq %rcx, %r8
rolq $0x1f, %r8
movq %r8, %rcx
imulq %r13, %rcx
movq 0x8(%r15), %r8
imulq %r12, %r8
addq %rdx, %r8
rolq $0x1f, %r8
movq %r8, %rdx
movq 0x10(%r15), %r8
imulq %r12, %r8
addq %rdi, %r8
rolq $0x1f, %r8
imulq %r13, %rdx
movq %r8, %rdi
imulq %r13, %rdi
movq 0x18(%r15), %r8
imulq %r12, %r8
addq %rsi, %r8
rolq $0x1f, %r8
movq %r8, %rsi
imulq %r13, %rsi
addq $0x20, %r15
cmpq %rax, %r15
jbe 0x2d0ea
movq %rcx, 0x8(%r14)
movq %rdx, 0x10(%r14)
movq %rdi, 0x18(%r14)
movq %rsi, 0x20(%r14)
xorl %eax, %eax
cmpq %rbx, %r15
jae 0x2d179
leaq 0x28(%r14), %rdi
subq %r15, %rbx
movq %r15, %rsi
movq %rbx, %rdx
callq 0xb420
movl %ebx, 0x48(%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq