// File: /workspace/github_c_makefile_star2_O0/MaoKo[P]FGFX/fgfl/src/regex.c
// Function: regex_option
static regex_node_t*
regex_option(void) {
    advance_token(regex_spec->lex);

    bool igcase = false;
    bool dotall = false;
    bool skipws = false;
    bool reverse = false;

    int option_kind = peek_token(regex_spec->lex);
    while (IS_OPTION(option_kind)) {
        advance_token(regex_spec->lex);
        switch (option_kind) {
            case T_IGCASE:  igcase  = true; break;
            case T_DOTALL:  dotall  = true; break;
            case T_SKIPWS:  skipws  = true; break;
            case T_REVERSE: reverse = true; break;
        }
        option_kind = peek_token(regex_spec->lex);
    }

    if (peek_token(regex_spec->lex) == T_REG_INVERT) {
        advance_token(regex_spec->lex);
        option_kind = peek_token(regex_spec->lex);

        while (IS_OPTION(option_kind)) {
            advance_token(regex_spec->lex);
            switch (option_kind) {
                case T_IGCASE:  igcase  = false; break;
                case T_DOTALL:  dotall  = false; break;
                case T_SKIPWS:  skipws  = false; break;
                case T_REVERSE: reverse = false; break;
            }
            option_kind = peek_token(regex_spec->lex);
        }
    }

    if (advance_token(regex_spec->lex) != T_REG_COLON) {
        errorf(CURRENT_LINE(regex_spec->lex),
                            "Missing a ':' after the regex option.");
        return (NULL_NODE);
    }

    regex_node_t* root = regex_union();
    if (!root)
        { return (NULL_NODE); }
    else if (advance_token(regex_spec->lex) != T_REG_RPAREN) {
        errorf(CURRENT_LINE(regex_spec->lex),
                            "Missing a ')' after the regex option.");
        return (NULL_NODE);
    }

    return (new_regex_node(AST_OPTION, igcase, dotall, skipws, reverse, root));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq 0x19781(%rip), %rax     # 0x21dc0
movq (%rax), %rdi
callq 0x2cc0
movb $0x0, -0x9(%rbp)
movb $0x0, -0xa(%rbp)
movb $0x0, -0xb(%rbp)
movb $0x0, -0xc(%rbp)
movq 0x19762(%rip), %rax     # 0x21dc0
movq (%rax), %rdi
callq 0x3300
movl %eax, -0x10(%rbp)
movb $0x1, %al
cmpl $0x22, -0x10(%rbp)
movb %al, -0x19(%rbp)
je 0x8694
movb $0x1, %al
cmpl $0x23, -0x10(%rbp)
movb %al, -0x19(%rbp)
je 0x8694
movb $0x1, %al
cmpl $0x24, -0x10(%rbp)
movb %al, -0x19(%rbp)
je 0x8694
cmpl $0x25, -0x10(%rbp)
sete %al
movb %al, -0x19(%rbp)
movb -0x19(%rbp), %al
testb $0x1, %al
jne 0x869d
jmp 0x86fe
movq 0x1971c(%rip), %rax     # 0x21dc0
movq (%rax), %rdi
callq 0x2cc0
movl -0x10(%rbp), %eax
addl $-0x22, %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x3, %eax
ja 0x86e7
movq -0x28(%rbp), %rax
leaq 0x667c(%rip), %rcx      # 0xed44
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x1, -0x9(%rbp)
jmp 0x86e7
movb $0x1, -0xa(%rbp)
jmp 0x86e7
movb $0x1, -0xb(%rbp)
jmp 0x86e7
movb $0x1, -0xc(%rbp)
movq 0x196d2(%rip), %rax     # 0x21dc0
movq (%rax), %rdi
callq 0x3300
movl %eax, -0x10(%rbp)
jmp 0x8669
movq 0x196bb(%rip), %rax     # 0x21dc0
movq (%rax), %rdi
callq 0x3300
cmpl $0x21, %eax
jne 0x87ce
movq 0x196a3(%rip), %rax     # 0x21dc0
movq (%rax), %rdi
callq 0x2cc0
movq 0x19694(%rip), %rax     # 0x21dc0
movq (%rax), %rdi
callq 0x3300
movl %eax, -0x10(%rbp)
movb $0x1, %al
cmpl $0x22, -0x10(%rbp)
movb %al, -0x29(%rbp)
je 0x8762
movb $0x1, %al
cmpl $0x23, -0x10(%rbp)
movb %al, -0x29(%rbp)
je 0x8762
movb $0x1, %al
cmpl $0x24, -0x10(%rbp)
movb %al, -0x29(%rbp)
je 0x8762
cmpl $0x25, -0x10(%rbp)
sete %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
testb $0x1, %al
jne 0x876b
jmp 0x87cc
movq 0x1964e(%rip), %rax     # 0x21dc0
movq (%rax), %rdi
callq 0x2cc0
movl -0x10(%rbp), %eax
addl $-0x22, %eax
movl %eax, %ecx
movq %rcx, -0x38(%rbp)
subl $0x3, %eax
ja 0x87b5
movq -0x38(%rbp), %rax
leaq 0x659e(%rip), %rcx      # 0xed34
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x0, -0x9(%rbp)
jmp 0x87b5
movb $0x0, -0xa(%rbp)
jmp 0x87b5
movb $0x0, -0xb(%rbp)
jmp 0x87b5
movb $0x0, -0xc(%rbp)
movq 0x19604(%rip), %rax     # 0x21dc0
movq (%rax), %rdi
callq 0x3300
movl %eax, -0x10(%rbp)
jmp 0x8737
jmp 0x87ce
movq 0x195eb(%rip), %rax     # 0x21dc0
movq (%rax), %rdi
callq 0x2cc0
cmpq $0x26, %rax
je 0x880c
movq 0x195d6(%rip), %rax     # 0x21dc0
movq (%rax), %rax
movslq 0x28(%rax), %rdi
leaq 0x67a1(%rip), %rsi      # 0xef99
movb $0x0, %al
callq 0x4230
movq $0x0, -0x8(%rbp)
jmp 0x8898
callq 0x7be0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x8826
movq $0x0, -0x8(%rbp)
jmp 0x8898
movq 0x19593(%rip), %rax     # 0x21dc0
movq (%rax), %rdi
callq 0x2cc0
cmpq $0x9, %rax
je 0x8861
movq 0x1957e(%rip), %rax     # 0x21dc0
movq (%rax), %rax
movslq 0x28(%rax), %rdi
leaq 0x676f(%rip), %rsi      # 0xefbf
movb $0x0, %al
callq 0x4230
movq $0x0, -0x8(%rbp)
jmp 0x8898
jmp 0x8863
movb -0x9(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
movb -0xa(%rbp), %al
andb $0x1, %al
movzbl %al, %edx
movb -0xb(%rbp), %al
andb $0x1, %al
movzbl %al, %ecx
movb -0xc(%rbp), %al
andb $0x1, %al
movzbl %al, %r8d
movq -0x18(%rbp), %r9
movl $0x7, %edi
movb $0x0, %al
callq 0x9c00
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)