// File: BU-DiSC[P]BF-Shared-Hashing/hash/city.cc
// Function: CityHash32(char const*, unsigned long)
uint32 CityHash32(const char *s, size_t len) {
  if (len <= 24) {
    return len <= 12 ?
        (len <= 4 ? Hash32Len0to4(s, len) : Hash32Len5to12(s, len)) :
        Hash32Len13to24(s, len);
  }

  // len > 24
  uint32 h = len, g = c1 * len, f = g;
  uint32 a0 = Rotate32(Fetch32(s + len - 4) * c1, 17) * c2;
  uint32 a1 = Rotate32(Fetch32(s + len - 8) * c1, 17) * c2;
  uint32 a2 = Rotate32(Fetch32(s + len - 16) * c1, 17) * c2;
  uint32 a3 = Rotate32(Fetch32(s + len - 12) * c1, 17) * c2;
  uint32 a4 = Rotate32(Fetch32(s + len - 20) * c1, 17) * c2;
  h ^= a0;
  h = Rotate32(h, 19);
  h = h * 5 + 0xe6546b64;
  h ^= a2;
  h = Rotate32(h, 19);
  h = h * 5 + 0xe6546b64;
  g ^= a1;
  g = Rotate32(g, 19);
  g = g * 5 + 0xe6546b64;
  g ^= a3;
  g = Rotate32(g, 19);
  g = g * 5 + 0xe6546b64;
  f += a4;
  f = Rotate32(f, 19);
  f = f * 5 + 0xe6546b64;
  size_t iters = (len - 1) / 20;
  do {
    uint32 a0 = Rotate32(Fetch32(s) * c1, 17) * c2;
    uint32 a1 = Fetch32(s + 4);
    uint32 a2 = Rotate32(Fetch32(s + 8) * c1, 17) * c2;
    uint32 a3 = Rotate32(Fetch32(s + 12) * c1, 17) * c2;
    uint32 a4 = Fetch32(s + 16);
    h ^= a0;
    h = Rotate32(h, 18);
    h = h * 5 + 0xe6546b64;
    f += a1;
    f = Rotate32(f, 19);
    f = f * c1;
    g += a2;
    g = Rotate32(g, 18);
    g = g * 5 + 0xe6546b64;
    h ^= a3 + a1;
    h = Rotate32(h, 19);
    h = h * 5 + 0xe6546b64;
    g ^= a4;
    g = bswap_32(g) * 5;
    h += a4 * 5;
    h = bswap_32(h);
    f += a0;
    PERMUTE3(f, h, g);
    s += 20;
  } while (--iters != 0);
  g = Rotate32(g, 11) * c1;
  g = Rotate32(g, 17) * c1;
  f = Rotate32(f, 11) * c1;
  f = Rotate32(f, 17) * c1;
  h = Rotate32(h + g, 19);
  h = h * 5 + 0xe6546b64;
  h = Rotate32(h, 17) * c1;
  h = Rotate32(h + f, 19);
  h = h * 5 + 0xe6546b64;
  h = Rotate32(h, 17) * c1;
  return h;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
cmpq $0x18, 0x50(%rsp)
ja 0x61248
cmpq $0xc, 0x50(%rsp)
ja 0x61228
cmpq $0x4, 0x50(%rsp)
ja 0x6120b
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x61700
movl %eax, 0x10(%rsp)
jmp 0x6121e
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x617a0
movl %eax, 0x10(%rsp)
movl 0x10(%rsp), %eax
movl %eax, 0xc(%rsp)
jmp 0x6123b
movq 0x58(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x61860
movl %eax, 0xc(%rsp)
movl 0xc(%rsp), %eax
movl %eax, 0x64(%rsp)
jmp 0x616f2
movq 0x50(%rsp), %rax
movl %eax, 0x4c(%rsp)
movabsq $0xcc9e2d51, %rax       # imm = 0xCC9E2D51
imulq 0x50(%rsp), %rax
movl %eax, 0x48(%rsp)
movl 0x48(%rsp), %eax
movl %eax, 0x44(%rsp)
movq 0x58(%rsp), %rdi
addq 0x50(%rsp), %rdi
addq $-0x4, %rdi
callq 0x619c0
imull $0xcc9e2d51, %eax, %edi # imm = 0xCC9E2D51
movl $0x11, %esi
callq 0x61980
imull $0x1b873593, %eax, %eax # imm = 0x1B873593
movl %eax, 0x40(%rsp)
movq 0x58(%rsp), %rdi
addq 0x50(%rsp), %rdi
addq $-0x8, %rdi
callq 0x619c0
imull $0xcc9e2d51, %eax, %edi # imm = 0xCC9E2D51
movl $0x11, %esi
callq 0x61980
imull $0x1b873593, %eax, %eax # imm = 0x1B873593
movl %eax, 0x3c(%rsp)
movq 0x58(%rsp), %rdi
addq 0x50(%rsp), %rdi
addq $-0x10, %rdi
callq 0x619c0
imull $0xcc9e2d51, %eax, %edi # imm = 0xCC9E2D51
movl $0x11, %esi
callq 0x61980
imull $0x1b873593, %eax, %eax # imm = 0x1B873593
movl %eax, 0x38(%rsp)
movq 0x58(%rsp), %rdi
addq 0x50(%rsp), %rdi
addq $-0xc, %rdi
callq 0x619c0
imull $0xcc9e2d51, %eax, %edi # imm = 0xCC9E2D51
movl $0x11, %esi
callq 0x61980
imull $0x1b873593, %eax, %eax # imm = 0x1B873593
movl %eax, 0x34(%rsp)
movq 0x58(%rsp), %rdi
addq 0x50(%rsp), %rdi
addq $-0x14, %rdi
callq 0x619c0
imull $0xcc9e2d51, %eax, %edi # imm = 0xCC9E2D51
movl $0x11, %esi
callq 0x61980
imull $0x1b873593, %eax, %eax # imm = 0x1B873593
movl %eax, 0x30(%rsp)
movl 0x40(%rsp), %eax
xorl 0x4c(%rsp), %eax
movl %eax, 0x4c(%rsp)
movl 0x4c(%rsp), %edi
movl $0x13, %esi
callq 0x61980
movl %eax, 0x4c(%rsp)
imull $0x5, 0x4c(%rsp), %eax
addl $0xe6546b64, %eax       # imm = 0xE6546B64
movl %eax, 0x4c(%rsp)
movl 0x38(%rsp), %eax
xorl 0x4c(%rsp), %eax
movl %eax, 0x4c(%rsp)
movl 0x4c(%rsp), %edi
movl $0x13, %esi
callq 0x61980
movl %eax, 0x4c(%rsp)
imull $0x5, 0x4c(%rsp), %eax
addl $0xe6546b64, %eax       # imm = 0xE6546B64
movl %eax, 0x4c(%rsp)
movl 0x3c(%rsp), %eax
xorl 0x48(%rsp), %eax
movl %eax, 0x48(%rsp)
movl 0x48(%rsp), %edi
movl $0x13, %esi
callq 0x61980
movl %eax, 0x48(%rsp)
imull $0x5, 0x48(%rsp), %eax
addl $0xe6546b64, %eax       # imm = 0xE6546B64
movl %eax, 0x48(%rsp)
movl 0x34(%rsp), %eax
xorl 0x48(%rsp), %eax
movl %eax, 0x48(%rsp)
movl 0x48(%rsp), %edi
movl $0x13, %esi
callq 0x61980
movl %eax, 0x48(%rsp)
imull $0x5, 0x48(%rsp), %eax
addl $0xe6546b64, %eax       # imm = 0xE6546B64
movl %eax, 0x48(%rsp)
movl 0x30(%rsp), %eax
addl 0x44(%rsp), %eax
movl %eax, 0x44(%rsp)
movl 0x44(%rsp), %edi
movl $0x13, %esi
callq 0x61980
movl %eax, 0x44(%rsp)
imull $0x5, 0x44(%rsp), %eax
addl $0xe6546b64, %eax       # imm = 0xE6546B64
movl %eax, 0x44(%rsp)
movq 0x50(%rsp), %rax
subq $0x1, %rax
movl $0x14, %ecx
xorl %edx, %edx
divq %rcx
movq %rax, 0x28(%rsp)
movq 0x58(%rsp), %rdi
callq 0x619c0
imull $0xcc9e2d51, %eax, %edi # imm = 0xCC9E2D51
movl $0x11, %esi
callq 0x61980
imull $0x1b873593, %eax, %eax # imm = 0x1B873593
movl %eax, 0x24(%rsp)
movq 0x58(%rsp), %rdi
addq $0x4, %rdi
callq 0x619c0
movl %eax, 0x20(%rsp)
movq 0x58(%rsp), %rdi
addq $0x8, %rdi
callq 0x619c0
imull $0xcc9e2d51, %eax, %edi # imm = 0xCC9E2D51
movl $0x11, %esi
callq 0x61980
imull $0x1b873593, %eax, %eax # imm = 0x1B873593
movl %eax, 0x1c(%rsp)
movq 0x58(%rsp), %rdi
addq $0xc, %rdi
callq 0x619c0
imull $0xcc9e2d51, %eax, %edi # imm = 0xCC9E2D51
movl $0x11, %esi
callq 0x61980
imull $0x1b873593, %eax, %eax # imm = 0x1B873593
movl %eax, 0x18(%rsp)
movq 0x58(%rsp), %rdi
addq $0x10, %rdi
callq 0x619c0
movl %eax, 0x14(%rsp)
movl 0x24(%rsp), %eax
xorl 0x4c(%rsp), %eax
movl %eax, 0x4c(%rsp)
movl 0x4c(%rsp), %edi
movl $0x12, %esi
callq 0x61980
movl %eax, 0x4c(%rsp)
imull $0x5, 0x4c(%rsp), %eax
addl $0xe6546b64, %eax       # imm = 0xE6546B64
movl %eax, 0x4c(%rsp)
movl 0x20(%rsp), %eax
addl 0x44(%rsp), %eax
movl %eax, 0x44(%rsp)
movl 0x44(%rsp), %edi
movl $0x13, %esi
callq 0x61980
movl %eax, 0x44(%rsp)
imull $0xcc9e2d51, 0x44(%rsp), %eax # imm = 0xCC9E2D51
movl %eax, 0x44(%rsp)
movl 0x1c(%rsp), %eax
addl 0x48(%rsp), %eax
movl %eax, 0x48(%rsp)
movl 0x48(%rsp), %edi
movl $0x12, %esi
callq 0x61980
movl %eax, 0x48(%rsp)
imull $0x5, 0x48(%rsp), %eax
addl $0xe6546b64, %eax       # imm = 0xE6546B64
movl %eax, 0x48(%rsp)
movl 0x18(%rsp), %eax
addl 0x20(%rsp), %eax
xorl 0x4c(%rsp), %eax
movl %eax, 0x4c(%rsp)
movl 0x4c(%rsp), %edi
movl $0x13, %esi
callq 0x61980
movl %eax, 0x4c(%rsp)
imull $0x5, 0x4c(%rsp), %eax
addl $0xe6546b64, %eax       # imm = 0xE6546B64
movl %eax, 0x4c(%rsp)
movl 0x14(%rsp), %eax
xorl 0x48(%rsp), %eax
movl %eax, 0x48(%rsp)
movl 0x48(%rsp), %edi
callq 0x619d0
imull $0x5, %eax, %eax
movl %eax, 0x48(%rsp)
imull $0x5, 0x14(%rsp), %eax
addl 0x4c(%rsp), %eax
movl %eax, 0x4c(%rsp)
movl 0x4c(%rsp), %edi
callq 0x619d0
movl %eax, 0x4c(%rsp)
movl 0x24(%rsp), %eax
addl 0x44(%rsp), %eax
movl %eax, 0x44(%rsp)
leaq 0x44(%rsp), %rdi
leaq 0x4c(%rsp), %rsi
callq 0x63750
leaq 0x44(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x63750
movq 0x58(%rsp), %rax
addq $0x14, %rax
movq %rax, 0x58(%rsp)
movq 0x28(%rsp), %rax
addq $-0x1, %rax
movq %rax, 0x28(%rsp)
cmpq $0x0, %rax
jne 0x61442
movl 0x48(%rsp), %edi
movl $0xb, %esi
callq 0x61980
imull $0xcc9e2d51, %eax, %eax # imm = 0xCC9E2D51
movl %eax, 0x48(%rsp)
movl 0x48(%rsp), %edi
movl $0x11, %esi
callq 0x61980
imull $0xcc9e2d51, %eax, %eax # imm = 0xCC9E2D51
movl %eax, 0x48(%rsp)
movl 0x44(%rsp), %edi
movl $0xb, %esi
callq 0x61980
imull $0xcc9e2d51, %eax, %eax # imm = 0xCC9E2D51
movl %eax, 0x44(%rsp)
movl 0x44(%rsp), %edi
movl $0x11, %esi
callq 0x61980
imull $0xcc9e2d51, %eax, %eax # imm = 0xCC9E2D51
movl %eax, 0x44(%rsp)
movl 0x4c(%rsp), %edi
addl 0x48(%rsp), %edi
movl $0x13, %esi
callq 0x61980
movl %eax, 0x4c(%rsp)
imull $0x5, 0x4c(%rsp), %eax
addl $0xe6546b64, %eax       # imm = 0xE6546B64
movl %eax, 0x4c(%rsp)
movl 0x4c(%rsp), %edi
movl $0x11, %esi
callq 0x61980
imull $0xcc9e2d51, %eax, %eax # imm = 0xCC9E2D51
movl %eax, 0x4c(%rsp)
movl 0x4c(%rsp), %edi
addl 0x44(%rsp), %edi
movl $0x13, %esi
callq 0x61980
movl %eax, 0x4c(%rsp)
imull $0x5, 0x4c(%rsp), %eax
addl $0xe6546b64, %eax       # imm = 0xE6546B64
movl %eax, 0x4c(%rsp)
movl 0x4c(%rsp), %edi
movl $0x11, %esi
callq 0x61980
imull $0xcc9e2d51, %eax, %eax # imm = 0xCC9E2D51
movl %eax, 0x4c(%rsp)
movl 0x4c(%rsp), %eax
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq
nopl (%rax,%rax)