// File: neubig[P]egret/Egret/src/bob-hash.cpp
// Function: hashword(unsigned int const*, unsigned long, unsigned int)
uint32_t hashword(
const uint32_t *k,                   /* the key, an array of uint32_t values */
size_t          length,               /* the length of the key, in uint32_ts */
uint32_t        initval)         /* the previous hash, or an arbitrary value */
{
  uint32_t a,b,c;

  /* Set up the internal state */
  a = b = c = 0xdeadbeef + (((uint32_t)length)<<2) + initval;

  /*------------------------------------------------- handle most of the key */
  while (length > 3)
  {
    a += k[0];
    b += k[1];
    c += k[2];
    mix(a,b,c);
    length -= 3;
    k += 3;
  }

  /*------------------------------------------- handle the last 3 uint32_t's */
  switch(length)                     /* all the case statements fall through */
  { 
  case 3 : c+=k[2];
  case 2 : b+=k[1];
  case 1 : a+=k[0];
    final(a,b,c);
  case 0:     /* case 0: nothing left to add */
    break;
  }
  /*------------------------------------------------------ report the result */
  return c;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rax
shll $0x2, %eax
addl $0xdeadbeef, %eax       # imm = 0xDEADBEEF
addl -0x14(%rbp), %eax
movl %eax, -0x20(%rbp)
movl %eax, -0x1c(%rbp)
movl %eax, -0x18(%rbp)
cmpq $0x3, -0x10(%rbp)
jbe 0x3a665
movq -0x8(%rbp), %rax
movl (%rax), %eax
addl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %ecx
movl -0x18(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x18(%rbp)
movl -0x20(%rbp), %eax
shll $0x4, %eax
movl -0x20(%rbp), %ecx
shrl $0x1c, %ecx
orl %ecx, %eax
xorl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x1c(%rbp), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %ecx
movl -0x1c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x18(%rbp), %eax
shll $0x6, %eax
movl -0x18(%rbp), %ecx
shrl $0x1a, %ecx
orl %ecx, %eax
xorl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x20(%rbp), %eax
addl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x1c(%rbp), %ecx
movl -0x20(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
shll $0x8, %eax
movl -0x1c(%rbp), %ecx
shrl $0x18, %ecx
orl %ecx, %eax
xorl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x20(%rbp), %ecx
movl -0x18(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x18(%rbp)
movl -0x20(%rbp), %eax
shll $0x10, %eax
movl -0x20(%rbp), %ecx
shrl $0x10, %ecx
orl %ecx, %eax
xorl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x1c(%rbp), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %ecx
movl -0x1c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x18(%rbp), %eax
shll $0x13, %eax
movl -0x18(%rbp), %ecx
shrl $0xd, %ecx
orl %ecx, %eax
xorl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x20(%rbp), %eax
addl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x1c(%rbp), %ecx
movl -0x20(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
shll $0x4, %eax
movl -0x1c(%rbp), %ecx
shrl $0x1c, %ecx
orl %ecx, %eax
xorl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
subq $0x3, %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x8(%rbp)
jmp 0x3a527
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
subq $0x3, %rax
ja 0x3a78c
movq -0x28(%rbp), %rax
leaq 0x55b0e(%rip), %rcx     # 0x90190
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
addl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x1c(%rbp), %eax
xorl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %ecx
shll $0xe, %ecx
movl -0x1c(%rbp), %eax
shrl $0x12, %eax
orl %eax, %ecx
movl -0x20(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
xorl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x20(%rbp), %ecx
shll $0xb, %ecx
movl -0x20(%rbp), %eax
shrl $0x15, %eax
orl %eax, %ecx
movl -0x18(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
xorl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x18(%rbp), %ecx
shll $0x19, %ecx
movl -0x18(%rbp), %eax
shrl $0x7, %eax
orl %eax, %ecx
movl -0x1c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
xorl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %ecx
shll $0x10, %ecx
movl -0x1c(%rbp), %eax
shrl $0x10, %eax
orl %eax, %ecx
movl -0x20(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
xorl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x20(%rbp), %ecx
shll $0x4, %ecx
movl -0x20(%rbp), %eax
shrl $0x1c, %eax
orl %eax, %ecx
movl -0x18(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
xorl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x18(%rbp), %ecx
shll $0xe, %ecx
movl -0x18(%rbp), %eax
shrl $0x12, %eax
orl %eax, %ecx
movl -0x1c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
xorl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %ecx
shll $0x18, %ecx
movl -0x1c(%rbp), %eax
shrl $0x8, %eax
orl %eax, %ecx
movl -0x20(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
jmp 0x3a78c
movl -0x20(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)