// File: /workspace/github_c_makefile_star2_O3/MaoKo[P]FGFX/fgfp/src/fgfp.c
// Function: main
int main(int argc, char* argv[]) {
	if (argc <= 1)
		{ return (EXIT_FAILURE); }

	int filde = open(argv[1], O_RDONLY);
	if (filde == -1) {
		errorf(0, "Can't open %s.", argv[1]);
		return (EXIT_FAILURE);
	}

	cfg_t* cfg = parse_cfg(filde);
	if (!cfg)
		{ return (EXIT_FAILURE); }

	augment_grammar(cfg);
	if (cfg_sanity_check(cfg) == ERROR) {
		del_cfg(cfg);
		return (EXIT_FAILURE);
	}

//	print_production(cfg);
	int exit_st = gen_fgfp_file(cfg, get_filename(argv[1]));

#if 0

	print_production(cfg);
	print_non_terminal(cfg);
	print_nullable(cfg);
	print_first_set(cfg);
	print_follow_set(cfg);

#endif	

	del_cfg(cfg);

	if (close(filde) == -1) {
		errorf(0, "Can't close %s.", argv[1]);
		return (EXIT_FAILURE);
	}

	return (exit_st);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl $0x1, %r12d
cmpl $0x2, %edi
jl 0x427d
movq %rsi, %rbx
movq 0x8(%rsi), %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x2180
cmpl $-0x1, %eax
je 0x4190
movl %eax, %r14d
movl %eax, %edi
callq 0x43f0
testq %rax, %rax
je 0x427d
movq %rax, %r15
movq %rax, %rdi
callq 0x44ea
movq %r15, %rdi
callq 0x46a0
cmpl $-0x1, %eax
je 0x41a9
movq 0x8(%rbx), %rdi
callq 0x3a45
movq %rax, %r13
leaq 0x5fb6(%rip), %rsi      # 0x9fe1
movq %rax, %rdi
callq 0x3996
movq %rax, -0x30(%rbp)
movq %rax, %rdi
callq 0x3c92
cmpl $-0x1, %eax
je 0x41b6
movl %eax, %r12d
movl %eax, %edi
movq %r13, -0x40(%rbp)
movq %r13, %rsi
callq 0x3dfd
movl %r12d, %edi
movq %r15, %rsi
callq 0x85cc
movl %r12d, %edi
movq %r15, %rsi
callq 0x877a
movl %r12d, %edi
movq %r15, %rsi
callq 0x88f1
movl %r12d, %edi
movq %r15, %rsi
movq -0x30(%rbp), %r13
movq %r13, %rdx
callq 0x8999
movl %r12d, %edi
movq %r15, %rsi
movq %r13, %rdx
callq 0x8a5e
movl %r12d, %edi
movq %r15, %rsi
callq 0x8074
movq %r15, %rdi
callq 0x63fc
movq %r15, %rdi
testb %al, %al
je 0x41c1
callq 0x646a
movq %rax, %r13
movl %r12d, %edi
movq %r15, %rsi
movq %rax, %rdx
movq -0x30(%rbp), %rcx
callq 0x80db
leaq -0x55f(%rip), %rsi      # 0x3b7a
movq %r13, %rdi
callq 0x2d75
movq %r13, %rdi
callq 0x2b8e
leaq 0x5ef4(%rip), %rsi      # 0x9fe4
movl %r12d, %edi
xorl %eax, %eax
callq 0x20f0
movq %r15, %rdi
callq 0x7253
movq %rax, %r13
movq %r15, %rdi
movq %rax, %rsi
movq %rax, -0x38(%rbp)
callq 0x788b
movl %r12d, %edi
callq 0x8200
movl %r12d, %edi
callq 0x825c
movl %r12d, %edi
movq %r15, %rsi
movq %r13, %rdx
movq -0x30(%rbp), %r13
movq %r13, %rcx
callq 0x82b8
movl %r12d, %edi
movq %r15, %rsi
movq -0x38(%rbp), %rdx
movq %r13, %rcx
callq 0x84ab
leaq 0x24a6(%rip), %rsi      # 0x65f8
movq -0x38(%rbp), %r13
movq %r13, %rdi
callq 0x2d75
movq %r13, %rdi
callq 0x2b8e
callq 0x6739
leaq 0x5e7a(%rip), %rsi      # 0x9fec
movl %r12d, %edi
xorl %eax, %eax
callq 0x20f0
movl %r12d, %edi
movq %r15, %rsi
movq -0x30(%rbp), %rdx
callq 0x8b3e
jmp 0x4224
movq 0x8(%rbx), %rdx
leaq 0x5e27(%rip), %rsi      # 0x9fc2
xorl %edi, %edi
xorl %eax, %eax
callq 0x3f24
jmp 0x427d
movq %r15, %rdi
callq 0x42fd
jmp 0x427d
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0x424e
callq 0x7253
movq %rax, %r13
movq %r15, %rdi
movq %rax, %rsi
callq 0x788b
movl %r12d, %edi
callq 0x8200
movl %r12d, %edi
callq 0x825c
movl %r12d, %edi
movq %r15, %rsi
movq %r13, %rdx
movq -0x30(%rbp), %rcx
callq 0x82b8
movl %r12d, %edi
movq %r15, %rsi
movq %r13, %rdx
movq -0x30(%rbp), %rcx
callq 0x84ab
leaq 0x23e9(%rip), %rsi      # 0x65f8
movq %r13, %rdi
callq 0x2d75
movq %r13, %rdi
callq 0x2b8e
callq 0x6739
movl %r12d, %edi
movq -0x40(%rbp), %rsi
callq 0x3e6f
movq -0x30(%rbp), %rdi
callq 0x21d0
movl %r12d, %edi
callq 0x20e0
xorl %r12d, %r12d
cmpl $-0x1, %eax
sete %r12b
negl %r12d
movq %r15, %rdi
callq 0x42fd
movl %r14d, %edi
callq 0x20e0
cmpl $-0x1, %eax
jne 0x427d
movq 0x8(%rbx), %rdx
leaq 0x5d63(%rip), %rsi      # 0x9fd1
xorl %edi, %edi
xorl %eax, %eax
callq 0x3f24
movl $0x1, %r12d
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop