// File: 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
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x38(%rbp)
movl %esi, -0x3c(%rbp)
movl %edx, -0x40(%rbp)
movq %rcx, -0x48(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x3c(%rbp), %eax
movl $0x10, %ecx
cltd
idivl %ecx
movl %eax, -0x54(%rbp)
movl -0x40(%rbp), %eax
movq %rax, -0x60(%rbp)
movl -0x40(%rbp), %eax
movq %rax, -0x68(%rbp)
movabsq $-0x783c846eeebdac2b, %rax # imm = 0x87C37B91114253D5
movq %rax, -0x70(%rbp)
movabsq $0x4cf5ad432745937f, %rax # imm = 0x4CF5AD432745937F
movq %rax, -0x78(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x80(%rbp)
movl $0x0, -0x84(%rbp)
movl -0x84(%rbp), %eax
cmpl -0x54(%rbp), %eax
jge 0x794c
movq -0x80(%rbp), %rcx
movl -0x84(%rbp), %eax
shll %eax
addl $0x0, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x90(%rbp)
movq -0x80(%rbp), %rcx
movl -0x84(%rbp), %eax
shll %eax
addl $0x1, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x98(%rbp)
movabsq $-0x783c846eeebdac2b, %rax # imm = 0x87C37B91114253D5
imulq -0x90(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rdi
movl $0x1f, %esi
callq 0x7d80
movq %rax, -0x90(%rbp)
movabsq $0x4cf5ad432745937f, %rax # imm = 0x4CF5AD432745937F
imulq -0x90(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
xorq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movl $0x1b, %esi
callq 0x7d80
movq %rax, -0x60(%rbp)
movq -0x68(%rbp), %rax
addq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
imulq $0x5, -0x60(%rbp), %rax
addq $0x52dce729, %rax       # imm = 0x52DCE729
movq %rax, -0x60(%rbp)
movabsq $0x4cf5ad432745937f, %rax # imm = 0x4CF5AD432745937F
imulq -0x98(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rdi
movl $0x21, %esi
callq 0x7d80
movq %rax, -0x98(%rbp)
movabsq $-0x783c846eeebdac2b, %rax # imm = 0x87C37B91114253D5
imulq -0x98(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
xorq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
movl $0x1f, %esi
callq 0x7d80
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
addq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
imulq $0x5, -0x68(%rbp), %rax
addq $0x38495ab5, %rax       # imm = 0x38495AB5
movq %rax, -0x68(%rbp)
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x77cb
movq -0x50(%rbp), %rax
movl -0x54(%rbp), %ecx
shll $0x4, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq $0x0, -0xa8(%rbp)
movq $0x0, -0xb0(%rbp)
movl -0x3c(%rbp), %eax
andl $0xf, %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0xb8(%rbp)
subl $0xe, %eax
ja 0x7c0e
movq -0xb8(%rbp), %rax
leaq 0x3869f(%rip), %rcx     # 0x40040
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0xa0(%rbp), %rax
movzbl 0xe(%rax), %eax
shlq $0x30, %rax
xorq -0xb0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xa0(%rbp), %rax
movzbl 0xd(%rax), %eax
shlq $0x28, %rax
xorq -0xb0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xa0(%rbp), %rax
movzbl 0xc(%rax), %eax
shlq $0x20, %rax
xorq -0xb0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xa0(%rbp), %rax
movzbl 0xb(%rax), %eax
shlq $0x18, %rax
xorq -0xb0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xa0(%rbp), %rax
movzbl 0xa(%rax), %eax
shlq $0x10, %rax
xorq -0xb0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xa0(%rbp), %rax
movzbl 0x9(%rax), %eax
shlq $0x8, %rax
xorq -0xb0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xa0(%rbp), %rax
movzbl 0x8(%rax), %eax
shlq $0x0, %rax
xorq -0xb0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movabsq $0x4cf5ad432745937f, %rax # imm = 0x4CF5AD432745937F
imulq -0xb0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
movl $0x21, %esi
callq 0x7d80
movq %rax, -0xb0(%rbp)
movabsq $-0x783c846eeebdac2b, %rax # imm = 0x87C37B91114253D5
imulq -0xb0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
xorq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0xa0(%rbp), %rax
movzbl 0x7(%rax), %eax
shlq $0x38, %rax
xorq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa0(%rbp), %rax
movzbl 0x6(%rax), %eax
shlq $0x30, %rax
xorq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa0(%rbp), %rax
movzbl 0x5(%rax), %eax
shlq $0x28, %rax
xorq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa0(%rbp), %rax
movzbl 0x4(%rax), %eax
shlq $0x20, %rax
xorq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa0(%rbp), %rax
movzbl 0x3(%rax), %eax
shlq $0x18, %rax
xorq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa0(%rbp), %rax
movzbl 0x2(%rax), %eax
shlq $0x10, %rax
xorq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa0(%rbp), %rax
movzbl 0x1(%rax), %eax
shlq $0x8, %rax
xorq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa0(%rbp), %rax
movzbl (%rax), %eax
shlq $0x0, %rax
xorq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movabsq $-0x783c846eeebdac2b, %rax # imm = 0x87C37B91114253D5
imulq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
movl $0x1f, %esi
callq 0x7d80
movq %rax, -0xa8(%rbp)
movabsq $0x4cf5ad432745937f, %rax # imm = 0x4CF5AD432745937F
imulq -0xa8(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
xorq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movslq -0x3c(%rbp), %rax
xorq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movslq -0x3c(%rbp), %rax
xorq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
addq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
addq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
shrq $0x21, %rax
xorq -0x8(%rbp), %rax
movq %rax, -0x8(%rbp)
movabsq $-0xae502812aa7333, %rax # imm = 0xFF51AFD7ED558CCD
imulq -0x8(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
shrq $0x21, %rax
xorq -0x8(%rbp), %rax
movq %rax, -0x8(%rbp)
movabsq $-0x3b314601e57a13ad, %rax # imm = 0xC4CEB9FE1A85EC53
imulq -0x8(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
shrq $0x21, %rax
xorq -0x8(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
shrq $0x21, %rax
xorq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movabsq $-0xae502812aa7333, %rax # imm = 0xFF51AFD7ED558CCD
imulq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
shrq $0x21, %rax
xorq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movabsq $-0x3b314601e57a13ad, %rax # imm = 0xC4CEB9FE1A85EC53
imulq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
shrq $0x21, %rax
xorq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
addq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
addq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movq -0x68(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x8(%rax)
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)