// File: sgielen[P]clife/./xxhash/xxhash.h
// Function: XXH3_digest_long(unsigned long*, XXH3_state_s const*, unsigned char const*)
XXH_FORCE_INLINE void
XXH3_digest_long (XXH64_hash_t* acc,
                  const XXH3_state_t* state,
                  const unsigned char* secret)
{
    /*
     * Digest on a local copy. This way, the state remains unaltered, and it can
     * continue ingesting more input afterwards.
     */
    XXH_memcpy(acc, state->acc, sizeof(state->acc));
    if (state->bufferedSize >= XXH_STRIPE_LEN) {
        size_t const nbStripes = (state->bufferedSize - 1) / XXH_STRIPE_LEN;
        size_t nbStripesSoFar = state->nbStripesSoFar;
        XXH3_consumeStripes(acc,
                           &nbStripesSoFar, state->nbStripesPerBlock,
                            state->buffer, nbStripes,
                            secret, state->secretLimit,
                            XXH3_accumulate_512, XXH3_scrambleAcc);
        /* last stripe */
        XXH3_accumulate_512(acc,
                            state->buffer + state->bufferedSize - XXH_STRIPE_LEN,
                            secret + state->secretLimit - XXH_SECRET_LASTACC_START);
    } else {  /* bufferedSize < XXH_STRIPE_LEN */
        xxh_u8 lastStripe[XXH_STRIPE_LEN];
        size_t const catchupSize = XXH_STRIPE_LEN - state->bufferedSize;
        XXH_ASSERT(state->bufferedSize > 0);  /* there is always some input buffered */
        XXH_memcpy(lastStripe, state->buffer + sizeof(state->buffer) - catchupSize, catchupSize);
        XXH_memcpy(lastStripe + catchupSize, state->buffer, state->bufferedSize);
        XXH3_accumulate_512(acc,
                            lastStripe,
                            secret + state->secretLimit - XXH_SECRET_LASTACC_START);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x40, %edx
callq 0x25d0
movq -0x10(%rbp), %rax
cmpl $0x40, 0x200(%rax)
jb 0x4a4e
movq -0x10(%rbp), %rax
movl 0x200(%rax), %eax
subl $0x1, %eax
shrl $0x6, %eax
movl %eax, %eax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x208(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x218(%rax), %rdx
movq -0x10(%rbp), %rcx
addq $0x100, %rcx            # imm = 0x100
movq -0x20(%rbp), %r8
movq -0x18(%rbp), %r9
movq -0x10(%rbp), %rax
movq 0x220(%rax), %r11
leaq -0x28(%rbp), %rsi
leaq -0x5f7(%rip), %r10      # 0x4400
leaq -0x42e(%rip), %rax      # 0x45d0
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x68e0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x100, %rsi            # imm = 0x100
movq -0x10(%rbp), %rax
movl 0x200(%rax), %eax
addq %rax, %rsi
addq $-0x40, %rsi
movq -0x18(%rbp), %rdx
movq -0x10(%rbp), %rax
addq 0x220(%rax), %rdx
addq $-0x7, %rdx
callq 0x4400
jmp 0x4acf
movq -0x10(%rbp), %rcx
movl $0x40, %eax
subl 0x200(%rcx), %eax
movl %eax, %eax
movq %rax, -0x78(%rbp)
leaq -0x70(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x100, %rsi            # imm = 0x100
addq $0x100, %rsi            # imm = 0x100
xorl %eax, %eax
subq -0x78(%rbp), %rax
addq %rax, %rsi
movq -0x78(%rbp), %rdx
callq 0x25d0
leaq -0x70(%rbp), %rdi
addq -0x78(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x100, %rsi            # imm = 0x100
movq -0x10(%rbp), %rax
movl 0x200(%rax), %eax
movl %eax, %edx
callq 0x25d0
movq -0x8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x10(%rbp), %rax
addq 0x220(%rax), %rdx
addq $-0x7, %rdx
callq 0x4400
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax,%rax)