// File: /workspace/github_c_makefile_star2_O3/MaoKo[P]FGFX/fgfl/src/preprocess_regex.c
// Function: recur_node_topsort
static int
recur_node_topsort(lexical_spec_t* spec, spec_entry_t* crt_entry,
            size_t index_entry, vector_t* stack_order, bitset_t* seen_reg) {

    crt_entry->is_used = true;
    if (IS_PRESENT(seen_reg, GET_INDEX(crt_entry))) {
        if (GET_INDEX(crt_entry) == index_entry) {
            errorf(0, "Stack overflow. Cycle detected for regex %s.",
                                            crt_entry->name);
            return (ERROR);
        }
        return (DONE);
    }
    ADD_BITSET(seen_reg, GET_INDEX(crt_entry));

    bitset_t* depend_node = NULL;
    if (dependency_macro(spec, crt_entry, &depend_node) == ERROR)
        { return (ERROR); }

    int i;
    int exit_st = DONE;

    while ((i = IT_NEXT(depend_node)) != IT_NULL) {
        spec_entry_t* new_entry = (spec_entry_t*)AT_VECTOR(spec->entry_vect, i);
        if (recur_node_topsort(spec, new_entry,
                                index_entry, stack_order, seen_reg) == ERROR)
            { exit_st = ERROR; }
    }

    PUSH_BACK_VECTOR(stack_order, (void*)GET_INDEX(crt_entry));
    del_bitset(depend_node);

    return (exit_st);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r13
movb $0x1, 0xc(%rsi)
movq (%rsi), %rcx
testq %r8, %r8
je 0x835a
movl 0x4(%r8), %eax
cmpq %rax, %rcx
jae 0x8361
movq 0x8(%r8), %rdx
movq %rcx, %rsi
shrq $0x6, %rsi
movq (%rdx,%rsi,8), %rdx
btq %rcx, %rdx
jae 0x8361
xorl %r15d, %r15d
cmpq %r12, %rcx
jne 0x85c0
movq 0x10(%rbx), %rdx
leaq 0x3a10(%rip), %rsi      # 0xbd5c
xorl %edi, %edi
xorl %eax, %eax
callq 0x3f64
jmp 0x85ba
movl 0x4, %eax
cmpq %rax, %rcx
movq %r8, -0x58(%rbp)
jae 0x8380
movl $0x1, %eax
shlq %cl, %rax
movq 0x8(%r8), %rdx
shrq $0x6, %rcx
orq %rax, (%rdx,%rcx,8)
jmp 0x838b
movq %r8, %rdi
movq %rcx, %rsi
callq 0x25b0
xorl %r15d, %r15d
cmpl $0x42, 0x8(%rbx)
movq %rbx, -0x60(%rbp)
jne 0x83aa
movq %r13, -0x38(%rbp)
movq %r14, %r13
movq %r12, %r14
xorl %r12d, %r12d
jmp 0x84e9
movq %r12, -0x48(%rbp)
movq %r14, -0x50(%rbp)
callq 0x2b2c
movq %rax, %r14
movq 0x20(%rbx), %rdi
movl $0x8, %esi
movq %rax, %rdx
callq 0x7d1d
cmpq $0x0, 0x10(%r14)
je 0x84c9
movq $0x0, -0x30(%rbp)
xorl %r12d, %r12d
movq %r14, -0x40(%rbp)
movq (%r14), %rax
movq (%rax,%r12,8), %rbx
movq 0x8(%r13), %rdi
movq 0x8(%rbx), %rsi
leaq -0x4029(%rip), %rdx     # 0x43d2
callq 0x2d45
cmpl $-0x1, %eax
movq %rbx, -0x38(%rbp)
je 0x8455
movq 0x8(%r13), %rcx
movq (%rcx), %rcx
movslq %eax, %rbx
movq (%rcx,%rbx,8), %r14
cmpl $0x42, 0x8(%r14)
je 0x856c
movq -0x30(%rbp), %rax
testq %rax, %rax
jne 0x8430
callq 0x247c
movq (%r14), %rcx
movl 0x4(%rax), %edx
cmpq %rdx, %rcx
movq %rax, -0x30(%rbp)
jae 0x8474
movl $0x1, %esi
shlq %cl, %rsi
movq 0x8(%rax), %rdx
shrq $0x6, %rcx
orq %rsi, (%rdx,%rcx,8)
jmp 0x847f
movq 0x10(%r13), %rdi
movq 0x8(%rbx), %rsi
movq 0x7b6c(%rip), %rdx      # 0xffd0
callq 0x2d45
cmpl $-0x1, %eax
setne %bl
sete %al
jmp 0x84aa
movq %rax, %rdi
movq %rcx, %rsi
callq 0x25b0
movq -0x38(%rbp), %rax
movq %rbx, 0x10(%rax)
movb $0x1, %bl
cmpb $0x1, 0x1a(%r14)
jne 0x84a4
movq 0x10(%r14), %rdx
xorl %edi, %edi
leaq 0x38ec(%rip), %rsi      # 0xbd89
xorl %eax, %eax
callq 0x22f9
movb $0x1, %al
movq -0x40(%rbp), %r14
testb %bl, %bl
je 0x8557
testb %al, %al
je 0x8557
incq %r12
cmpq 0x10(%r14), %r12
jb 0x83e5
jmp 0x84d1
movq $0x0, -0x30(%rbp)
movq %r13, -0x38(%rbp)
movq %r14, %rdi
callq 0x2bce
movq -0x50(%rbp), %r13
movq -0x48(%rbp), %r14
movq -0x30(%rbp), %r12
movq %r12, %rdi
movq %r12, -0x30(%rbp)
callq 0x291c
cmpl $-0x1, %eax
movq -0x58(%rbp), %rbx
movq -0x38(%rbp), %r12
je 0x8539
xorl %r15d, %r15d
movq 0x8(%r12), %rcx
movq (%rcx), %rcx
cltq
movq (%rcx,%rax,8), %rsi
movq %r12, %rdi
movq %r14, %rdx
movq %r13, %rcx
movq %rbx, %r8
callq 0x82ee
cmpl $-0x1, %eax
cmovel %eax, %r15d
movq -0x30(%rbp), %rdi
callq 0x291c
cmpl $-0x1, %eax
jne 0x8505
movq 0x10(%r13), %rsi
movq -0x60(%rbp), %rax
movq (%rax), %rdx
movq %r13, %rdi
callq 0x2c21
movq -0x30(%rbp), %rdi
callq 0x24c6
jmp 0x85c0
testb %bl, %bl
je 0x8591
testb %al, %al
movq -0x38(%rbp), %rax
jne 0x85a9
leaq 0x38af(%rip), %rcx      # 0xbe19
jmp 0x857b
movq -0x40(%rbp), %r14
leaq 0x389a(%rip), %rcx      # 0xbe11
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x3874(%rip), %rsi      # 0xbdfa
xorl %edi, %edi
xorl %eax, %eax
callq 0x3f64
jmp 0x85a9
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x3833(%rip), %rsi      # 0xbdd3
xorl %edi, %edi
xorl %eax, %eax
callq 0x3f64
movq -0x30(%rbp), %rdi
callq 0x24c6
movq %r14, %rdi
callq 0x2bce
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %r15d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq