// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/hyperloglog.c
// Function: MurmurHash64A
uint64_t MurmurHash64A (const void * key, int len, unsigned int seed) {
    const uint64_t m = 0xc6a4a7935bd1e995;
    const int r = 47;
    uint64_t h = seed ^ (len * m);
    const uint8_t *data = (const uint8_t *)key;
    const uint8_t *end = data + (len-(len&7));

    while(data != end) {
        uint64_t k;

#if (BYTE_ORDER == LITTLE_ENDIAN)
        k = *((uint64_t*)data);
#else
        k = (uint64_t) data[0];
        k |= (uint64_t) data[1] << 8;
        k |= (uint64_t) data[2] << 16;
        k |= (uint64_t) data[3] << 24;
        k |= (uint64_t) data[4] << 32;
        k |= (uint64_t) data[5] << 40;
        k |= (uint64_t) data[6] << 48;
        k |= (uint64_t) data[7] << 56;
#endif

        k *= m;
        k ^= k >> r;
        k *= m;
        h ^= k;
        h *= m;
        data += 8;
    }

    switch(len & 7) {
    case 7: h ^= (uint64_t)data[6] << 48;
    case 6: h ^= (uint64_t)data[5] << 40;
    case 5: h ^= (uint64_t)data[4] << 32;
    case 4: h ^= (uint64_t)data[3] << 24;
    case 3: h ^= (uint64_t)data[2] << 16;
    case 2: h ^= (uint64_t)data[1] << 8;
    case 1: h ^= (uint64_t)data[0];
            h *= m;
    };

    h ^= h >> r;
    h *= m;
    h ^= h >> r;
    return h;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movabsq $-0x395b586ca42e166b, %rax # imm = 0xC6A4A7935BD1E995
movq %rax, -0x18(%rbp)
movl $0x2f, -0x1c(%rbp)
movl -0x10(%rbp), %eax
movslq -0xc(%rbp), %rcx
movabsq $-0x395b586ca42e166b, %rdx # imm = 0xC6A4A7935BD1E995
imulq %rdx, %rcx
xorq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movl -0xc(%rbp), %ecx
movl -0xc(%rbp), %edx
andl $0x7, %edx
subl %edx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x38(%rbp), %rax
je 0x9dc28
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movabsq $-0x395b586ca42e166b, %rax # imm = 0xC6A4A7935BD1E995
imulq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
shrq $0x2f, %rax
xorq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movabsq $-0x395b586ca42e166b, %rax # imm = 0xC6A4A7935BD1E995
imulq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
xorq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movabsq $-0x395b586ca42e166b, %rax # imm = 0xC6A4A7935BD1E995
imulq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x30(%rbp)
jmp 0x9dbb0
movl -0xc(%rbp), %eax
andl $0x7, %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x48(%rbp)
subl $0x6, %eax
ja 0x9dced
movq -0x48(%rbp), %rax
leaq 0xa9aca(%rip), %rcx     # 0x147714
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x30(%rbp), %rax
movzbl 0x6(%rax), %eax
shlq $0x30, %rax
xorq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
movzbl 0x5(%rax), %eax
shlq $0x28, %rax
xorq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
movzbl 0x4(%rax), %eax
shlq $0x20, %rax
xorq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
movzbl 0x3(%rax), %eax
shlq $0x18, %rax
xorq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
movzbl 0x2(%rax), %eax
shlq $0x10, %rax
xorq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
movzbl 0x1(%rax), %eax
shlq $0x8, %rax
xorq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
xorq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movabsq $-0x395b586ca42e166b, %rax # imm = 0xC6A4A7935BD1E995
imulq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
shrq $0x2f, %rax
xorq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movabsq $-0x395b586ca42e166b, %rax # imm = 0xC6A4A7935BD1E995
imulq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
shrq $0x2f, %rax
xorq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
popq %rbp
retq
nopw %cs:(%rax,%rax)