// File: /workspace/github_c_makefile_star2_O0/MaoKo[P]FGFX/fgfl/src/dfa.c
// Function: epsilon_closure
static bitset_t*
epsilon_closure(bitset_t* set_state) {
    if (!set_state)
        { return (NULL_BITSET); }

    bitset_t* seen_state = new_bitset();
    bool change = false;

    do {
        int i;
        change = false;

        while ((i = IT_NEXT(set_state)) != IT_NULL) {
            if (!IS_PRESENT(seen_state, (size_t)i)) {
                nfa_state_t* crt_state = NFA_STATE_AT(i);
                if (!do_eclos) {
                    if (crt_state->eclos) {
                        if (!is_subset_bitset(set_state, crt_state->eclos))
                            { UNION_BITSET(set_state, crt_state->eclos); }
                        else
                            { continue; }
                    }
                    else {
                        nfa_state_edges(NFA_STATE_AT(i), EPSILON, set_state);
                        ADD_BITSET(seen_state, (size_t)i);
                    }
                    change = true;
                }
                else
                    { UNION_BITSET(set_state, crt_state->eclos); }
            }
        }
        IT_RESET(set_state);
    } while (change);

    del_bitset(seen_state);
    return (set_state);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xbf10
movq $0x0, -0x8(%rbp)
jmp 0xc0d0
callq 0x12b0
movq %rax, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
movb $0x0, -0x19(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1ac0
movl %eax, -0x20(%rbp)
cmpl $-0x1, %eax
je 0xc079
cmpq $0x0, -0x18(%rbp)
je 0xbf4d
movslq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x4(%rcx), %ecx
cmpq %rcx, %rax
jb 0xbf59
xorl %eax, %eax
testb $0x1, %al
jne 0xc074
jmp 0xbf8d
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x20(%rbp), %rcx
shrq $0x6, %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
andq $0x3f, %rcx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
jne 0xc074
leaq 0x15e1c(%rip), %rax     # 0x21db0
movq (%rax), %rax
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
testb $0x1, 0x15e23(%rip)     # 0x21dd0
jne 0xc05f
movq -0x28(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0xbfef
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rsi
callq 0x1c20
testb $0x1, %al
jne 0xbfe8
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rdx
xorl %edi, %edi
callq 0x18b0
jmp 0xbfed
jmp 0xbf21
jmp 0xc059
leaq 0x15dba(%rip), %rax     # 0x21db0
movq (%rax), %rax
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rdx
movl $0x101, %esi            # imm = 0x101
callq 0xc0e0
movslq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x4(%rcx), %ecx
cmpq %rcx, %rax
jb 0xc031
movq -0x18(%rbp), %rdi
movslq -0x20(%rbp), %rsi
callq 0x1440
jmp 0xc059
movslq -0x20(%rbp), %rcx
andq $0x3f, %rcx
movl $0x1, %edx
shlq %cl, %rdx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x20(%rbp), %rcx
shrq $0x6, %rcx
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movb $0x1, -0x19(%rbp)
jmp 0xc072
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rdx
xorl %edi, %edi
callq 0x18b0
jmp 0xc074
jmp 0xbf21
cmpq $0x0, -0x10(%rbp)
jne 0xc082
jmp 0xc0b5
movq -0x10(%rbp), %rax
testb $0x1, 0x54(%rax)
jne 0xc09e
movq -0x10(%rbp), %rax
movl $0x0, 0x50(%rax)
xorl %eax, %eax
movl %eax, -0x2c(%rbp)
jmp 0xc0b2
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
subl $0x1, %eax
movq -0x10(%rbp), %rcx
movl %eax, 0x50(%rcx)
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
testb $0x1, -0x19(%rbp)
jne 0xbf1d
movq -0x18(%rbp), %rdi
callq 0x1320
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)