// File: /workspace/github_c_makefile_star2_O1/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 0x4379
movq %rsi, %rbx
movq 0x8(%rsi), %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x2180
cmpl $-0x1, %eax
je 0x428c
movl %eax, %r14d
movl %eax, %edi
callq 0x44f3
testq %rax, %rax
je 0x4379
movq %rax, %r15
movq %rax, %rdi
callq 0x464d
movq %r15, %rdi
callq 0x4817
cmpl $-0x1, %eax
je 0x42a5
movq 0x8(%rbx), %rdi
callq 0x3b41
movq %rax, %r13
leaq 0x5eba(%rip), %rsi      # 0x9fe1
movq %rax, %rdi
callq 0x3a92
movq %rax, -0x30(%rbp)
movq %rax, %rdi
callq 0x3d8e
cmpl $-0x1, %eax
je 0x42b2
movl %eax, %r12d
movl %eax, %edi
movq %r13, -0x40(%rbp)
movq %r13, %rsi
callq 0x3ef9
movl %r12d, %edi
movq %r15, %rsi
callq 0x892c
movl %r12d, %edi
movq %r15, %rsi
callq 0x8ada
movl %r12d, %edi
movq %r15, %rsi
callq 0x8c51
movl %r12d, %edi
movq %r15, %rsi
movq -0x30(%rbp), %r13
movq %r13, %rdx
callq 0x8cf9
movl %r12d, %edi
movq %r15, %rsi
movq %r13, %rdx
callq 0x8dbe
movl %r12d, %edi
movq %r15, %rsi
callq 0x83ec
movq %r15, %rdi
callq 0x65dc
movq %r15, %rdi
testb %al, %al
je 0x42bd
callq 0x664b
movq %rax, %r13
movl %r12d, %edi
movq %r15, %rsi
movq %rax, %rdx
movq -0x30(%rbp), %rcx
callq 0x8453
leaq -0x55f(%rip), %rsi      # 0x3c76
movq %r13, %rdi
callq 0x2d75
movq %r13, %rdi
callq 0x2b9e
leaq 0x5df8(%rip), %rsi      # 0x9fe4
movl %r12d, %edi
xorl %eax, %eax
callq 0x20f0
movq %r15, %rdi
callq 0x74fe
movq %rax, %r13
movq %r15, %rdi
movq %rax, %rsi
movq %rax, -0x38(%rbp)
callq 0x7bbd
movl %r12d, %edi
callq 0x8578
movl %r12d, %edi
callq 0x85d4
movl %r12d, %edi
movq %r15, %rsi
movq %r13, %rdx
movq -0x30(%rbp), %r13
movq %r13, %rcx
callq 0x8630
movl %r12d, %edi
movq %r15, %rsi
movq -0x38(%rbp), %rdx
movq %r13, %rcx
callq 0x880a
leaq 0x258a(%rip), %rsi      # 0x67d8
movq -0x38(%rbp), %r13
movq %r13, %rdi
callq 0x2d75
movq %r13, %rdi
callq 0x2b9e
callq 0x6941
leaq 0x5d7e(%rip), %rsi      # 0x9fec
movl %r12d, %edi
xorl %eax, %eax
callq 0x20f0
movl %r12d, %edi
movq %r15, %rsi
movq -0x30(%rbp), %rdx
callq 0x8e9e
jmp 0x4320
movq 0x8(%rbx), %rdx
leaq 0x5d2b(%rip), %rsi      # 0x9fc2
xorl %edi, %edi
xorl %eax, %eax
callq 0x4020
jmp 0x4379
movq %r15, %rdi
callq 0x43fd
jmp 0x4379
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0x434a
callq 0x74fe
movq %rax, %r13
movq %r15, %rdi
movq %rax, %rsi
callq 0x7bbd
movl %r12d, %edi
callq 0x8578
movl %r12d, %edi
callq 0x85d4
movl %r12d, %edi
movq %r15, %rsi
movq %r13, %rdx
movq -0x30(%rbp), %rcx
callq 0x8630
movl %r12d, %edi
movq %r15, %rsi
movq %r13, %rdx
movq -0x30(%rbp), %rcx
callq 0x880a
leaq 0x24cd(%rip), %rsi      # 0x67d8
movq %r13, %rdi
callq 0x2d75
movq %r13, %rdi
callq 0x2b9e
callq 0x6941
movl %r12d, %edi
movq -0x40(%rbp), %rsi
callq 0x3f6b
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 0x43fd
movl %r14d, %edi
callq 0x20e0
cmpl $-0x1, %eax
jne 0x4379
movq 0x8(%rbx), %rdx
leaq 0x5c67(%rip), %rsi      # 0x9fd1
xorl %edi, %edi
xorl %eax, %eax
callq 0x4020
movl $0x1, %r12d
movl %r12d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop