// File: /workspace/github_cpp_makefile_star2_O3/BU-DiSC[P]BF-Shared-Hashing/hash/city.cc
// Function: CityHash128WithSeed(char const*, unsigned long, std::pair<unsigned long, unsigned long>)
uint128 CityHash128WithSeed(const char *s, size_t len, uint128 seed) {
  if (len < 128) {
    return CityMurmur(s, len, seed);
  }

  // We expect len >= 128 to be the common case.  Keep 56 bytes of state:
  // v, w, x, y, and z.
  pair<uint64, uint64> v, w;
  uint64 x = Uint128Low64(seed);
  uint64 y = Uint128High64(seed);
  uint64 z = len * k1;
  v.first = Rotate(y ^ k1, 49) * k1 + Fetch64(s);
  v.second = Rotate(v.first, 42) * k1 + Fetch64(s + 8);
  w.first = Rotate(y + z, 35) * k1 + x;
  w.second = Rotate(x + Fetch64(s + 88), 53) * k1;

  // This is the same inner loop as CityHash64(), manually unrolled.
  do {
    x = Rotate(x + y + v.first + Fetch64(s + 8), 37) * k1;
    y = Rotate(y + v.second + Fetch64(s + 48), 42) * k1;
    x ^= w.second;
    y += v.first + Fetch64(s + 40);
    z = Rotate(z + w.first, 33) * k1;
    v = WeakHashLen32WithSeeds(s, v.second * k1, x + w.first);
    w = WeakHashLen32WithSeeds(s + 32, z + w.second, y + Fetch64(s + 16));
    std::swap(z, x);
    s += 64;
    x = Rotate(x + y + v.first + Fetch64(s + 8), 37) * k1;
    y = Rotate(y + v.second + Fetch64(s + 48), 42) * k1;
    x ^= w.second;
    y += v.first + Fetch64(s + 40);
    z = Rotate(z + w.first, 33) * k1;
    v = WeakHashLen32WithSeeds(s, v.second * k1, x + w.first);
    w = WeakHashLen32WithSeeds(s + 32, z + w.second, y + Fetch64(s + 16));
    std::swap(z, x);
    s += 64;
    len -= 128;
  } while (LIKELY(len >= 128));
  x += Rotate(v.first + z, 49) * k0;
  y = y * k0 + Rotate(w.second, 37);
  z = z * k0 + Rotate(w.first, 27);
  w.first *= 9;
  v.first *= k0;
  // If 0 < len < 128, hash up to 4 chunks of 32 bytes each from the end of s.
  for (size_t tail_done = 0; tail_done < len; ) {
    tail_done += 32;
    y = Rotate(x + y, 42) * k0 + v.second;
    w.first += Fetch64(s + len - tail_done + 16);
    x = x * k0 + w.first;
    z += w.second + Fetch64(s + len - tail_done);
    w.second += v.first;
    v = WeakHashLen32WithSeeds(s + len - tail_done, v.first + z, v.second);
    v.first *= k0;
  }
  // At this point our 56 bytes of state should contain more than
  // enough information for a strong 128-bit hash.  We use two
  // different 56-byte-to-8-byte hashes to get a 16-byte final result.
  x = HashLen16(x, v.first);
  y = HashLen16(y + z, w.first);
  return uint128(HashLen16(x + v.second, w.second) + y,
                 HashLen16(x + w.second, y + v.second));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r15
movq %rsi, %r12
movq %rdi, %r14
movabsq $-0x4b6d499041670d8d, %r13 # imm = 0xB492B66FBE98F273
movabsq $-0x622015f714c7d297, %rbx # imm = 0x9DDFEA08EB382D69
cmpq $0x7f, %rsi
ja 0x282ba
cmpq $0x10, %r12
ja 0x2852a
imulq %r13, %rdx
movq %rdx, %rbp
shrq $0x2f, %rbp
xorq %rdx, %rbp
imulq %r13, %rbp
imulq %r15, %r13
movq %r14, %rdi
movq %r12, %rsi
callq 0x280dc
addq %r13, %rax
movq %rax, %rdx
cmpq $0x8, %r12
jb 0x282a8
movq (%r14), %rdx
addq %rbp, %rdx
movq %rdx, %rcx
shrq $0x2f, %rcx
xorq %rdx, %rcx
jmp 0x285e1
movq %r15, %rdi
xorq %r13, %rdi
rolq $0xf, %rdi
imulq %r13, %rdi
addq (%r14), %rdi
movq %r12, %r9
movq %rdi, %r8
rolq $0x16, %r8
imulq %r13, %r9
imulq %r13, %r8
addq 0x8(%r14), %r8
leaq (%r9,%r15), %rax
rolq $0x1d, %rax
imulq %r13, %rax
movq 0x58(%r14), %rsi
addq %rdx, %rsi
rolq $0xb, %rsi
addq %rdx, %rax
imulq %r13, %rsi
movq %r14, 0x10(%rsp)
leaq 0x78(%r14), %r10
movq %r12, 0x8(%rsp)
movq %r12, %rcx
addq %rdi, %rdx
addq %r15, %rdx
movq -0x70(%r10), %r14
movq -0x68(%r10), %rbx
addq %r14, %rdx
rolq $0x1b, %rdx
imulq %r13, %rdx
addq %r8, %r15
movq -0x48(%r10), %r11
addq %r11, %r15
rolq $0x16, %r15
imulq %r13, %r15
xorq %rsi, %rdx
movq -0x50(%r10), %r12
addq %r12, %rdi
addq %r15, %rdi
addq %rax, %r9
rolq $0x1f, %r9
imulq %r13, %r9
imulq %r13, %r8
addq -0x78(%r10), %r8
movq -0x60(%r10), %r15
addq %r8, %rax
addq %r15, %rax
addq %rdx, %rax
rolq $0x2b, %rax
addq %rbx, %r14
addq %r8, %r14
movq %r14, %rbp
rolq $0x14, %rbp
addq %r15, %r14
addq %r8, %rbp
addq %rax, %rbp
addq %r9, %rsi
addq %rdi, %rbx
movq -0x40(%r10), %rax
addq -0x58(%r10), %rsi
addq %rsi, %rbx
addq %rax, %rbx
rolq $0x2b, %rbx
addq %r11, %r12
addq %rsi, %r12
movq %r12, %r11
rolq $0x14, %r11
addq %rax, %r12
addq %rsi, %r11
addq %r14, %r9
movq -0x30(%r10), %r8
addq %r8, %r9
addq %rdi, %r9
rolq $0x1b, %r9
addq %rbx, %r11
imulq %r13, %r9
movq -0x8(%r10), %rsi
addq %rsi, %rdi
addq %rbp, %rdi
rolq $0x16, %rdi
imulq %r13, %rdi
xorq %r11, %r9
movq -0x10(%r10), %rax
addq %rax, %r14
movq %r14, %r15
addq %rdi, %r15
addq %r12, %rdx
rolq $0x1f, %rdx
imulq %r13, %rbp
addq %r9, %r12
movq -0x28(%r10), %rbx
movq -0x20(%r10), %r14
addq -0x38(%r10), %rbp
addq %r14, %r12
addq %rbp, %r12
rolq $0x2b, %r12
addq %rbx, %r8
addq %rbp, %r8
movq %r8, %rdi
rolq $0x14, %r8
imulq %r13, %rdx
addq %r14, %rdi
addq %rbp, %r8
addq %rdx, %r11
addq %r15, %rbx
movq (%r10), %r14
addq -0x18(%r10), %r11
addq %r14, %rbx
addq %r11, %rbx
rolq $0x2b, %rbx
addq %r12, %r8
addq %rsi, %rax
addq %r11, %rax
movq %rax, %rsi
rolq $0x14, %rsi
addq %r14, %rax
addq %r11, %rsi
addq %rbx, %rsi
addq $-0x80, %rcx
subq $-0x80, %r10
cmpq $0x7f, %rcx
ja 0x28310
movabsq $-0x3c5a37a36834ced9, %r13 # imm = 0xC3A5C85C97CB3127
leaq (%rdi,%r9), %r10
rolq $0xf, %r10
imulq %r13, %r10
addq %rdx, %r10
imulq %r13, %r15
movq %rsi, %r11
rolq $0x1b, %r11
addq %r15, %r11
leaq (%rax,%rax,8), %rdx
rolq $0x25, %rax
imulq %r13, %r9
addq %r9, %rax
imulq %r13, %rdi
testq %rcx, %rcx
je 0x28632
movq 0x10(%rsp), %r9
movq 0x8(%rsp), %rbx
addq %r9, %rbx
addq $-0x8, %rbx
xorl %r14d, %r14d
addq %r10, %r11
rolq $0x16, %r11
addq $0x20, %r14
imulq %r13, %r11
addq %r8, %r11
movq -0x18(%rbx), %r12
movq -0x8(%rbx), %r15
addq %r15, %rdx
imulq %r13, %r10
addq %rdx, %r10
addq %rsi, %rax
addq %r12, %rax
addq %rdi, %rsi
movq (%rbx), %rbp
addq %rdi, %r12
addq %rax, %r12
addq %rbp, %r8
addq %r12, %r8
rolq $0x2b, %r8
addq -0x10(%rbx), %r15
addq %r12, %r15
movq %r15, %r9
rolq $0x14, %r9
addq %rbp, %r15
addq %r12, %r9
addq %r8, %r9
imulq %r13, %r15
addq $-0x20, %rbx
movq %r15, %rdi
movq %r9, %r8
cmpq %rcx, %r14
jb 0x284bb
jmp 0x28638
movq -0x8(%r14,%r12), %rax
addq %r13, %rax
xorq %rdx, %rax
imulq %rbx, %rax
movq %rdx, %rcx
xorq %rax, %rcx
shrq $0x2f, %rax
xorq %rcx, %rax
imulq %rbx, %rax
movq %rax, %rsi
shrq $0x2f, %rsi
xorq %rax, %rsi
imulq %rbx, %rsi
leaq (%r15,%r12), %rax
movq -0x10(%r14,%r12), %rcx
addq %rsi, %rcx
xorq %rcx, %rax
imulq %rbx, %rax
xorq %rax, %rcx
shrq $0x2f, %rax
xorq %rcx, %rax
imulq %rbx, %rax
movq %rax, %rcx
shrq $0x2f, %rcx
xorq %rax, %rcx
imulq %rbx, %rcx
addq %rcx, %rdx
addq $0x10, %r12
movq (%r14), %rax
imulq %r13, %rax
movq %rax, %rbp
shrq $0x2f, %rbp
xorq %rax, %rbp
imulq %r13, %rbp
xorq %rdx, %rbp
imulq %r13, %rbp
xorq %rbp, %r15
movq 0x8(%r14), %rdx
imulq %r13, %rdx
movq %rdx, %rax
shrq $0x2f, %rax
xorq %rdx, %rax
imulq %r13, %rax
xorq %rsi, %rax
imulq %r13, %rax
xorq %rax, %rcx
addq $0x10, %r14
addq $-0x10, %r12
movq %rbp, %rdx
movq %rax, %rsi
cmpq $0x20, %r12
ja 0x2858e
xorq %rax, %rbp
imulq %rbx, %rbp
xorq %rbp, %rax
shrq $0x2f, %rbp
xorq %rax, %rbp
imulq %rbx, %rbp
movq %rbp, %rdx
shrq $0x2f, %rdx
xorq %rbp, %rdx
imulq %rbx, %rdx
xorq %r15, %rcx
imulq %rbx, %rcx
xorq %rcx, %r15
shrq $0x2f, %rcx
xorq %r15, %rcx
imulq %rbx, %rcx
movq %rcx, %rdi
shrq $0x2f, %rdi
xorq %rcx, %rdi
imulq %rbx, %rdi
xorq %rdx, %rdi
movq %rdi, %rax
jmp 0x286be
movq %r8, %r9
movq %rdi, %r15
addq %r11, %rax
xorq %r15, %r10
movabsq $-0x622015f714c7d297, %rbx # imm = 0x9DDFEA08EB382D69
imulq %rbx, %r10
xorq %r10, %r15
shrq $0x2f, %r10
xorq %r15, %r10
imulq %rbx, %r10
movq %r10, %rdi
shrq $0x2f, %rdi
xorq %r10, %rdi
imulq %rbx, %rdi
xorq %rdx, %rax
imulq %rbx, %rax
xorq %rax, %rdx
shrq $0x2f, %rax
xorq %rdx, %rax
imulq %rbx, %rax
movq %rax, %rdx
shrq $0x2f, %rdx
xorq %rax, %rdx
leaq (%rdi,%r9), %rcx
xorq %rsi, %rcx
imulq %rbx, %rcx
addq %rsi, %rdi
xorq %rcx, %rsi
shrq $0x2f, %rcx
xorq %rsi, %rcx
imulq %rbx, %rcx
movq %rcx, %rax
shrq $0x2f, %rax
xorq %rcx, %rax
addq %rdx, %rax
imulq %rbx, %rdx
imulq %rbx, %rax
addq %r9, %rdx
xorq %rdx, %rdi
imulq %rbx, %rdi
xorq %rdi, %rdx
shrq $0x2f, %rdi
xorq %rdx, %rdi
imulq %rbx, %rdi
movq %rdi, %rdx
shrq $0x2f, %rdx
xorq %rdi, %rdx
imulq %rbx, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq