// File: kdungs[P]codecon/src/compliance2.cc
// Function: uniquePalindromes(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
auto uniquePalindromes(std::string word) -> std::size_t {
  auto chars = std::multiset<char>{std::begin(word), std::end(word)};
  auto counts = std::vector<std::size_t>{};
  auto foundOdd = false;
  for (auto it = std::begin(chars); it != std::end(chars);
       it = chars.upper_bound(*it)) {
    auto count = chars.count(*it);
    if (count % 2 == 1) {
      if (foundOdd) {
        return 0;
      }
      foundOdd = true;
      count -= 1;  // aabbc <=> aabb because there is only one position for c
    }
    counts.emplace_back(count);  // extract unqiue counts
  }
  std::transform(std::begin(counts), std::end(counts), std::begin(counts),
                 [](std::size_t count) { return count / 2; });  // symmetry
  auto sum = std::accumulate(std::begin(counts), std::end(counts), 0u,
                             std::plus<std::size_t>());
  auto prodFactorials =
      std::accumulate(std::begin(counts), std::end(counts), 1u,
                      [](std::size_t acc, std::size_t count) {
                        return acc * factorial(count);
                      });
  return factorial(sum) / prodFactorials;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, -0x128(%rbp)
movq %rdi, -0x10(%rbp)
callq 0x1850
movq -0x128(%rbp), %rdi
movq %rax, -0x48(%rbp)
callq 0x1880
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq -0x40(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x18b0
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movq $0x0, -0x60(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x1930
movq -0x120(%rbp), %rdi
movb $0x0, -0x71(%rbp)
callq 0x1950
movq %rax, -0x118(%rbp)
jmp 0x1358
movq -0x118(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x19b0
movq %rax, -0x130(%rbp)
jmp 0x1375
movq -0x130(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x1980
testb $0x1, %al
jne 0x139c
jmp 0x1485
leaq -0x80(%rbp), %rdi
callq 0x1a10
movq %rax, %rsi
leaq -0x40(%rbp), %rdi
callq 0x19e0
movq %rax, -0x138(%rbp)
jmp 0x13ba
movq -0x138(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
andq $0x1, %rax
cmpq $0x1, %rax
jne 0x1435
testb $0x1, -0x71(%rbp)
je 0x141f
movq $0x0, -0x8(%rbp)
movl $0x1, -0xa4(%rbp)
jmp 0x1621
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x1c00
leaq -0x40(%rbp), %rdi
callq 0x1c60
jmp 0x1640
movb $0x1, -0x71(%rbp)
movq -0xa0(%rbp), %rax
subq $0x1, %rax
movq %rax, -0xa0(%rbp)
leaq -0x70(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x1a30
jmp 0x1447
jmp 0x1449
leaq -0x80(%rbp), %rdi
callq 0x1a10
movq %rax, %rsi
leaq -0x40(%rbp), %rdi
callq 0x1ab0
movq %rax, -0x140(%rbp)
jmp 0x1467
movq -0x140(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x80(%rbp)
jmp 0x1363
leaq -0x70(%rbp), %rdi
callq 0x1af0
movq %rax, -0x148(%rbp)
jmp 0x1497
movq -0x148(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x1b20
movq %rax, -0x150(%rbp)
jmp 0x14b7
movq -0x150(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x1af0
movq %rax, -0x158(%rbp)
jmp 0x14d7
movq -0x158(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0xb8(%rbp), %rdi
movq -0xc0(%rbp), %rsi
movq -0xc8(%rbp), %rdx
callq 0x1650
movq %rax, -0x160(%rbp)
jmp 0x1508
movq -0x160(%rbp), %rax
movq %rax, -0xd8(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x1af0
movq %rax, -0x168(%rbp)
jmp 0x1528
movq -0x168(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x1b20
movq %rax, -0x170(%rbp)
jmp 0x1548
movq -0x170(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xe8(%rbp), %rdi
movq -0xf0(%rbp), %rsi
xorl %edx, %edx
callq 0x1b50
movl %eax, -0x174(%rbp)
jmp 0x1573
movl -0x174(%rbp), %eax
movl %eax, -0xdc(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x1af0
movq %rax, -0x180(%rbp)
jmp 0x1591
movq -0x180(%rbp), %rax
movq %rax, -0x100(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x1b20
movq %rax, -0x188(%rbp)
jmp 0x15b1
movq -0x188(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x100(%rbp), %rdi
movq -0x108(%rbp), %rsi
movl $0x1, %edx
callq 0x16d0
movl %eax, -0x18c(%rbp)
jmp 0x15df
movl -0x18c(%rbp), %eax
movl %eax, -0xf8(%rbp)
movl -0xdc(%rbp), %eax
movl %eax, %edi
callq 0x1bb0
movq %rax, -0x198(%rbp)
jmp 0x1601
movq -0x198(%rbp), %rax
movl -0xf8(%rbp), %ecx
xorl %edx, %edx
divq %rcx
movq %rax, -0x8(%rbp)
movl $0x1, -0xa4(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x1c00
leaq -0x40(%rbp), %rdi
callq 0x1c60
movq -0x8(%rbp), %rax
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
movq -0x88(%rbp), %rdi
callq 0x1190
nopl (%rax)