// File: /workspace/github_cpp_makefile_star2_O1/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, %rbx # imm = 0x27D4EB2F165667C5
leaq (%rdi,%rsi), %r9
cmpq $0x20, %rsi
jb 0x275f
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 0x2605
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, %rbx # imm = 0x27D4EB2F165667C5
jmp 0x2762
addq %rbx, %rdx
addq %rsi, %rdx
leaq 0x8(%rdi), %rsi
cmpq %r9, %rsi
jbe 0x2776
movq %rdx, %rsi
movq %rdi, %r11
jmp 0x27ba
movabsq $-0x6c158a5880000000, %r8 # imm = 0x93EA75A780000000
movq (%rdi), %r11
movq %r11, %rsi
imulq %rax, %rsi
imulq %r8, %r11
shrq $0x21, %rsi
orq %r11, %rsi
imulq %rcx, %rsi
xorq %rdx, %rsi
rolq $0x1b, %rsi
imulq %rcx, %rsi
addq %r10, %rsi
leaq 0x8(%rdi), %r11
addq $0x10, %rdi
movq %rsi, %rdx
cmpq %r9, %rdi
movq %r11, %rdi
jbe 0x2780
movabsq $0x165667b19e3779f9, %rdx # imm = 0x165667B19E3779F9
leaq 0x4(%r11), %rdi
cmpq %r9, %rdi
jbe 0x27d2
movq %r11, %rdi
jmp 0x27ea
movl (%r11), %r8d
imulq %rcx, %r8
xorq %rsi, %r8
rolq $0x17, %r8
imulq %rax, %r8
addq %rdx, %r8
movq %r8, %rsi
cmpq %r9, %rdi
jae 0x280f
movzbl (%rdi), %r8d
imulq %rbx, %r8
xorq %rsi, %r8
rolq $0xb, %r8
imulq %rcx, %r8
incq %rdi
movq %r8, %rsi
cmpq %r9, %rdi
jb 0x27ef
jmp 0x2812
movq %rsi, %r8
movq %r8, %rcx
shrq $0x21, %rcx
xorq %r8, %rcx
imulq %rax, %rcx
movq %rcx, %rsi
shrq $0x1d, %rsi
xorq %rcx, %rsi
imulq %rdx, %rsi
movq %rsi, %rax
shrq $0x20, %rax
xorq %rsi, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq