// File: s-yata[P]louds-patricia/louds-patricia.cpp
// Function: louds::(anonymous namespace)::Trie::add(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void add(const std::string &key) {
    assert(n_keys == 0 || key > last_key);
    if (key.empty()) {
      levels[0].outs.set(0, 1);
      ++n_keys;
      return;
    }
    if (key.length() + 1 >= levels.size()) {
      levels.resize(key.length() + 2);
    }
    uint64_t i = 0;
    for ( ; i < key.length(); ++i) {
      uint8_t byte = key[i];
      if ((i == last_key.length()) ||
          (byte != levels[i + 1].labels.back())) {
        levels[i + 1].louds.set(levels[i + 1].louds.n_bits - 1, 0);
        levels[i + 1].louds.add(1);
        levels[i + 1].outs.add(0);
        levels[i + 1].labels.push_back(key[i]);
        ++n_nodes;
        break;
      }
    }
    for (++i; i < key.length(); ++i) {
      levels[i + 1].louds.add(0);
      levels[i + 1].louds.add(1);
      levels[i + 1].outs.add(0);
      levels[i + 1].labels.push_back(key[i]);
      ++n_nodes;
    }
    levels[i + 1].louds.add(1);
    levels[i].outs.set(levels[i].outs.n_bits - 1, 1);
    last_key = key;
    ++n_keys;
  }

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
movq 0x70(%rsp), %rcx
movq %rcx, 0x50(%rsp)
movb $0x1, %al
cmpq $0x0, 0x38(%rcx)
movb %al, 0x5c(%rsp)
je 0x340c
movq 0x50(%rsp), %rsi
movq 0x68(%rsp), %rdi
addq $0x18, %rsi
callq 0x9270
movb %al, 0x5c(%rsp)
movb 0x5c(%rsp), %al
testb $0x1, %al
jne 0x3416
jmp 0x3418
jmp 0x3437
leaq 0xac4a(%rip), %rdi      # 0xe069
leaq 0xac61(%rip), %rsi      # 0xe087
movl $0xc3, %edx
leaq 0xac68(%rip), %rcx      # 0xe09a
callq 0x2120
movq 0x68(%rsp), %rdi
callq 0x2220
testb $0x1, %al
jne 0x3447
jmp 0x3480
movq 0x50(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2840
movq %rax, %rdi
addq $0x50, %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0x3070
movq 0x50(%rsp), %rax
movq 0x38(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x38(%rax)
jmp 0x37d8
movq 0x68(%rsp), %rdi
callq 0x21e0
movq 0x50(%rsp), %rdi
addq $0x1, %rax
movq %rax, 0x48(%rsp)
callq 0x37e0
movq %rax, %rcx
movq 0x48(%rsp), %rax
cmpq %rcx, %rax
jb 0x34c5
movq 0x68(%rsp), %rdi
callq 0x21e0
movq 0x50(%rsp), %rdi
movq %rax, %rsi
addq $0x2, %rsi
callq 0x3800
movq $0x0, 0x60(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x68(%rsp), %rdi
callq 0x21e0
movq %rax, %rcx
movq 0x40(%rsp), %rax
cmpq %rcx, %rax
jae 0x3658
movq 0x68(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x21a0
movq 0x50(%rsp), %rdi
movb (%rax), %al
movb %al, 0x5f(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x38(%rsp)
addq $0x18, %rdi
callq 0x21e0
movq %rax, %rcx
movq 0x38(%rsp), %rax
cmpq %rcx, %rax
je 0x356a
movq 0x50(%rsp), %rdi
movzbl 0x5f(%rsp), %eax
movl %eax, 0x34(%rsp)
movq 0x60(%rsp), %rsi
addq $0x1, %rsi
callq 0x2840
movq %rax, %rdi
addq $0xa0, %rdi
callq 0x8720
movq %rax, %rcx
movl 0x34(%rsp), %eax
movzbl (%rcx), %ecx
cmpl %ecx, %eax
je 0x3643
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rsi
addq $0x1, %rsi
callq 0x2840
movq 0x50(%rsp), %rdi
movq %rax, 0x20(%rsp)
movq 0x60(%rsp), %rsi
addq $0x1, %rsi
callq 0x2840
movq 0x20(%rsp), %rdi
movq 0x48(%rax), %rsi
subq $0x1, %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x3070
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rsi
addq $0x1, %rsi
callq 0x2840
movq %rax, %rdi
movl $0x1, %esi
callq 0x2860
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rsi
addq $0x1, %rsi
callq 0x2840
movq %rax, %rdi
addq $0x50, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2860
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rsi
addq $0x1, %rsi
callq 0x2840
addq $0xa0, %rax
movq %rax, 0x28(%rsp)
movq 0x68(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x21a0
movq 0x28(%rsp), %rdi
movb (%rax), %al
movb %al, 0x5e(%rsp)
leaq 0x5e(%rsp), %rsi
callq 0x78a0
movq 0x50(%rsp), %rax
movq 0x40(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x40(%rax)
jmp 0x3658
jmp 0x3645
movq 0x60(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x60(%rsp)
jmp 0x34ce
movq 0x60(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x68(%rsp), %rdi
callq 0x21e0
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jae 0x3753
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rsi
addq $0x1, %rsi
callq 0x2840
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2860
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rsi
addq $0x1, %rsi
callq 0x2840
movq %rax, %rdi
movl $0x1, %esi
callq 0x2860
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rsi
addq $0x1, %rsi
callq 0x2840
movq %rax, %rdi
addq $0x50, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2860
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rsi
addq $0x1, %rsi
callq 0x2840
addq $0xa0, %rax
movq %rax, 0x10(%rsp)
movq 0x68(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x21a0
movq 0x10(%rsp), %rdi
movb (%rax), %al
movb %al, 0x5d(%rsp)
leaq 0x5d(%rsp), %rsi
callq 0x78a0
movq 0x50(%rsp), %rax
movq 0x40(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x40(%rax)
movq 0x60(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x60(%rsp)
jmp 0x3666
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rsi
addq $0x1, %rsi
callq 0x2840
movq %rax, %rdi
movl $0x1, %esi
callq 0x2860
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x2840
movq 0x50(%rsp), %rdi
addq $0x50, %rax
movq %rax, 0x8(%rsp)
movq 0x60(%rsp), %rsi
callq 0x2840
movq 0x8(%rsp), %rdi
movq 0x98(%rax), %rsi
subq $0x1, %rsi
movl $0x1, %edx
callq 0x3070
movq 0x50(%rsp), %rdi
movq 0x68(%rsp), %rsi
addq $0x18, %rdi
callq 0x2040
movq 0x50(%rsp), %rax
movq 0x38(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x38(%rax)
addq $0x78, %rsp
retq
nopl (%rax)