// File: /workspace/github_c_makefile_star2_O1/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 0x492d
movq %rdi, %rbx
cmpl $-0x1, 0x18(%rdi)
jne 0x470f
movq 0x10(%rbx), %rax
cmpq $0x0, 0x10(%rax)
je 0x470f
movq (%rax), %rax
movq (%rax), %rax
movq 0x10(%rax), %rdx
leaq 0x6998(%rip), %rsi      # 0xb097
xorl %edi, %edi
xorl %eax, %eax
callq 0x22f9
movl $0x0, 0x18(%rbx)
movq %rbx, %rdi
callq 0x874c
cmpl $-0x1, %eax
je 0x492d
movq 0x8(%rbx), %rax
movl 0x10(%rax), %eax
decl %eax
js 0x4826
movq 0x10(%rbx), %rcx
movq 0x10(%rcx), %r15
movl %eax, %r14d
leaq -0x2b0(%rip), %r13      # 0x4491
movq 0x8(%rbx), %rax
movq (%rax), %rax
movq (%rax,%r14,8), %r12
movl 0x8(%r12), %eax
cmpl $0x42, %eax
je 0x47ca
cmpl $0x2d, %eax
jne 0x4816
cmpb $0x1, 0x34(%r12)
jne 0x4777
movq 0x10(%rbx), %rdi
leaq 0xe0d(%rip), %rsi       # 0x557f
callq 0x2db5
cmpb $0x1, 0x18(%r12)
jne 0x47ec
cmpb $0x0, 0xc(%r12)
jne 0x479c
movq 0x10(%r12), %rdx
xorl %edi, %edi
leaq 0x6f92(%rip), %rsi      # 0xb727
xorl %eax, %eax
callq 0x22f9
cmpq $0x0, 0x38(%r12)
je 0x47b9
movq 0x10(%r12), %rdx
xorl %edi, %edi
leaq 0x6f9d(%rip), %rsi      # 0xb74f
xorl %eax, %eax
callq 0x22f9
movq 0x8(%rbx), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x3ba4
jmp 0x4816
movq 0x28(%r12), %rcx
cmpq $0x2, %rcx
jb 0x4816
movq 0x10(%r12), %rdx
xorl %edi, %edi
leaq 0x6fbd(%rip), %rsi      # 0xb7a0
xorl %eax, %eax
callq 0x22f9
jmp 0x4816
testq %r15, %r15
je 0x4816
cmpq $0x0, 0x38(%r12)
jne 0x4816
cmpb $0x0, 0x34(%r12)
jne 0x4816
movq 0x10(%r12), %rdx
xorl %edi, %edi
leaq 0x6f6a(%rip), %rsi      # 0xb779
xorl %eax, %eax
callq 0x22f9
leaq -0x1(%r14), %rax
testq %r14, %r14
movq %rax, %r14
jg 0x4741
movq 0x10(%rbx), %rax
cmpq $0x0, 0x10(%rax)
je 0x48e9
leaq 0x6f97(%rip), %r13      # 0xb7d3
xorl %r15d, %r15d
xorl %r12d, %r12d
movq (%rax), %rax
movq (%rax,%r12,8), %r14
cmpb $0x0, 0x20(%r14)
jne 0x4866
movq 0x10(%r14), %rdx
xorl %edi, %edi
movq %r13, %rsi
xorl %eax, %eax
callq 0x4060
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
cmpb $0x0, 0xc(%r14)
jne 0x488a
movslq 0x18(%rbx), %rax
cmpq %rax, (%r14)
je 0x488a
movq 0x10(%r14), %rdx
xorl %edi, %edi
leaq 0x6f76(%rip), %rsi      # 0xb7f9
xorl %eax, %eax
callq 0x22f9
cmpb $0x0, 0x21(%r14)
jne 0x48ae
movslq 0x18(%rbx), %rax
cmpq %rax, (%r14)
je 0x48ae
movq 0x10(%r14), %rdx
xorl %edi, %edi
leaq 0x6f78(%rip), %rsi      # 0xb81f
xorl %eax, %eax
callq 0x22f9
movq 0x28(%r14), %rcx
cmpq $0x2, %rcx
jb 0x48cc
movq 0x10(%r14), %rdx
xorl %edi, %edi
leaq 0x6f7f(%rip), %rsi      # 0xb844
xorl %eax, %eax
callq 0x22f9
incq %r12
movq 0x10(%rbx), %rax
movq 0x10(%rax), %rcx
cmpq %rcx, %r12
jb 0x4842
cmpq $0x1, %rcx
sete %al
jmp 0x48ee
xorl %r15d, %r15d
xorl %eax, %eax
cmpl $-0x1, %r15d
je 0x491f
testb %al, %al
je 0x491f
leaq 0x6f76(%rip), %rsi      # 0xb875
xorl %edi, %edi
xorl %eax, %eax
callq 0x22f9
movq 0x10(%rbx), %rdi
movq 0x10(%rdi), %rsi
decq %rsi
callq 0x2cbd
movl $0xffffffff, 0x18(%rbx) # imm = 0xFFFFFFFF
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