// File: /workspace/github_c_makefile_star2_O0/MaoKo[P]FGFX/fgfp/src/fgfp.c
// Function: gen_fgfp_file
static int
gen_fgfp_file(cfg_t const* cfg, char const* base_file) {
	char const* header = strjoin(base_file, ".h");
	int filde = open_new_file(header);

	if (filde == -1)
		{ return (ERROR); }

	gen_require_macro(filde, base_file);

	gen_location_token(filde, cfg);
	gen_non_terminal_enum(filde, cfg);	

	gen_production_enum(filde, cfg);

	gen_rhs_table(filde, cfg, header);	
	gen_lhs_table(filde, cfg, header);	

	gen_ll_useful_macro(filde, cfg);

	bool ll1 = false;
	if (is_ll1(cfg)) {
		ll1 = true;
		vector_t* ll1_table = build_ll1_table(cfg);

		gen_ll_table(filde, cfg, ll1_table, header);
		foreach_vector(ll1_table, &del_trans_list);

		del_vector(ll1_table);
	}

	if (ll1)
		{ PRINT_IF_0(filde); }

	vector_t* lr1_states = build_lalr1_states(cfg);
	compute_reduce_op(cfg, lr1_states);

	gen_action_enum(filde);
	gen_lr_useful_macro(filde);

	gen_action_table(filde, cfg, lr1_states, header);
	gen_goto_table(filde, cfg, lr1_states, header);

//	print_report(cfg, lr1_states);

	foreach_vector(lr1_states, &del_lr1_state);
	del_vector(lr1_states);

	del_lalr_record();

	if (ll1) {
		PRINT_END_IF(filde);
		gen_synchronizing_token(filde, cfg, header);
	}

	gen_endif(filde, base_file);

	FREE(header);
	if (close(filde) == -1)
		{ return (ERROR); }

	return (DONE);	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x7de6(%rip), %rsi      # 0xc391
callq 0x3800
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x3e70
movl %eax, -0x24(%rbp)
cmpl $-0x1, -0x24(%rbp)
jne 0x45d2
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x475f
movl -0x24(%rbp), %edi
movq -0x18(%rbp), %rsi
callq 0x4070
movl -0x24(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0xb720
movl -0x24(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0xb930
movl -0x24(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0xbaf0
movl -0x24(%rbp), %edi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xbbb0
movl -0x24(%rbp), %edi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xbca0
movl -0x24(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0xb0a0
movb $0x0, -0x25(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7f60
testb $0x1, %al
jne 0x4641
jmp 0x467f
movb $0x1, -0x25(%rbp)
movq -0x10(%rbp), %rdi
callq 0x8010
movq %rax, -0x30(%rbp)
movl -0x24(%rbp), %edi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0xb130
movq -0x30(%rbp), %rdi
leaq -0xa91(%rip), %rsi      # 0x3be0
callq 0x23a0
movq -0x30(%rbp), %rdi
callq 0x1ff0
testb $0x1, -0x25(%rbp)
je 0x4696
movl -0x24(%rbp), %edi
leaq 0x7d05(%rip), %rsi      # 0xc394
movb $0x0, %al
callq 0x10d0
movq -0x10(%rbp), %rdi
callq 0x92f0
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x9e10
movl -0x24(%rbp), %edi
callq 0xb290
movl -0x24(%rbp), %edi
callq 0xb300
movl -0x24(%rbp), %edi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0xb370
movl -0x24(%rbp), %edi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0xb5d0
movq -0x38(%rbp), %rdi
leaq 0x3bed(%rip), %rsi      # 0x82e0
callq 0x23a0
movq -0x38(%rbp), %rdi
callq 0x1ff0
callq 0x8530
testb $0x1, -0x25(%rbp)
je 0x472d
movl -0x24(%rbp), %edi
leaq 0x7c86(%rip), %rsi      # 0xc39c
movb $0x0, %al
callq 0x10d0
movl -0x24(%rbp), %edi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xbdb0
movl -0x24(%rbp), %edi
movq -0x18(%rbp), %rsi
callq 0x4100
movq -0x20(%rbp), %rdi
callq 0x1190
movl -0x24(%rbp), %edi
callq 0x10c0
cmpl $-0x1, %eax
jne 0x4758
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x475f
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)