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

  uint32_t h1 = seed;
  uint32_t h2 = seed;
  uint32_t h3 = seed;
  uint32_t h4 = seed;

  const uint32_t c1 = 0x239b961b; 
  const uint32_t c2 = 0xab0e9789;
  const uint32_t c3 = 0x38b34ae5; 
  const uint32_t c4 = 0xa1e38b93;

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

  const uint32_t * blocks = (const uint32_t *)(data + nblocks*16);

  for(int i = -nblocks; i; i++)
  {
    uint32_t k1 = getblock32(blocks,i*4+0);
    uint32_t k2 = getblock32(blocks,i*4+1);
    uint32_t k3 = getblock32(blocks,i*4+2);
    uint32_t k4 = getblock32(blocks,i*4+3);

    k1 *= c1; k1  = ROTL32(k1,15); k1 *= c2; h1 ^= k1;

    h1 = ROTL32(h1,19); h1 += h2; h1 = h1*5+0x561ccd1b;

    k2 *= c2; k2  = ROTL32(k2,16); k2 *= c3; h2 ^= k2;

    h2 = ROTL32(h2,17); h2 += h3; h2 = h2*5+0x0bcaa747;

    k3 *= c3; k3  = ROTL32(k3,17); k3 *= c4; h3 ^= k3;

    h3 = ROTL32(h3,15); h3 += h4; h3 = h3*5+0x96cd1c35;

    k4 *= c4; k4  = ROTL32(k4,18); k4 *= c1; h4 ^= k4;

    h4 = ROTL32(h4,13); h4 += h1; h4 = h4*5+0x32ac3b17;
  }

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

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

  uint32_t k1 = 0;
  uint32_t k2 = 0;
  uint32_t k3 = 0;
  uint32_t k4 = 0;

  switch(len & 15)
  {
  case 15: k4 ^= tail[14] << 16;
  case 14: k4 ^= tail[13] << 8;
  case 13: k4 ^= tail[12] << 0;
           k4 *= c4; k4  = ROTL32(k4,18); k4 *= c1; h4 ^= k4;

  case 12: k3 ^= tail[11] << 24;
  case 11: k3 ^= tail[10] << 16;
  case 10: k3 ^= tail[ 9] << 8;
  case  9: k3 ^= tail[ 8] << 0;
           k3 *= c3; k3  = ROTL32(k3,17); k3 *= c4; h3 ^= k3;

  case  8: k2 ^= tail[ 7] << 24;
  case  7: k2 ^= tail[ 6] << 16;
  case  6: k2 ^= tail[ 5] << 8;
  case  5: k2 ^= tail[ 4] << 0;
           k2 *= c2; k2  = ROTL32(k2,16); k2 *= c3; h2 ^= k2;

  case  4: k1 ^= tail[ 3] << 24;
  case  3: k1 ^= tail[ 2] << 16;
  case  2: k1 ^= tail[ 1] << 8;
  case  1: k1 ^= tail[ 0] << 0;
           k1 *= c1; k1  = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
  };

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

  h1 ^= len; h2 ^= len; h3 ^= len; h4 ^= len;

  h1 += h2; h1 += h3; h1 += h4;
  h2 += h1; h3 += h1; h4 += h1;

  h1 = fmix32(h1);
  h2 = fmix32(h2);
  h3 = fmix32(h3);
  h4 = fmix32(h4);

  h1 += h2; h1 += h3; h1 += h4;
  h2 += h1; h3 += h1; h4 += h1;

  ((uint32_t*)out)[0] = h1;
  ((uint32_t*)out)[1] = h2;
  ((uint32_t*)out)[2] = h3;
  ((uint32_t*)out)[3] = h4;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x58(%rbp)
movl %esi, -0x5c(%rbp)
movl %edx, -0x60(%rbp)
movq %rcx, -0x68(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x70(%rbp)
movl -0x5c(%rbp), %eax
movl $0x10, %ecx
cltd
idivl %ecx
movl %eax, -0x74(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x84(%rbp)
movl $0x239b961b, -0x88(%rbp) # imm = 0x239B961B
movl $0xab0e9789, -0x8c(%rbp) # imm = 0xAB0E9789
movl $0x38b34ae5, -0x90(%rbp) # imm = 0x38B34AE5
movl $0xa1e38b93, -0x94(%rbp) # imm = 0xA1E38B93
movq -0x70(%rbp), %rax
movl -0x74(%rbp), %ecx
shll $0x4, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
xorl %eax, %eax
subl -0x74(%rbp), %eax
movl %eax, -0xa4(%rbp)
cmpl $0x0, -0xa4(%rbp)
je 0x7268
movq -0xa0(%rbp), %rcx
movl -0xa4(%rbp), %eax
shll $0x2, %eax
addl $0x0, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0xa8(%rbp)
movq -0xa0(%rbp), %rcx
movl -0xa4(%rbp), %eax
shll $0x2, %eax
addl $0x1, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0xac(%rbp)
movq -0xa0(%rbp), %rcx
movl -0xa4(%rbp), %eax
shll $0x2, %eax
addl $0x2, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0xb0(%rbp)
movq -0xa0(%rbp), %rcx
movl -0xa4(%rbp), %eax
shll $0x2, %eax
addl $0x3, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movq -0x48(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0xb4(%rbp)
imull $0x239b961b, -0xa8(%rbp), %eax # imm = 0x239B961B
movl %eax, -0xa8(%rbp)
movl -0xa8(%rbp), %edi
movl $0xf, %esi
callq 0x7d50
movl %eax, -0xa8(%rbp)
imull $0xab0e9789, -0xa8(%rbp), %eax # imm = 0xAB0E9789
movl %eax, -0xa8(%rbp)
movl -0xa8(%rbp), %eax
xorl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %edi
movl $0x13, %esi
callq 0x7d50
movl %eax, -0x78(%rbp)
movl -0x7c(%rbp), %eax
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
imull $0x5, -0x78(%rbp), %eax
addl $0x561ccd1b, %eax       # imm = 0x561CCD1B
movl %eax, -0x78(%rbp)
imull $0xab0e9789, -0xac(%rbp), %eax # imm = 0xAB0E9789
movl %eax, -0xac(%rbp)
movl -0xac(%rbp), %edi
movl $0x10, %esi
callq 0x7d50
movl %eax, -0xac(%rbp)
imull $0x38b34ae5, -0xac(%rbp), %eax # imm = 0x38B34AE5
movl %eax, -0xac(%rbp)
movl -0xac(%rbp), %eax
xorl -0x7c(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %edi
movl $0x11, %esi
callq 0x7d50
movl %eax, -0x7c(%rbp)
movl -0x80(%rbp), %eax
addl -0x7c(%rbp), %eax
movl %eax, -0x7c(%rbp)
imull $0x5, -0x7c(%rbp), %eax
addl $0xbcaa747, %eax        # imm = 0xBCAA747
movl %eax, -0x7c(%rbp)
imull $0x38b34ae5, -0xb0(%rbp), %eax # imm = 0x38B34AE5
movl %eax, -0xb0(%rbp)
movl -0xb0(%rbp), %edi
movl $0x11, %esi
callq 0x7d50
movl %eax, -0xb0(%rbp)
imull $0xa1e38b93, -0xb0(%rbp), %eax # imm = 0xA1E38B93
movl %eax, -0xb0(%rbp)
movl -0xb0(%rbp), %eax
xorl -0x80(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x80(%rbp), %edi
movl $0xf, %esi
callq 0x7d50
movl %eax, -0x80(%rbp)
movl -0x84(%rbp), %eax
addl -0x80(%rbp), %eax
movl %eax, -0x80(%rbp)
imull $0x5, -0x80(%rbp), %eax
addl $0x96cd1c35, %eax       # imm = 0x96CD1C35
movl %eax, -0x80(%rbp)
imull $0xa1e38b93, -0xb4(%rbp), %eax # imm = 0xA1E38B93
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %edi
movl $0x12, %esi
callq 0x7d50
movl %eax, -0xb4(%rbp)
imull $0x239b961b, -0xb4(%rbp), %eax # imm = 0x239B961B
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
xorl -0x84(%rbp), %eax
movl %eax, -0x84(%rbp)
movl -0x84(%rbp), %edi
movl $0xd, %esi
callq 0x7d50
movl %eax, -0x84(%rbp)
movl -0x78(%rbp), %eax
addl -0x84(%rbp), %eax
movl %eax, -0x84(%rbp)
imull $0x5, -0x84(%rbp), %eax
addl $0x32ac3b17, %eax       # imm = 0x32AC3B17
movl %eax, -0x84(%rbp)
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x6fe4
movq -0x70(%rbp), %rax
movl -0x74(%rbp), %ecx
shll $0x4, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
movl $0x0, -0xc4(%rbp)
movl $0x0, -0xc8(%rbp)
movl $0x0, -0xcc(%rbp)
movl $0x0, -0xd0(%rbp)
movl -0x5c(%rbp), %eax
andl $0xf, %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0xd8(%rbp)
subl $0xe, %eax
ja 0x756b
movq -0xd8(%rbp), %rax
leaq 0x38d35(%rip), %rcx     # 0x40004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0xc0(%rbp), %rax
movzbl 0xe(%rax), %eax
shll $0x10, %eax
xorl -0xd0(%rbp), %eax
movl %eax, -0xd0(%rbp)
movq -0xc0(%rbp), %rax
movzbl 0xd(%rax), %eax
shll $0x8, %eax
xorl -0xd0(%rbp), %eax
movl %eax, -0xd0(%rbp)
movq -0xc0(%rbp), %rax
movzbl 0xc(%rax), %eax
shll $0x0, %eax
xorl -0xd0(%rbp), %eax
movl %eax, -0xd0(%rbp)
imull $0xa1e38b93, -0xd0(%rbp), %eax # imm = 0xA1E38B93
movl %eax, -0xd0(%rbp)
movl -0xd0(%rbp), %edi
movl $0x12, %esi
callq 0x7d50
movl %eax, -0xd0(%rbp)
imull $0x239b961b, -0xd0(%rbp), %eax # imm = 0x239B961B
movl %eax, -0xd0(%rbp)
movl -0xd0(%rbp), %eax
xorl -0x84(%rbp), %eax
movl %eax, -0x84(%rbp)
movq -0xc0(%rbp), %rax
movzbl 0xb(%rax), %eax
shll $0x18, %eax
xorl -0xcc(%rbp), %eax
movl %eax, -0xcc(%rbp)
movq -0xc0(%rbp), %rax
movzbl 0xa(%rax), %eax
shll $0x10, %eax
xorl -0xcc(%rbp), %eax
movl %eax, -0xcc(%rbp)
movq -0xc0(%rbp), %rax
movzbl 0x9(%rax), %eax
shll $0x8, %eax
xorl -0xcc(%rbp), %eax
movl %eax, -0xcc(%rbp)
movq -0xc0(%rbp), %rax
movzbl 0x8(%rax), %eax
shll $0x0, %eax
xorl -0xcc(%rbp), %eax
movl %eax, -0xcc(%rbp)
imull $0x38b34ae5, -0xcc(%rbp), %eax # imm = 0x38B34AE5
movl %eax, -0xcc(%rbp)
movl -0xcc(%rbp), %edi
movl $0x11, %esi
callq 0x7d50
movl %eax, -0xcc(%rbp)
imull $0xa1e38b93, -0xcc(%rbp), %eax # imm = 0xA1E38B93
movl %eax, -0xcc(%rbp)
movl -0xcc(%rbp), %eax
xorl -0x80(%rbp), %eax
movl %eax, -0x80(%rbp)
movq -0xc0(%rbp), %rax
movzbl 0x7(%rax), %eax
shll $0x18, %eax
xorl -0xc8(%rbp), %eax
movl %eax, -0xc8(%rbp)
movq -0xc0(%rbp), %rax
movzbl 0x6(%rax), %eax
shll $0x10, %eax
xorl -0xc8(%rbp), %eax
movl %eax, -0xc8(%rbp)
movq -0xc0(%rbp), %rax
movzbl 0x5(%rax), %eax
shll $0x8, %eax
xorl -0xc8(%rbp), %eax
movl %eax, -0xc8(%rbp)
movq -0xc0(%rbp), %rax
movzbl 0x4(%rax), %eax
shll $0x0, %eax
xorl -0xc8(%rbp), %eax
movl %eax, -0xc8(%rbp)
imull $0xab0e9789, -0xc8(%rbp), %eax # imm = 0xAB0E9789
movl %eax, -0xc8(%rbp)
movl -0xc8(%rbp), %edi
movl $0x10, %esi
callq 0x7d50
movl %eax, -0xc8(%rbp)
imull $0x38b34ae5, -0xc8(%rbp), %eax # imm = 0x38B34AE5
movl %eax, -0xc8(%rbp)
movl -0xc8(%rbp), %eax
xorl -0x7c(%rbp), %eax
movl %eax, -0x7c(%rbp)
movq -0xc0(%rbp), %rax
movzbl 0x3(%rax), %eax
shll $0x18, %eax
xorl -0xc4(%rbp), %eax
movl %eax, -0xc4(%rbp)
movq -0xc0(%rbp), %rax
movzbl 0x2(%rax), %eax
shll $0x10, %eax
xorl -0xc4(%rbp), %eax
movl %eax, -0xc4(%rbp)
movq -0xc0(%rbp), %rax
movzbl 0x1(%rax), %eax
shll $0x8, %eax
xorl -0xc4(%rbp), %eax
movl %eax, -0xc4(%rbp)
movq -0xc0(%rbp), %rax
movzbl (%rax), %eax
shll $0x0, %eax
xorl -0xc4(%rbp), %eax
movl %eax, -0xc4(%rbp)
imull $0x239b961b, -0xc4(%rbp), %eax # imm = 0x239B961B
movl %eax, -0xc4(%rbp)
movl -0xc4(%rbp), %edi
movl $0xf, %esi
callq 0x7d50
movl %eax, -0xc4(%rbp)
imull $0xab0e9789, -0xc4(%rbp), %eax # imm = 0xAB0E9789
movl %eax, -0xc4(%rbp)
movl -0xc4(%rbp), %eax
xorl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x5c(%rbp), %eax
xorl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x5c(%rbp), %eax
xorl -0x7c(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x5c(%rbp), %eax
xorl -0x80(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x5c(%rbp), %eax
xorl -0x84(%rbp), %eax
movl %eax, -0x84(%rbp)
movl -0x7c(%rbp), %eax
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x80(%rbp), %eax
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x84(%rbp), %eax
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %eax
addl -0x7c(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x78(%rbp), %eax
addl -0x80(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x78(%rbp), %eax
addl -0x84(%rbp), %eax
movl %eax, -0x84(%rbp)
movl -0x78(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
shrl $0x10, %eax
xorl -0x4(%rbp), %eax
movl %eax, -0x4(%rbp)
imull $0x85ebca6b, -0x4(%rbp), %eax # imm = 0x85EBCA6B
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
shrl $0xd, %eax
xorl -0x4(%rbp), %eax
movl %eax, -0x4(%rbp)
imull $0xc2b2ae35, -0x4(%rbp), %eax # imm = 0xC2B2AE35
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
shrl $0x10, %eax
xorl -0x4(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
shrl $0x10, %eax
xorl -0x8(%rbp), %eax
movl %eax, -0x8(%rbp)
imull $0x85ebca6b, -0x8(%rbp), %eax # imm = 0x85EBCA6B
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
shrl $0xd, %eax
xorl -0x8(%rbp), %eax
movl %eax, -0x8(%rbp)
imull $0xc2b2ae35, -0x8(%rbp), %eax # imm = 0xC2B2AE35
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
shrl $0x10, %eax
xorl -0x8(%rbp), %eax
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x80(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
shrl $0x10, %eax
xorl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
imull $0x85ebca6b, -0xc(%rbp), %eax # imm = 0x85EBCA6B
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
shrl $0xd, %eax
xorl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
imull $0xc2b2ae35, -0xc(%rbp), %eax # imm = 0xC2B2AE35
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
shrl $0x10, %eax
xorl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x84(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
shrl $0x10, %eax
xorl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
imull $0x85ebca6b, -0x10(%rbp), %eax # imm = 0x85EBCA6B
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
shrl $0xd, %eax
xorl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
imull $0xc2b2ae35, -0x10(%rbp), %eax # imm = 0xC2B2AE35
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
shrl $0x10, %eax
xorl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x84(%rbp)
movl -0x7c(%rbp), %eax
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x80(%rbp), %eax
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x84(%rbp), %eax
addl -0x78(%rbp), %eax
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %eax
addl -0x7c(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x78(%rbp), %eax
addl -0x80(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x78(%rbp), %eax
addl -0x84(%rbp), %eax
movl %eax, -0x84(%rbp)
movl -0x78(%rbp), %ecx
movq -0x68(%rbp), %rax
movl %ecx, (%rax)
movl -0x7c(%rbp), %ecx
movq -0x68(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x80(%rbp), %ecx
movq -0x68(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x84(%rbp), %ecx
movq -0x68(%rbp), %rax
movl %ecx, 0xc(%rax)
addq $0xe0, %rsp
popq %rbp
retq
nopl (%rax)