// File: /workspace/github_cpp_makefile_star2_O2/chahk0129[P]hash_bench/./util/hash.h
// Function: hash_compute(void const*, unsigned long, unsigned long, unsigned int)
uint64_t hash_compute(const void *input, uint64_t length, uint64_t seed, uint32_t align)
{
    const uint8_t *p = (const uint8_t *)input;
    const uint8_t *end = p + length;
    uint64_t hash;

    if (length >= 32)
    {
        const uint8_t *const limitation = end - 32;
        uint64_t v1 = seed + NUMBER64_1 + NUMBER64_2;
        uint64_t v2 = seed + NUMBER64_2;
        uint64_t v3 = seed + 0;
        uint64_t v4 = seed - NUMBER64_1;

        do
        {
            v1 += hash_get64bits(p) * NUMBER64_2;
            p += 8;
            v1 = shifting_hash(v1, 31);
            v1 *= NUMBER64_1;
            v2 += hash_get64bits(p) * NUMBER64_2;
            p += 8;
            v2 = shifting_hash(v2, 31);
            v2 *= NUMBER64_1;
            v3 += hash_get64bits(p) * NUMBER64_2;
            p += 8;
            v3 = shifting_hash(v3, 31);
            v3 *= NUMBER64_1;
            v4 += hash_get64bits(p) * NUMBER64_2;
            p += 8;
            v4 = shifting_hash(v4, 31);
            v4 *= NUMBER64_1;
        } while (p <= limitation);

        hash = shifting_hash(v1, 1) + shifting_hash(v2, 7) + shifting_hash(v3, 12) + shifting_hash(v4, 18);

        v1 *= NUMBER64_2;
        v1 = shifting_hash(v1, 31);
        v1 *= NUMBER64_1;
        hash ^= v1;
        hash = hash * NUMBER64_1 + NUMBER64_4;

        v2 *= NUMBER64_2;
        v2 = shifting_hash(v2, 31);
        v2 *= NUMBER64_1;
        hash ^= v2;
        hash = hash * NUMBER64_1 + NUMBER64_4;

        v3 *= NUMBER64_2;
        v3 = shifting_hash(v3, 31);
        v3 *= NUMBER64_1;
        hash ^= v3;
        hash = hash * NUMBER64_1 + NUMBER64_4;

        v4 *= NUMBER64_2;
        v4 = shifting_hash(v4, 31);
        v4 *= NUMBER64_1;
        hash ^= v4;
        hash = hash * NUMBER64_1 + NUMBER64_4;
    }
    else
    {
        hash = seed + NUMBER64_5;
    }

    hash += (uint64_t)length;

    while (p + 8 <= end)
    {
        uint64_t k1 = hash_get64bits(p);
        k1 *= NUMBER64_2;
        k1 = shifting_hash(k1, 31);
        k1 *= NUMBER64_1;
        hash ^= k1;
        hash = shifting_hash(hash, 27) * NUMBER64_1 + NUMBER64_4;
        p += 8;
    }

    if (p + 4 <= end)
    {
        hash ^= (uint64_t)(hash_get32bits(p)) * NUMBER64_1;
        hash = shifting_hash(hash, 23) * NUMBER64_2 + NUMBER64_3;
        p += 4;
    }

    while (p < end)
    {
        hash ^= (*p) * NUMBER64_5;
        hash = shifting_hash(hash, 11) * NUMBER64_1;
        p++;
    }

    hash ^= hash >> 33;
    hash *= NUMBER64_2;
    hash ^= hash >> 29;
    hash *= NUMBER64_3;
    hash ^= hash >> 32;

    return hash;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movabsq $-0x3d4d51c2d82b14b1, %rax # imm = 0xC2B2AE3D27D4EB4F
movabsq $-0x61c8864e7a143579, %rcx # imm = 0x9E3779B185EBCA87
movabsq $-0x7a1435883d4d519d, %r10 # imm = 0x85EBCA77C2B2AE63
movabsq $0x27d4eb2f165667c5, %r14 # imm = 0x27D4EB2F165667C5
leaq (%rdi,%rsi), %r9
cmpq $0x20, %rsi
jb 0x267f
leaq -0x20(%r9), %r8
movabsq $0x60ea27eeadc0b5d6, %rbp # imm = 0x60EA27EEADC0B5D6
addq %rdx, %rbp
leaq (%rdx,%rax), %r13
movabsq $0x61c8864e7a143579, %r14 # imm = 0x61C8864E7A143579
addq %rdx, %r14
movq (%rdi), %r12
imulq %rax, %r12
addq %rbp, %r12
rolq $0x1f, %r12
movq %r12, %rbp
imulq %rcx, %rbp
movq 0x8(%rdi), %r15
imulq %rax, %r15
addq %r13, %r15
rolq $0x1f, %r15
movq %r15, %r13
movq 0x10(%rdi), %rbx
imulq %rax, %rbx
addq %rdx, %rbx
rolq $0x1f, %rbx
imulq %rcx, %r13
movq %rbx, %rdx
imulq %rcx, %rdx
movq 0x18(%rdi), %r11
imulq %rax, %r11
addq %r14, %r11
rolq $0x1f, %r11
addq $0x20, %rdi
movq %r11, %r14
imulq %rcx, %r14
cmpq %r8, %rdi
jbe 0x2525
movabsq $0x3c6ef3630bd7950e, %r8 # imm = 0x3C6EF3630BD7950E
imulq %r12, %r8
shrq $0x3f, %rbp
orq %r8, %rbp
movabsq $0x1bbcd8c2f5e54380, %r8 # imm = 0x1BBCD8C2F5E54380
imulq %r15, %r8
shrq $0x39, %r13
addq %r8, %r13
addq %rbp, %r13
movabsq $0x779b185ebca87000, %r8 # imm = 0x779B185EBCA87000
imulq %rbx, %r8
shrq $0x34, %rdx
addq %r8, %rdx
movabsq $-0x1939e850d5e40000, %r8 # imm = 0xE6C617AF2A1C0000
imulq %r11, %r8
addq %rdx, %r8
addq %r13, %r8
shrq $0x2e, %r14
addq %r8, %r14
movabsq $-0x210ca4fef0869357, %rdx # imm = 0xDEF35B010F796CA9
movq %r12, %r13
imulq %rdx, %r13
movabsq $-0x784349ab80000000, %r8 # imm = 0x87BCB65480000000
imulq %r8, %r12
shrq $0x21, %r13
orq %r12, %r13
imulq %rcx, %r13
xorq %r14, %r13
imulq %rcx, %r13
addq %r10, %r13
movq %r15, %r14
imulq %rdx, %r14
imulq %r8, %r15
shrq $0x21, %r14
orq %r15, %r14
imulq %rcx, %r14
xorq %r13, %r14
imulq %rcx, %r14
addq %r10, %r14
movq %rbx, %r15
imulq %rdx, %r15
imulq %r8, %rbx
shrq $0x21, %r15
orq %rbx, %r15
imulq %rcx, %r15
xorq %r14, %r15
imulq %rcx, %r15
addq %r10, %r15
imulq %r11, %rdx
imulq %r8, %r11
shrq $0x21, %rdx
orq %r11, %rdx
imulq %rcx, %rdx
xorq %r15, %rdx
imulq %rcx, %rdx
addq %r10, %rdx
movabsq $0x27d4eb2f165667c5, %r14 # imm = 0x27D4EB2F165667C5
jmp 0x2682
addq %r14, %rdx
addq %rsi, %rdx
movabsq $-0x6c158a5880000000, %r8 # imm = 0x93EA75A780000000
leaq 0x8(%rdi), %r11
cmpq %r9, %r11
ja 0x26c7
movq (%rdi), %rdi
movq %rdi, %rbx
imulq %rax, %rbx
imulq %r8, %rdi
shrq $0x21, %rbx
orq %rdi, %rbx
imulq %rcx, %rbx
xorq %rdx, %rbx
rolq $0x1b, %rbx
imulq %rcx, %rbx
addq %r10, %rbx
movq %rbx, %rdx
movq %r11, %rdi
jmp 0x268f
movabsq $0x165667b19e3779f9, %r8 # imm = 0x165667B19E3779F9
leaq 0x4(%rdi), %r10
cmpq %r9, %r10
jbe 0x26df
movq %rdi, %r10
jmp 0x26f6
movl (%rdi), %edi
imulq %rcx, %rdi
xorq %rdx, %rdi
rolq $0x17, %rdi
imulq %rax, %rdi
addq %r8, %rdi
movq %rdi, %rdx
cmpq %r9, %r10
jae 0x2713
movzbl (%r10), %edi
imulq %r14, %rdi
xorq %rdx, %rdi
rolq $0xb, %rdi
imulq %rcx, %rdi
incq %r10
jmp 0x26f3
movq %rdx, %rcx
shrq $0x21, %rcx
xorq %rdx, %rcx
imulq %rax, %rcx
movq %rcx, %rdx
shrq $0x1d, %rdx
xorq %rcx, %rdx
imulq %r8, %rdx
movq %rdx, %rax
shrq $0x20, %rax
xorq %rdx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq