// File: /workspace/github_c_makefile_star2_O3/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
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x480c
movq %rdi, %rbx
cmpl $-0x1, 0x18(%rdi)
jne 0x45e8
movq 0x10(%rbx), %rax
cmpq $0x0, 0x10(%rax)
je 0x45e8
movq (%rax), %rax
movq (%rax), %rax
movq 0x10(%rax), %rdx
leaq 0x6abf(%rip), %rsi      # 0xb097
xorl %edi, %edi
xorl %eax, %eax
callq 0x22f9
movl $0x0, 0x18(%rbx)
movq %rbx, %rdi
callq 0x85d2
cmpl $-0x1, %eax
je 0x480c
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rax
movq 0x10(%rax), %r15
movl 0x10(%rcx), %ecx
decl %ecx
js 0x4707
movl %ecx, %r14d
leaq -0x285(%rip), %r13      # 0x4395
movq 0x8(%rbx), %rax
movq (%rax), %rax
movq (%rax,%r14,8), %r12
movl 0x8(%r12), %eax
cmpl $0x42, %eax
je 0x46a3
cmpl $0x2d, %eax
jne 0x46ef
cmpb $0x1, 0x34(%r12)
jne 0x4650
movq 0x10(%rbx), %rdi
leaq 0xdb3(%rip), %rsi       # 0x53fe
callq 0x2db5
cmpb $0x1, 0x18(%r12)
jne 0x46c5
cmpb $0x0, 0xc(%r12)
jne 0x4675
movq 0x10(%r12), %rdx
xorl %edi, %edi
leaq 0x70b9(%rip), %rsi      # 0xb727
xorl %eax, %eax
callq 0x22f9
cmpq $0x0, 0x38(%r12)
je 0x4692
movq 0x10(%r12), %rdx
xorl %edi, %edi
leaq 0x70c4(%rip), %rsi      # 0xb74f
xorl %eax, %eax
callq 0x22f9
movq 0x8(%rbx), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x3aa8
jmp 0x46ef
movq 0x28(%r12), %rcx
cmpq $0x2, %rcx
jb 0x46ef
movq 0x10(%r12), %rdx
xorl %edi, %edi
leaq 0x70e4(%rip), %rsi      # 0xb7a0
xorl %eax, %eax
callq 0x22f9
jmp 0x46ef
testq %r15, %r15
je 0x46ef
cmpq $0x0, 0x38(%r12)
jne 0x46ef
cmpb $0x0, 0x34(%r12)
jne 0x46ef
movq 0x10(%r12), %rdx
xorl %edi, %edi
leaq 0x7091(%rip), %rsi      # 0xb779
xorl %eax, %eax
callq 0x22f9
leaq -0x1(%r14), %rax
testq %r14, %r14
movq %rax, %r14
jg 0x461a
movq 0x10(%rbx), %rax
movq 0x10(%rax), %r15
testq %r15, %r15
je 0x47f9
leaq 0x70bc(%rip), %r13      # 0xb7d3
xorl %r15d, %r15d
xorl %r12d, %r12d
movq (%rax), %rax
movq (%rax,%r12,8), %r14
cmpb $0x0, 0x20(%r14)
jne 0x4741
movq 0x10(%r14), %rdx
xorl %edi, %edi
movq %r13, %rsi
xorl %eax, %eax
callq 0x3f64
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
cmpb $0x0, 0xc(%r14)
jne 0x4765
movslq 0x18(%rbx), %rax
cmpq %rax, (%r14)
je 0x4765
movq 0x10(%r14), %rdx
xorl %edi, %edi
leaq 0x709b(%rip), %rsi      # 0xb7f9
xorl %eax, %eax
callq 0x22f9
cmpb $0x0, 0x21(%r14)
jne 0x4789
movslq 0x18(%rbx), %rax
cmpq %rax, (%r14)
je 0x4789
movq 0x10(%r14), %rdx
xorl %edi, %edi
leaq 0x709d(%rip), %rsi      # 0xb81f
xorl %eax, %eax
callq 0x22f9
movq 0x28(%r14), %rcx
cmpq $0x2, %rcx
jb 0x47a7
movq 0x10(%r14), %rdx
xorl %edi, %edi
leaq 0x70a4(%rip), %rsi      # 0xb844
xorl %eax, %eax
callq 0x22f9
incq %r12
movq 0x10(%rbx), %rax
movq 0x10(%rax), %rcx
cmpq %rcx, %r12
jb 0x471d
cmpq $0x1, %rcx
sete %al
cmpl $-0x1, %r15d
setne %cl
testb %al, %cl
je 0x47fe
leaq 0x70a1(%rip), %rsi      # 0xb875
xorl %r14d, %r14d
xorl %edi, %edi
xorl %eax, %eax
callq 0x22f9
movq 0x10(%rbx), %rdi
movq 0x10(%rdi), %rsi
decq %rsi
callq 0x2cb1
movl $0xffffffff, 0x18(%rbx) # imm = 0xFFFFFFFF
jmp 0x480c
xorl %r14d, %r14d
jmp 0x480c
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