// File: /workspace/github_c_makefile_star2_O2/MaoKo[P]FGFX/fgfl/src/lexical_spec.c
// Function: spec_sanity_check
int
spec_sanity_check(lexical_spec_t* spec) {
    if (!spec)
        { return (ERROR); }
    else if (spec->start_state == -1 && !EMPTY_VECTOR(spec->state_vect)) {
        spec_entry_t* state_init = (spec_entry_t*)
                                        AT_VECTOR(spec->state_vect, 0);

        warnf(0, "Initial state not defined. Default set to state %s.",
                                        state_init->name);
        spec->start_state = 0;
    }

    if (expand_macro_regex(spec) == ERROR)
        { return (ERROR); }
    else if (check_validity_token(spec) == ERROR)
        { return (ERROR); }
    else if (check_validity_state(spec) == ERROR)
        { return (ERROR); }

    return (DONE);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
pushq $-0x1
popq %r14
testq %rdi, %rdi
je 0x459b
movq %rdi, %rbx
cmpl $-0x1, 0x18(%rdi)
jne 0x4380
movq 0x10(%rbx), %rax
cmpq $0x0, 0x10(%rax)
je 0x4380
movq (%rax), %rax
movq (%rax), %rax
movq 0x10(%rax), %rdx
leaq 0x6d0b(%rip), %rsi      # 0xb07e
xorl %edi, %edi
xorl %eax, %eax
callq 0x3d40
andl $0x0, 0x18(%rbx)
movq %rbx, %rdi
callq 0x7efa
cmpl $-0x1, %eax
je 0x459b
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
movq 0x10(%rcx), %r14
movq 0x10(%rax), %r15
decq %r15
testl %r15d, %r15d
js 0x44a7
movq 0x8(%rbx), %rax
movq (%rax), %rax
movl %r15d, %r13d
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
movq (%rax,%r13,8), %r12
movl 0x8(%r12), %eax
cmpl $0x42, %eax
je 0x4443
cmpl $0x2d, %eax
jne 0x43a1
cmpb $0x1, 0x34(%r12)
jne 0x43e9
movq 0x10(%rbx), %rdi
leaq 0xd0a(%rip), %rsi       # 0x50ee
callq 0x2b98
cmpb $0x1, 0x18(%r12)
jne 0x446c
cmpb $0x0, 0xc(%r12)
jne 0x440e
movq 0x10(%r12), %rdx
xorl %edi, %edi
leaq 0x7307(%rip), %rsi      # 0xb70e
xorl %eax, %eax
callq 0x3d40
cmpq $0x0, 0x38(%r12)
je 0x442b
movq 0x10(%r12), %rdx
xorl %edi, %edi
leaq 0x7312(%rip), %rsi      # 0xb736
xorl %eax, %eax
callq 0x3d40
movq 0x8(%rbx), %rdi
movq %r13, %rsi
leaq -0x300(%rip), %rdx      # 0x4139
callq 0x3786
jmp 0x43a1
movq 0x28(%r12), %rcx
cmpq $0x2, %rcx
jb 0x43a1
movq 0x10(%r12), %rdx
xorl %edi, %edi
leaq 0x7327(%rip), %rsi      # 0xb787
xorl %eax, %eax
callq 0x3d40
jmp 0x43a1
testq %r14, %r14
je 0x43a1
cmpq $0x0, 0x38(%r12)
jne 0x43a1
cmpb $0x0, 0x34(%r12)
jne 0x43a1
movq 0x10(%r12), %rdx
xorl %edi, %edi
leaq 0x72c5(%rip), %rsi      # 0xb760
xorl %eax, %eax
callq 0x3d40
jmp 0x43a1
pushq $-0x1
popq %r12
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x10(%rbx), %rcx
movq 0x10(%rcx), %rax
cmpq %rax, %r14
jae 0x4557
movq (%rcx), %rax
movq (%rax,%r14,8), %r13
cmpb $0x0, 0x20(%r13)
jne 0x44e7
movq 0x10(%r13), %rdx
xorl %edi, %edi
leaq 0x72dd(%rip), %rsi      # 0xb7ba
xorl %eax, %eax
callq 0x3bdc
movl %r12d, %r15d
cmpb $0x0, 0xc(%r13)
jne 0x450c
movslq 0x18(%rbx), %rax
cmpq %rax, (%r13)
je 0x450c
movq 0x10(%r13), %rdx
xorl %edi, %edi
leaq 0x72db(%rip), %rsi      # 0xb7e0
xorl %eax, %eax
callq 0x3d40
cmpb $0x0, 0x21(%r13)
jne 0x4531
movslq 0x18(%rbx), %rax
cmpq %rax, (%r13)
je 0x4531
movq 0x10(%r13), %rdx
xorl %edi, %edi
leaq 0x72dc(%rip), %rsi      # 0xb806
xorl %eax, %eax
callq 0x3d40
movq 0x28(%r13), %rcx
cmpq $0x2, %rcx
jb 0x454f
movq 0x10(%r13), %rdx
xorl %edi, %edi
leaq 0x72e3(%rip), %rsi      # 0xb82b
xorl %eax, %eax
callq 0x3d40
incq %r14
jmp 0x44b1
cmpl $-0x1, %r15d
setne %cl
cmpq $0x1, %rax
sete %al
testb %al, %cl
je 0x458d
leaq 0x72ec(%rip), %rsi      # 0xb85c
xorl %edi, %edi
xorl %eax, %eax
callq 0x3d40
movq 0x10(%rbx), %rdi
movq 0x10(%rdi), %rsi
decq %rsi
callq 0x2aa6
orl $-0x1, 0x18(%rbx)
xorl %r14d, %r14d
cmpl $-0x1, %r15d
sete %r14b
negl %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq