// File: /workspace/github_cpp_makefile_star2_O3/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 $0x68, %rsp
movq 0x8(%rdx), %rsi
movq %rdx, %r15
movq (%rcx), %rax
movq %rdi, %rbp
movq %rcx, (%rsp)
subq (%rdx), %rsi
movq 0x8(%rcx), %rdx
shrq $0x5, %rsi
addl $0x2, %esi
cmpq %rdx, %rax
je 0x2b7b
subq %rax, %rdx
vpmovsxbq 0x269d(%rip), %zmm1 # 0x5160
vpmovzxbd 0x269c(%rip), %ymm3 # 0x5168
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
vmovd %esi, %xmm4
addq $-0x18, %rdx
mulxq %rcx, %rcx, %rcx
xorl %edx, %edx
vpbroadcastq %rcx, %zmm0
shrq $0x4, %rcx
addq $0x8, %rcx
vpsrlq $0x4, %zmm0, %zmm0
andq $-0x8, %rcx
vpbroadcastq %rdx, %zmm6
vmovdqa %ymm4, %ymm2
vpxor %xmm5, %xmm5, %xmm5
addq $0x8, %rdx
vporq %zmm1, %zmm6, %zmm4
vpcmpleuq %zmm0, %zmm4, %k1
vpxor %xmm4, %xmm4, %xmm4
kmovq %k1, %k2
vpgatherdq 0x8(%rax,%ymm3), %zmm4 {%k2}
kmovq %k1, %k2
vpgatherdq (%rax,%ymm3), %zmm5 {%k2}
addq $0xc0, %rax
vpsubq %zmm5, %zmm4, %zmm4
vpsrlq $0x5, %zmm4, %zmm4
vpmovqd %zmm4, %ymm4
vpaddd %ymm4, %ymm2, %ymm4
cmpq %rdx, %rcx
jne 0x2afe
vmovdqa32 %ymm4, %ymm2 {%k1}
vextracti128 $0x1, %ymm2, %xmm0
vphaddd %xmm2, %xmm0, %xmm0
vphaddd %xmm0, %xmm0, %xmm0
vphaddd %xmm0, %xmm0, %xmm0
vmovd %xmm0, %esi
movslq %esi, %rsi
leaq 0x30(%rsp), %rdx
movq %rbp, %rdi
vzeroupper
callq 0x315c
movq 0x8(%r15), %rsi
subq (%r15), %rsi
sarq $0x5, %rsi
incq %rsi
leaq 0x8(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x3222
leaq 0x60(%rsp), %rax
vpxor %xmm0, %xmm0, %xmm0
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
vmovdqu %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
vmovdqu %xmm0, -0x8(%rax)
movq (%r15), %rsi
movq 0x8(%r15), %rax
subq %rsi, %rax
movq %rax, %r8
shrq $0x5, %r8
testl %r8d, %r8d
jle 0x2c4e
movl $0x1, %r13d
movl $0x5, %ebx
leaq 0x30(%rsp), %r12
xorl %r14d, %r14d
movq (%rbp), %rax
addq %r14, %rsi
movl $0x0, -0x8(%rax,%rbx,4)
movl %r13d, -0x4(%rax,%rbx,4)
movl %r13d, (%rax,%rbx,4)
movq 0x8(%rsp), %rax
movl %r13d, (%rax,%r13,4)
movq %r12, %rdi
callq 0x32f4
movl %r13d, (%rax)
leaq 0x1(%r13), %rcx
addq $0x3, %rbx
addq $0x20, %r14
movq (%r15), %rsi
movq 0x8(%r15), %rax
subq %rsi, %rax
movq %rax, %r8
shrq $0x5, %r8
movslq %r8d, %rdx
cmpq %rdx, %r13
movq %rcx, %r13
jl 0x2bfa
shlq $0x1b, %rax
movabsq $0x100000000, %rcx      # imm = 0x100000000
movq (%rsp), %rdx
movq %rbp, %r15
addq %rax, %rcx
movq (%rbp), %rax
sarq $0x20, %rcx
leaq (%rcx,%rcx,2), %rcx
movq $0x0, (%rax,%rcx,4)
movl $0x0, 0x8(%rax,%rcx,4)
movq (%rdx), %rcx
movq 0x8(%rdx), %rdx
movq %rdx, %rsi
subq %rcx, %rsi
shrq $0x3, %rsi
imull $0xaaaaaaab, %esi, %esi # imm = 0xAAAAAAAB
testl %esi, %esi
jle 0x2d98
addl $0x2, %r8d
xorl %r9d, %r9d
leaq (%r9,%r9,2), %rbp
movq (%rcx,%rbp,8), %rsi
movq 0x8(%rcx,%rbp,8), %rdi
subq %rsi, %rdi
shrq $0x5, %rdi
testl %edi, %edi
jle 0x2d6e
movslq %r8d, %rax
movq %r9, 0x20(%rsp)
movq %r8, 0x28(%rsp)
xorl %r13d, %r13d
xorl %r14d, %r14d
movl %eax, %ebx
leaq (%rax,%rax,2), %rax
leaq 0x8(,%rax,4), %r12
addq %r13, %rsi
leaq 0x30(%rsp), %rdi
callq 0x32f4
movslq (%rax), %rcx
movq (%r15), %rax
leal (%rbx,%r14), %r8d
incq %r14
addq $0x20, %r13
leaq (%rcx,%rcx,2), %rdx
incl (%rax,%rdx,4)
movq 0x8(%rsp), %rsi
movslq (%rsi,%rcx,4), %rdi
leaq (%rdi,%rdi,2), %rdi
movl %r8d, 0x8(%rax,%rdi,4)
movl %r8d, 0x4(%rax,%rdx,4)
movl %ecx, -0x8(%rax,%r12)
movl (%rsi,%rcx,4), %edx
movl %edx, -0x4(%rax,%r12)
movq (%rsp), %rdx
movl %ecx, (%rax,%r12)
movl %r8d, (%rsi,%rcx,4)
addq $0xc, %r12
movq (%rdx), %rcx
movq (%rcx,%rbp,8), %rsi
movq 0x8(%rcx,%rbp,8), %rdx
subq %rsi, %rdx
shrq $0x5, %rdx
movslq %edx, %rdx
cmpq %rdx, %r14
jl 0x2ce5
movq (%rsp), %rdx
movq 0x28(%rsp), %r8
movq 0x20(%rsp), %r9
movq 0x8(%rdx), %rdx
addl %r14d, %r8d
movslq %r8d, %rsi
incq %r9
leaq (%rsi,%rsi,2), %rsi
negl -0xc(%rax,%rsi,4)
movq %rdx, %rsi
subq %rcx, %rsi
shrq $0x3, %rsi
imull $0xaaaaaaab, %esi, %esi # imm = 0xAAAAAAAB
movslq %esi, %rsi
cmpq %rsi, %r9
jl 0x2ca8
leaq 0x30(%rsp), %rdi
callq 0x37e4
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x2db9
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
movq %r15, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x2dfc
movq %rbp, %r15
jmp 0x2dd5
leaq 0x30(%rsp), %rdi
movq %rax, %r14
callq 0x37e4
movq 0x8(%rsp), %rdi
movq %r15, %rbp
testq %rdi, %rdi
je 0x2dfc
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
movq (%rbp), %rdi
testq %rdi, %rdi
je 0x2e11
movq 0x10(%rbp), %rsi
subq %rdi, %rsi
callq 0x2110
movq %r14, %rdi
callq 0x21c0
nop