// File: /workspace/github_cpp_makefile_star2_O2/ricbit[P]dlx/cover_shortcut.cc
// Function: ExactCover::build_nodes(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, std::vector<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, std::allocator<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>> const&)
vector<Node> build_nodes(
      const vector<string>& items,
      const vector<vector<string>>& options) {
    vector<Node> nodes(count_nodes(items, options));
    vector<int> last(items.size() + 1);
    unordered_map<string, int> name;
    for (int i = 1; i <= int(items.size()); i++) {
      nodes[i] = {0, i, i};
      last[i] = i;
      name[items[i - 1]] = i;
    }
    int current = items.size() + 1;
    nodes[current++] = { 0, 0, 0 };
    for (int i = 0; i < int(options.size()); i++) {
      for (int j = 0; j < int(options[i].size()); j++) {
        int item = name[options[i][j]];
        nodes[item].top++;
        nodes[last[item]].dlink = current;
        nodes[item].ulink = current;
        nodes[current].top = item;
        nodes[current].ulink = last[item];
        nodes[current].dlink = item;
        last[item] = current;
        current++;
      }
      nodes[current - 1].top *= -1;
    }
    return nodes;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
movq %rsi, %rdi
movq %rdx, %r15
movq %rdx, %rsi
movq %rcx, %rdx
movq %rcx, 0x10(%rsp)
callq 0x2c4e
movslq %eax, %rsi
leaq 0x40(%rsp), %rdx
movq %rbx, %rdi
movq %rbx, 0x8(%rsp)
callq 0x2c7c
movq 0x8(%r15), %rsi
subq (%r15), %rsi
sarq $0x5, %rsi
incq %rsi
leaq 0x28(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x2cd0
leaq 0x70(%rsp), %rax
vxorps %xmm0, %xmm0, %xmm0
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
vmovups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
vmovups %xmm0, -0x8(%rax)
pushq $0x1
popq %rbx
pushq $0x5
popq %r14
leaq 0x40(%rsp), %r12
xorl %r13d, %r13d
movq (%r15), %rsi
movq 0x8(%r15), %rax
subq %rsi, %rax
movq %rax, %rbp
shrq $0x5, %rbp
movslq %ebp, %rcx
cmpq %rcx, %rbx
jg 0x2858
movq 0x8(%rsp), %rax
addq %r13, %rsi
movq (%rax), %rax
andl $0x0, -0x8(%rax,%r14,4)
movl %ebx, -0x4(%rax,%r14,4)
movl %ebx, (%rax,%r14,4)
movq 0x28(%rsp), %rax
movl %ebx, (%rax,%rbx,4)
movq %r12, %rdi
callq 0x2f5c
movl %ebx, (%rax)
incq %rbx
addq $0x20, %r13
addq $0x3, %r14
jmp 0x2806
movq 0x8(%rsp), %rdx
movabsq $0x100000000, %rcx      # imm = 0x100000000
shlq $0x1b, %rax
addq $0x2, %rbp
xorl %esi, %esi
addq %rcx, %rax
sarq $0x20, %rax
imulq $0xc, %rax, %rax
movq (%rdx), %rcx
movq 0x10(%rsp), %rdx
andq $0x0, (%rcx,%rax)
andl $0x0, 0x8(%rcx,%rax)
movq (%rdx), %rdi
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
subq %rdi, %rax
cqto
pushq $0x18
popq %r8
idivq %r8
cltq
cmpq %rax, %rsi
jge 0x2983
movslq %ebp, %rax
imulq $0x18, %rsi, %r15
movq %rbp, %r13
shlq $0x20, %r13
movq %rsi, 0x20(%rsp)
xorl %r14d, %r14d
xorl %ebx, %ebx
imulq $0xc, %rax, %r12
movq %rax, 0x18(%rsp)
addq $0x8, %r12
movq (%rdi,%r15), %rsi
movq 0x8(%rdi,%r15), %rax
subq %rsi, %rax
shrq $0x5, %rax
cltq
cmpq %rax, %rbx
jge 0x2962
addq %r14, %rsi
leaq 0x40(%rsp), %rdi
callq 0x2f5c
movq 0x8(%rsp), %rcx
movslq (%rax), %rax
leal (%rbp,%rbx), %r8d
incq %rbx
addq $0x20, %r14
movq (%rcx), %rcx
imulq $0xc, %rax, %rdx
incl (%rcx,%rdx)
movq 0x28(%rsp), %rsi
movslq (%rsi,%rax,4), %rdi
imulq $0xc, %rdi, %rdi
movl %r8d, 0x8(%rcx,%rdi)
movl %r8d, 0x4(%rcx,%rdx)
movl %eax, -0x8(%rcx,%r12)
movl (%rsi,%rax,4), %edx
movl %edx, -0x4(%rcx,%r12)
movq 0x10(%rsp), %rdx
movl %eax, (%rcx,%r12)
movl %r8d, (%rsi,%rax,4)
movabsq $0x100000000, %rax      # imm = 0x100000000
addq $0xc, %r12
addq %rax, %r13
movq (%rdx), %rdi
jmp 0x28d6
sarq $0x20, %r13
movq 0x20(%rsp), %rsi
movq 0x18(%rsp), %rbp
imulq $0xc, %r13, %rax
negl -0xc(%rcx,%rax)
incq %rsi
addq %rbx, %rbp
jmp 0x2891
leaq 0x40(%rsp), %rdi
callq 0x341e
leaq 0x28(%rsp), %rdi
callq 0x2e84
movq 0x8(%rsp), %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x29c9
jmp 0x29b2
leaq 0x40(%rsp), %rdi
movq %rax, %r14
callq 0x341e
leaq 0x28(%rsp), %rdi
callq 0x2e84
movq 0x8(%rsp), %rdi
callq 0x2d56
movq %r14, %rdi
callq 0x21c0
nop