// File: ikatanic[P]lcskpp/./utils.h
// Function: radix_sort(std::vector<unsigned long, std::allocator<unsigned long>>&, unsigned long)
void radix_sort(vector<uint64_t> &v, uint64_t maks) {
  const int max_len = 9;
  static int pos[(1 << max_len) + 1];

  vector<uint64_t> w(v.size());

  int n_bits = log2(maks);

  int shift = 0;
  while (n_bits > 0) {
    int len = min(max_len, n_bits);
    int sz = 1 << len;
    int mask = sz - 1;

    memset(pos, 0, sz * sizeof(int));

    for (auto &x : v)
      ++pos[((x >> shift) & mask) + 1];

    for (int i = 0; i < sz; ++i)
      pos[i + 1] += pos[i];

    for (auto &x : v)
      w[pos[(x >> shift) & mask]++] = x;
    shift += len;
    n_bits -= len;

    v.swap(w);
  }
}

// Assembly:
subq $0xc8, %rsp
movq %rdi, 0xc0(%rsp)
movq %rsi, 0xb8(%rsp)
movl $0x9, 0xb4(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x56f0
movq %rax, 0x18(%rsp)
leaq 0x97(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x5710
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
leaq 0x98(%rsp), %rdi
callq 0x5720
jmp 0x28af
leaq 0x97(%rsp), %rdi
callq 0x57a0
movq 0xb8(%rsp), %rdi
callq 0x2520
movl %eax, 0x14(%rsp)
jmp 0x28cf
movl 0x14(%rsp), %eax
movl %eax, 0x80(%rsp)
movl $0x0, 0x7c(%rsp)
cmpl $0x0, 0x80(%rsp)
jle 0x2b5e
leaq 0xb4(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x57b0
movq %rax, 0x8(%rsp)
jmp 0x290c
movq 0x8(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x78(%rsp)
movl 0x78(%rsp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x74(%rsp)
movl 0x74(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x70(%rsp)
movslq 0x74(%rsp), %rdx
shlq $0x2, %rdx
leaq 0x1005f(%rip), %rdi     # 0x129a0
xorl %esi, %esi
callq 0x20d0
movq 0xc0(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rdi
callq 0x57f0
movq %rax, 0x60(%rsp)
movq 0x68(%rsp), %rdi
callq 0x5820
movq %rax, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x5850
testb $0x1, %al
jne 0x298b
jmp 0x2a25
leaq 0x60(%rsp), %rdi
callq 0x5890
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
movq (%rax), %rax
movl 0x7c(%rsp), %ecx
shrq %cl, %rax
movq %rax, %rcx
movslq 0x70(%rsp), %rax
andq %rax, %rcx
leaq 0xffe5(%rip), %rax      # 0x129a0
movl 0x4(%rax,%rcx,4), %edx
addl $0x1, %edx
leaq 0xffd7(%rip), %rax      # 0x129a0
movl %edx, 0x4(%rax,%rcx,4)
leaq 0x60(%rsp), %rdi
callq 0x58a0
jmp 0x2973
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x97(%rsp), %rdi
callq 0x57a0
jmp 0x2b73
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x88(%rsp)
movl %eax, 0x84(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x5940
jmp 0x2b73
movl $0x0, 0x4c(%rsp)
movl 0x4c(%rsp), %eax
cmpl 0x74(%rsp), %eax
jge 0x2a71
movslq 0x4c(%rsp), %rcx
leaq 0xff5d(%rip), %rax      # 0x129a0
movl (%rax,%rcx,4), %edx
movl 0x4c(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0xff49(%rip), %rax      # 0x129a0
addl (%rax,%rcx,4), %edx
leaq 0xff3f(%rip), %rax      # 0x129a0
movl %edx, (%rax,%rcx,4)
movl 0x4c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4c(%rsp)
jmp 0x2a2d
movq 0xc0(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rdi
callq 0x57f0
movq %rax, 0x38(%rsp)
movq 0x40(%rsp), %rdi
callq 0x5820
movq %rax, 0x30(%rsp)
leaq 0x38(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x5850
testb $0x1, %al
jne 0x2ab1
jmp 0x2b24
leaq 0x38(%rsp), %rdi
callq 0x5890
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
movq (%rax), %rax
movq %rax, (%rsp)
movq 0x28(%rsp), %rax
movq (%rax), %rdx
movl 0x7c(%rsp), %eax
movl %eax, %ecx
shrq %cl, %rdx
movslq 0x70(%rsp), %rax
andq %rax, %rdx
leaq 0xfeb4(%rip), %rax      # 0x129a0
movl (%rax,%rdx,4), %eax
movl %eax, %esi
addl $0x1, %esi
leaq 0xfea5(%rip), %rcx      # 0x129a0
movl %esi, (%rcx,%rdx,4)
movslq %eax, %rsi
leaq 0x98(%rsp), %rdi
callq 0x58c0
movq (%rsp), %rcx
movq %rcx, (%rax)
leaq 0x38(%rsp), %rdi
callq 0x58a0
jmp 0x2a9c
movl 0x78(%rsp), %eax
addl 0x7c(%rsp), %eax
movl %eax, 0x7c(%rsp)
movl 0x78(%rsp), %ecx
movl 0x80(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x80(%rsp)
movq 0xc0(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x58e0
jmp 0x28e2
leaq 0x98(%rsp), %rdi
callq 0x5940
addq $0xc8, %rsp
retq
movq 0x88(%rsp), %rdi
callq 0x2260