// File: BU-DiSC[P]BF-Shared-Hashing/hash/xxh3p.h
// Function: XXH3p_len_129to240_64b(unsigned char const*, unsigned long, unsigned char const*, unsigned long, unsigned long)
XXH_NO_INLINE XXH64_hash_t
XXH3p_len_129to240_64b(const xxh_u8* XXH_RESTRICT input, size_t len,
                      const xxh_u8* XXH_RESTRICT secret, size_t secretSize,
                      XXH64_hash_t seed)
{
    XXH_ASSERT(secretSize >= XXH3p_SECRET_SIZE_MIN); (void)secretSize;
    XXH_ASSERT(128 < len && len <= XXH3p_MIDSIZE_MAX);

    #define XXH3p_MIDSIZE_STARTOFFSET 3
    #define XXH3p_MIDSIZE_LASTOFFSET  17

    {   xxh_u64 acc = len * PRIME64_1;
        int const nbRounds = (int)len / 16;
        int i;
        for (i=0; i<8; i++) {
            acc += XXH3p_mix16B(input+(16*i), secret+(16*i), seed);
        }
        acc = XXH3p_avalanche(acc);
        XXH_ASSERT(nbRounds >= 8);
        for (i=8 ; i < nbRounds; i++) {
            acc += XXH3p_mix16B(input+(16*i), secret+(16*(i-8)) + XXH3p_MIDSIZE_STARTOFFSET, seed);
        }
        /* last bytes */
        acc += XXH3p_mix16B(input + len - 16, secret + XXH3p_SECRET_SIZE_MIN - XXH3p_MIDSIZE_LASTOFFSET, seed);
        return XXH3p_avalanche(acc);
    }
}

// Assembly:
subq $0x158, %rsp            # imm = 0x158
movq %rdi, 0x78(%rsp)
movq %rsi, 0x70(%rsp)
movq %rdx, 0x68(%rsp)
movq %rcx, 0x60(%rsp)
movq %r8, 0x58(%rsp)
movabsq $-0x61c8864e7a143579, %rax # imm = 0x9E3779B185EBCA87
imulq 0x70(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x70(%rsp), %rax
movl $0x10, %ecx
cltd
idivl %ecx
movl %eax, 0x4c(%rsp)
movl $0x0, 0x48(%rsp)
cmpl $0x8, 0x48(%rsp)
jge 0x51aaa
movq 0x78(%rsp), %rdx
movl 0x48(%rsp), %eax
shll $0x4, %eax
cltq
addq %rax, %rdx
movq 0x68(%rsp), %rcx
movl 0x48(%rsp), %eax
shll $0x4, %eax
cltq
addq %rax, %rcx
movq 0x58(%rsp), %rax
movq %rdx, 0x130(%rsp)
movq %rcx, 0x128(%rsp)
movq %rax, 0x120(%rsp)
movq 0x130(%rsp), %rax
movq %rax, 0x150(%rsp)
movq 0x150(%rsp), %rdi
callq 0x5fae0
movq %rax, 0x118(%rsp)
movq 0x130(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x148(%rsp)
movq 0x148(%rsp), %rdi
callq 0x5fae0
movq %rax, 0x110(%rsp)
movq 0x118(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x128(%rsp), %rax
movq %rax, 0x140(%rsp)
movq 0x140(%rsp), %rdi
callq 0x5fae0
movq %rax, %rcx
movq 0x30(%rsp), %rax
addq 0x120(%rsp), %rcx
xorq %rcx, %rax
movq %rax, 0x40(%rsp)
movq 0x110(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x128(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x138(%rsp)
movq 0x138(%rsp), %rdi
callq 0x5fae0
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdi
subq 0x120(%rsp), %rax
xorq %rax, %rsi
callq 0x5fb70
addq 0x50(%rsp), %rax
movq %rax, 0x50(%rsp)
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0x5196e
movq 0x50(%rsp), %rdi
callq 0x5fbb0
movq %rax, 0x50(%rsp)
movl $0x8, 0x48(%rsp)
movl 0x48(%rsp), %eax
cmpl 0x4c(%rsp), %eax
jge 0x51c07
movq 0x78(%rsp), %rdx
movl 0x48(%rsp), %eax
shll $0x4, %eax
cltq
addq %rax, %rdx
movq 0x68(%rsp), %rcx
movl 0x48(%rsp), %eax
subl $0x8, %eax
shll $0x4, %eax
cltq
addq %rax, %rcx
addq $0x3, %rcx
movq 0x58(%rsp), %rax
movq %rdx, 0xe8(%rsp)
movq %rcx, 0xe0(%rsp)
movq %rax, 0xd8(%rsp)
movq 0xe8(%rsp), %rax
movq %rax, 0x108(%rsp)
movq 0x108(%rsp), %rdi
callq 0x5fae0
movq %rax, 0xd0(%rsp)
movq 0xe8(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x100(%rsp)
movq 0x100(%rsp), %rdi
callq 0x5fae0
movq %rax, 0xc8(%rsp)
movq 0xd0(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0xe0(%rsp), %rax
movq %rax, 0xf8(%rsp)
movq 0xf8(%rsp), %rdi
callq 0x5fae0
movq %rax, %rcx
movq 0x18(%rsp), %rax
addq 0xd8(%rsp), %rcx
xorq %rcx, %rax
movq %rax, 0x28(%rsp)
movq 0xc8(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0xe0(%rsp), %rax
addq $0x8, %rax
movq %rax, 0xf0(%rsp)
movq 0xf0(%rsp), %rdi
callq 0x5fae0
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdi
subq 0xd8(%rsp), %rax
xorq %rax, %rsi
callq 0x5fb70
addq 0x50(%rsp), %rax
movq %rax, 0x50(%rsp)
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0x51ac1
movq 0x78(%rsp), %rdx
addq 0x70(%rsp), %rdx
addq $-0x10, %rdx
movq 0x68(%rsp), %rcx
addq $0x88, %rcx
addq $-0x11, %rcx
movq 0x58(%rsp), %rax
movq %rdx, 0xa0(%rsp)
movq %rcx, 0x98(%rsp)
movq %rax, 0x90(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x5fae0
movq %rax, 0x88(%rsp)
movq 0xa0(%rsp), %rax
addq $0x8, %rax
movq %rax, 0xb8(%rsp)
movq 0xb8(%rsp), %rdi
callq 0x5fae0
movq %rax, 0x80(%rsp)
movq 0x88(%rsp), %rax
movq %rax, (%rsp)
movq 0x98(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0xb0(%rsp), %rdi
callq 0x5fae0
movq %rax, %rcx
movq (%rsp), %rax
addq 0x90(%rsp), %rcx
xorq %rcx, %rax
movq %rax, 0x10(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x98(%rsp), %rax
addq $0x8, %rax
movq %rax, 0xa8(%rsp)
movq 0xa8(%rsp), %rdi
callq 0x5fae0
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdi
subq 0x90(%rsp), %rax
xorq %rax, %rsi
callq 0x5fb70
addq 0x50(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rdi
callq 0x5fbb0
addq $0x158, %rsp            # imm = 0x158
retq
nopw %cs:(%rax,%rax)