// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %r13
cmpl $0x2, %edi
jl 0x3f81
movq %rsi, %rbx
movq 0x8(%rsi), %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x2180
cmpl $-0x1, %eax
je 0x3f63
movl %eax, %r14d
movl %eax, %edi
callq 0x41b4
testq %rax, %rax
je 0x3f81
movq %rax, %r15
movq %rax, %rdi
callq 0x42b0
movq %r15, %rdi
callq 0x4458
cmpl $-0x1, %eax
je 0x3f79
movl %r14d, -0x2c(%rbp)
movq 0x8(%rbx), %rdi
callq 0x3726
movq %rax, %r14
leaq 0x61bf(%rip), %rsi      # 0x9fc8
movq %rax, %rdi
callq 0x3677
movq %rax, -0x38(%rbp)
movq %rax, %rdi
callq 0x3934
cmpl $-0x1, %eax
je 0x3f96
movl %eax, %r12d
movl %eax, %edi
movq %r14, -0x40(%rbp)
movq %r14, %rsi
callq 0x3a8a
movl %r12d, %edi
movq %r15, %rsi
callq 0x80a4
movl %r12d, %edi
movq %r15, %rsi
callq 0x8232
movl %r12d, %edi
movq %r15, %rsi
callq 0x839c
movl %r12d, %edi
movq %r15, %rsi
movq -0x38(%rbp), %r14
movq %r14, %rdx
callq 0x843c
movl %r12d, %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0x84f9
movl %r12d, %edi
movq %r15, %rsi
callq 0x7b60
movq %r15, %rdi
callq 0x5fe4
movq %r15, %rdi
testb %al, %al
je 0x3fa3
callq 0x6048
movq %rax, %r13
movl %r12d, %edi
movq %r15, %rsi
movq %rax, %rdx
movq -0x38(%rbp), %r14
movq %r14, %rcx
callq 0x7bc5
leaq -0x670(%rip), %rsi      # 0x384a
movq %r13, %rdi
callq 0x2b58
movq %r13, %rdi
callq 0x2986
leaq 0x60fa(%rip), %rsi      # 0x9fcb
movl %r12d, %edi
xorl %eax, %eax
callq 0x20f0
movq %r15, %rdi
callq 0x6e1b
movq %rax, %r13
movq %r15, %rdi
movq %rax, %rsi
callq 0x73ce
movl %r12d, %edi
callq 0x7cd8
movl %r12d, %edi
callq 0x7d34
movl %r12d, %edi
movq %r15, %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0x7d90
movl %r12d, %edi
movq %r15, %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0x7f85
leaq 0x229a(%rip), %rsi      # 0x61c4
movq %r13, %rdi
callq 0x2b58
movq %r13, %rdi
callq 0x2986
callq 0x62f5
leaq 0x608d(%rip), %rsi      # 0x9fd3
movl %r12d, %edi
xorl %eax, %eax
callq 0x20f0
movl %r12d, %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0x85ce
jmp 0x4008
movq 0x8(%rbx), %rdx
leaq 0x603b(%rip), %rsi      # 0x9fa9
xorl %edi, %edi
xorl %eax, %eax
callq 0x3b9c
jmp 0x3f81
movq %r15, %rdi
callq 0x40cc
movl %r13d, %r12d
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $-0x1
popq %r12
movl -0x2c(%rbp), %r14d
jmp 0x403a
callq 0x6e1b
movq %rax, %r13
movq %r15, %rdi
movq %rax, %rsi
callq 0x73ce
movl %r12d, %edi
callq 0x7cd8
movl %r12d, %edi
callq 0x7d34
movl %r12d, %edi
movq %r15, %rsi
movq %r13, %rdx
movq -0x38(%rbp), %r14
movq %r14, %rcx
callq 0x7d90
movl %r12d, %edi
movq %r15, %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0x7f85
leaq 0x21d1(%rip), %rsi      # 0x61c4
movq %r13, %rdi
callq 0x2b58
movq %r13, %rdi
callq 0x2986
callq 0x62f5
movl -0x2c(%rbp), %r14d
movl %r12d, %edi
movq -0x40(%rbp), %rsi
callq 0x3afc
movq -0x38(%rbp), %rdi
callq 0x21d0
movl %r12d, %edi
callq 0x20e0
xorl %r12d, %r12d
cmpl $-0x1, %eax
sete %r12b
negl %r12d
pushq $0x1
popq %r13
movq %r15, %rdi
callq 0x40cc
movl %r14d, %edi
callq 0x20e0
cmpl $-0x1, %eax
jne 0x3f84
movq 0x8(%rbx), %rdx
leaq 0x5f5a(%rip), %rsi      # 0x9fb8
jmp 0x3f6e
nop