// File: /workspace/github_cpp_makefile_star2_O3/JameyWoo[P]re2graph/algorithms.cpp
// Function: get_closure(NFA, std::vector<std::set<int, std::less<int>, std::allocator<int>>, std::allocator<std::set<int, std::less<int>, std::allocator<int>>>>&, int, std::vector<bool, std::allocator<bool>>&)
void get_closure(NFA nfa, vector<set<int>> &closures, int state, vector<bool> &visted) {
    /**
     * ! 获取nfa某状态闭包的函数. 存储在closures中
     * !  参数解释: 
     * NFA nfa: 要求闭包的nfa
     * vector<set<int>> &closures: 闭包存储的数据结构
     * int state: 当前要求闭包的状态. 由于dfa, 先求出它可以扩展的状态, 再回来求它
     * vector<bool> &visted: 回溯的标记, 先标记为true, 回溯之后标记为false
     */
    if (closures[state].size()) return;
    for (auto x : nfa.jump[state]) {                                                 // 当前状态的map集
        if (x.first == '~') {                                                        // 当边为 空 时, 可以滑动求闭包
            for (auto y : x.second) {                                                // 遍历下一状态
                if (visted[y] == false) {                                            // 当前递归路径没有被访问过
                    visted[y] = true;                                                // 标记访问
                    get_closure(nfa, closures, y, visted);                           // 递归得到下一状态闭包
                    closures[state].insert(closures[y].begin(), closures[y].end());  // 更新当前状态闭包
                    visted[y] = false;                                               // 撤销标记
                }
            }
        }
    }
    closures[state].insert(state);  // ! ...插入自己......
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %edx, 0xc(%rsp)
movslq %edx, %r8
movq (%rsi), %rax
leaq (%r8,%r8,2), %rdx
shlq $0x4, %rdx
cmpq $0x0, 0x28(%rax,%rdx)
jne 0x7362
movq 0x58(%rdi), %r9
leaq (%r9,%rdx), %rbx
addq $0x8, %rbx
movq 0x10(%rbx), %r14
cmpq %rbx, %r14
je 0x734d
movq %rdi, 0x58(%rsp)
movq %rcx, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movabsq $-0x8000000000000000, %r13 # imm = 0x8000000000000000
leaq 0x28(%rsp), %r15
leaq 0x3f(%r13), %r12
movq %rbx, 0x40(%rsp)
movq %r12, 0x50(%rsp)
movb 0x20(%r14), %al
movb %al, 0x20(%rsp)
leaq 0x28(%r14), %rsi
movq %r15, %rdi
callq 0x3c64
cmpb $0x7e, 0x20(%rsp)
movq 0x28(%rsp), %rbp
jne 0x7317
movq 0x30(%rsp), %rdi
cmpq %rdi, %rbp
je 0x7317
movq %r14, 0x48(%rsp)
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq %rdi, 0x60(%rsp)
movslq (%rbp), %r15
leal 0x3f(%r15), %esi
testq %r15, %r15
cmovnsl %r15d, %esi
sarl $0x6, %esi
movq %r15, %rcx
andq %r12, %rcx
xorl %edx, %edx
cmpq %r13, %rcx
setbe %dl
movl $0x1, %ebx
movl %r15d, %ecx
shlq %cl, %rbx
movslq %esi, %r14
leaq (%rax,%r14,8), %rcx
movq -0x8(%rcx,%rdx,8), %rsi
btq %r15, %rsi
jb 0x72f6
movq %r13, %r12
leaq -0x8(,%rdx,8), %r13
orq %rbx, %rsi
movq %rsi, (%rcx,%r13)
leaq 0x68(%rsp), %rdi
movq 0x58(%rsp), %rsi
callq 0x3a10
leaq 0x68(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl %r15d, %edx
movq 0x18(%rsp), %rcx
callq 0x7112
leaq 0xc0(%rsp), %rdi
callq 0x410c
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x726d
movq 0xb8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2200
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x728a
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2200
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x72a4
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x2200
movslq 0xc(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rcx), %rcx
leaq (%rax,%rax,2), %rdi
shlq $0x4, %rdi
addq %rcx, %rdi
leaq (%r15,%r15,2), %rax
shlq $0x4, %rax
leaq (%rcx,%rax), %rdx
addq $0x8, %rdx
movq 0x10(%rdx), %rsi
callq 0xfd96
movq 0x18(%rsp), %rax
movq (%rax), %rax
leaq (%rax,%r14,8), %rcx
notq %rbx
andq %rbx, (%r13,%rcx)
movq %r12, %r13
movq 0x50(%rsp), %r12
movq 0x60(%rsp), %rdi
addq $0x4, %rbp
cmpq %rdi, %rbp
jne 0x71ca
movq 0x28(%rsp), %rbp
movq 0x40(%rsp), %rbx
movq 0x48(%rsp), %r14
leaq 0x28(%rsp), %r15
testq %rbp, %rbp
je 0x732c
movq 0x38(%rsp), %rsi
subq %rbp, %rsi
movq %rbp, %rdi
callq 0x2200
movq %r14, %rdi
callq 0x2160
movq %rax, %r14
cmpq %rbx, %rax
jne 0x7186
movslq 0xc(%rsp), %r8
movq 0x10(%rsp), %rax
movq (%rax), %rax
leaq (%r8,%r8,2), %rdi
shlq $0x4, %rdi
addq %rax, %rdi
leaq 0xc(%rsp), %rsi
callq 0xffb0
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x3ac4
jmp 0x7386
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x739d
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2350