// File: /workspace/github_cpp_makefile_star2_O1/prakhar2808[P]DBEngine/dbengine/MurmurHash3.cc
// Function: MurmurHash3_x64_128(void const*, int, unsigned int, void*)
void MurmurHash3_x64_128 ( const void * key, const int len,
                           const uint32_t seed, void * out )
{
  const uint8_t * data = (const uint8_t*)key;
  const int nblocks = len / 16;

  uint64_t h1 = seed;
  uint64_t h2 = seed;

  const uint64_t c1 = BIG_CONSTANT(0x87c37b91114253d5);
  const uint64_t c2 = BIG_CONSTANT(0x4cf5ad432745937f);

  //----------
  // body

  const uint64_t * blocks = (const uint64_t *)(data);

  for(int i = 0; i < nblocks; i++)
  {
    uint64_t k1 = getblock64(blocks,i*2+0);
    uint64_t k2 = getblock64(blocks,i*2+1);

    k1 *= c1; k1  = ROTL64(k1,31); k1 *= c2; h1 ^= k1;

    h1 = ROTL64(h1,27); h1 += h2; h1 = h1*5+0x52dce729;

    k2 *= c2; k2  = ROTL64(k2,33); k2 *= c1; h2 ^= k2;

    h2 = ROTL64(h2,31); h2 += h1; h2 = h2*5+0x38495ab5;
  }

  //----------
  // tail

  const uint8_t * tail = (const uint8_t*)(data + nblocks*16);

  uint64_t k1 = 0;
  uint64_t k2 = 0;

  switch(len & 15)
  {
  case 15: k2 ^= ((uint64_t)tail[14]) << 48;
  case 14: k2 ^= ((uint64_t)tail[13]) << 40;
  case 13: k2 ^= ((uint64_t)tail[12]) << 32;
  case 12: k2 ^= ((uint64_t)tail[11]) << 24;
  case 11: k2 ^= ((uint64_t)tail[10]) << 16;
  case 10: k2 ^= ((uint64_t)tail[ 9]) << 8;
  case  9: k2 ^= ((uint64_t)tail[ 8]) << 0;
           k2 *= c2; k2  = ROTL64(k2,33); k2 *= c1; h2 ^= k2;

  case  8: k1 ^= ((uint64_t)tail[ 7]) << 56;
  case  7: k1 ^= ((uint64_t)tail[ 6]) << 48;
  case  6: k1 ^= ((uint64_t)tail[ 5]) << 40;
  case  5: k1 ^= ((uint64_t)tail[ 4]) << 32;
  case  4: k1 ^= ((uint64_t)tail[ 3]) << 24;
  case  3: k1 ^= ((uint64_t)tail[ 2]) << 16;
  case  2: k1 ^= ((uint64_t)tail[ 1]) << 8;
  case  1: k1 ^= ((uint64_t)tail[ 0]) << 0;
           k1 *= c1; k1  = ROTL64(k1,31); k1 *= c2; h1 ^= k1;
  };

  //----------
  // finalization

  h1 ^= len; h2 ^= len;

  h1 += h2;
  h2 += h1;

  h1 = fmix64(h1);
  h2 = fmix64(h2);

  h1 += h2;
  h2 += h1;

  ((uint64_t*)out)[0] = h1;
  ((uint64_t*)out)[1] = h2;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movabsq $-0x775ed61580000000, %r9 # imm = 0x88A129EA80000000
movabsq $-0x783c846eeebdac2b, %r8 # imm = 0x87C37B91114253D5
leal 0xf(%rsi), %r11d
testl %esi, %esi
cmovnsl %esi, %r11d
movabsq $0x4cf5ad432745937f, %r10 # imm = 0x4CF5AD432745937F
sarl $0x4, %r11d
movl %edx, %edx
cmpl $0x10, %esi
jl 0x61ab
movabsq $0x4e8b26fe00000000, %rbx # imm = 0x4E8B26FE00000000
movl %r11d, %r14d
shlq $0x4, %r14
xorl %r15d, %r15d
movq %rdx, %rax
movq (%rdi,%r15), %r12
movq 0x8(%rdi,%r15), %r13
movq %r12, %rbp
imulq %r8, %rbp
imulq %r9, %r12
shrq $0x21, %rbp
orq %r12, %rbp
imulq %r10, %rbp
xorq %rdx, %rbp
rolq $0x1b, %rbp
addq %rax, %rbp
leaq (,%rbp,4), %r12
addq %rbp, %r12
leaq 0x52dce729(,%rbp,4), %rdx
addq %rbp, %rdx
movq %r13, %rbp
imulq %r10, %rbp
imulq %rbx, %r13
shrq $0x1f, %rbp
orq %r13, %rbp
imulq %r8, %rbp
xorq %rax, %rbp
rolq $0x1f, %rbp
leaq (%r12,%rbp), %rax
addq $0x52dce729, %rax       # imm = 0x52DCE729
leaq (%rax,%rax,4), %rax
addq $0x38495ab5, %rax       # imm = 0x38495AB5
addq $0x10, %r15
cmpq %r15, %r14
jne 0x6130
jmp 0x61ae
movq %rdx, %rax
movslq %r11d, %r11
shlq $0x4, %r11
movl %esi, %r14d
andl $0xf, %r14d
xorl %ebx, %ebx
leaq 0x14e8f(%rip), %r15     # 0x1b054
movslq (%r15,%r14,4), %r14
addq %r15, %r14
jmpq *%r14
movzbl 0xe(%rdi,%r11), %ebx
shlq $0x30, %rbx
movzbl 0xd(%rdi,%r11), %r14d
shlq $0x28, %r14
orq %r14, %rbx
movzbl 0xc(%rdi,%r11), %r14d
shlq $0x20, %r14
xorq %r14, %rbx
movzbl 0xb(%rdi,%r11), %r14d
shll $0x18, %r14d
xorq %r14, %rbx
movzbl 0xa(%rdi,%r11), %r14d
shll $0x10, %r14d
xorq %r14, %rbx
movzbl 0x9(%rdi,%r11), %r14d
shll $0x8, %r14d
xorq %r14, %rbx
movzbl 0x8(%rdi,%r11), %r14d
xorq %rbx, %r14
movabsq $0x4e8b26fe00000000, %rbx # imm = 0x4E8B26FE00000000
imulq %r14, %rbx
imulq %r10, %r14
shrq $0x1f, %r14
orq %rbx, %r14
imulq %r8, %r14
xorq %r14, %rax
movzbl 0x7(%rdi,%r11), %ebx
shlq $0x38, %rbx
movzbl 0x6(%rdi,%r11), %r14d
shlq $0x30, %r14
orq %r14, %rbx
movzbl 0x5(%rdi,%r11), %r14d
shlq $0x28, %r14
xorq %r14, %rbx
movzbl 0x4(%rdi,%r11), %r14d
shlq $0x20, %r14
xorq %r14, %rbx
movzbl 0x3(%rdi,%r11), %r14d
shll $0x18, %r14d
xorq %r14, %rbx
movzbl 0x2(%rdi,%r11), %r14d
shll $0x10, %r14d
xorq %r14, %rbx
movzbl 0x1(%rdi,%r11), %r14d
shll $0x8, %r14d
xorq %r14, %rbx
movzbl (%rdi,%r11), %edi
xorq %rbx, %rdi
imulq %rdi, %r8
imulq %r9, %rdi
shrq $0x21, %r8
orq %rdi, %r8
imulq %r10, %r8
xorq %r8, %rdx
movslq %esi, %rsi
xorq %rsi, %rdx
xorq %rsi, %rax
addq %rax, %rdx
addq %rdx, %rax
movq %rdx, %rsi
shrq $0x21, %rsi
xorq %rdx, %rsi
movabsq $-0xae502812aa7333, %rdx # imm = 0xFF51AFD7ED558CCD
imulq %rdx, %rsi
movq %rsi, %rdi
shrq $0x21, %rdi
xorq %rsi, %rdi
movabsq $-0x3b314601e57a13ad, %rsi # imm = 0xC4CEB9FE1A85EC53
imulq %rsi, %rdi
movq %rdi, %r8
shrq $0x21, %r8
xorq %rdi, %r8
movq %rax, %rdi
shrq $0x21, %rdi
xorq %rax, %rdi
imulq %rdx, %rdi
movq %rdi, %rax
shrq $0x21, %rax
xorq %rdi, %rax
imulq %rsi, %rax
movq %rax, %rdx
shrq $0x21, %rdx
xorq %rax, %rdx
addq %rdx, %r8
addq %r8, %rdx
movq %r8, (%rcx)
movq %rdx, 0x8(%rcx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq