// File: /workspace/github_c_makefile_star2_O0/MaoKo[P]FGFX/fgfl/src/regex_node.c
// Function: cpy_regex_node
regex_node_t*
cpy_regex_node(regex_node_t* root) {
    if (root) {
        if (root->kind_ast == AST_SYMBOL) {
            return (new_regex_node(AST_SYMBOL,
                                            root->symbol, root->in_string));
        }
        else if (root->kind_ast == AST_EPSILON)
            { return (new_regex_node(AST_EPSILON)); }
        else if (root->kind_ast == AST_CLASS)  {
            return (new_regex_node(AST_CLASS, dup_bitset(root->class),
                                root->cce_lower, root->cce_upper));
        }
        else if (root->kind_ast == AST_DOT)
            { return (new_regex_node(AST_DOT, root->is_dotall)); }
        else if (root->kind_ast == AST_BOUND_NAME) {
            return (new_regex_node(AST_BOUND_NAME,
                                                strdup(root->bound_name)));
        }
        else if (root->kind_ast == AST_OPTION) {
            return (new_regex_node(AST_OPTION, root->igcase, root->dotall,
                                    root->skipws, root->reverse, root->left));
        }
        else if (CHILD_NODE(root->kind_ast)) { 
            regex_node_t* left = cpy_regex_node(root->left);
            regex_node_t* right = cpy_regex_node(root->right);

            int new_kind = root->kind_ast;
            if (new_kind == AST_LOOK)
                { new_kind = AST_CONCAT; }

            return (new_regex_node(root->kind_ast, left, right));
        }
    }
    return (NULL_NODE);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xa63a
movq -0x10(%rbp), %rax
cmpl $0xa, (%rax)
jne 0xa488
movq -0x10(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x10(%rbp), %rax
movb 0xc(%rax), %al
andb $0x1, %al
movzbl %al, %edx
movl $0xa, %edi
movb $0x0, %al
callq 0x9c00
movq %rax, -0x8(%rbp)
jmp 0xa642
movq -0x10(%rbp), %rax
cmpl $0xb, (%rax)
jne 0xa4a6
movl $0xb, %edi
movb $0x0, %al
callq 0x9c00
movq %rax, -0x8(%rbp)
jmp 0xa642
movq -0x10(%rbp), %rax
cmpl $0xc, (%rax)
jne 0xa4e2
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x1370
movq %rax, %rsi
movq -0x10(%rbp), %rax
movl 0x10(%rax), %edx
movq -0x10(%rbp), %rax
movl 0x14(%rax), %ecx
movl $0xc, %edi
movb $0x0, %al
callq 0x9c00
movq %rax, -0x8(%rbp)
jmp 0xa642
movq -0x10(%rbp), %rax
cmpl $0x9, (%rax)
jne 0xa50c
movq -0x10(%rbp), %rax
movb 0x8(%rax), %al
andb $0x1, %al
movzbl %al, %esi
movl $0x9, %edi
movb $0x0, %al
callq 0x9c00
movq %rax, -0x8(%rbp)
jmp 0xa642
movq -0x10(%rbp), %rax
cmpl $0x8, (%rax)
jne 0xa53a
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x1190
movq %rax, %rsi
movl $0x8, %edi
movb $0x0, %al
callq 0x9c00
movq %rax, -0x8(%rbp)
jmp 0xa642
movq -0x10(%rbp), %rax
cmpl $0x7, (%rax)
jne 0xa591
movq -0x10(%rbp), %rax
movb 0x8(%rax), %al
andb $0x1, %al
movzbl %al, %esi
movq -0x10(%rbp), %rax
movb 0x9(%rax), %al
andb $0x1, %al
movzbl %al, %edx
movq -0x10(%rbp), %rax
movb 0xa(%rax), %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x10(%rbp), %rax
movb 0xb(%rax), %al
andb $0x1, %al
movzbl %al, %r8d
movq -0x10(%rbp), %rax
movq 0x10(%rax), %r9
movl $0x7, %edi
movb $0x0, %al
callq 0x9c00
movq %rax, -0x8(%rbp)
jmp 0xa642
movq -0x10(%rbp), %rax
cmpl $0x3, (%rax)
je 0xa5d9
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
je 0xa5d9
movq -0x10(%rbp), %rax
cmpl $0x4, (%rax)
je 0xa5d9
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
je 0xa5d9
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa5d9
movq -0x10(%rbp), %rax
cmpl $0x5, (%rax)
je 0xa5d9
movq -0x10(%rbp), %rax
cmpl $0x7, (%rax)
je 0xa5d9
movq -0x10(%rbp), %rax
cmpl $0x6, (%rax)
jne 0xa62c
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xa440
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xa440
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x24(%rbp)
cmpl $0x5, -0x24(%rbp)
jne 0xa611
movl $0x1, -0x24(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movb $0x0, %al
callq 0x9c00
movq %rax, -0x8(%rbp)
jmp 0xa642
jmp 0xa62e
jmp 0xa630
jmp 0xa632
jmp 0xa634
jmp 0xa636
jmp 0xa638
jmp 0xa63a
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)