// File: /workspace/github_c_makefile_star2_O1/MikeGray-APH[P]LibLouisAPH/source/compile.c
// Function: table_compile_from_file
struct table* table_compile_from_file(const char *file_name)
{
	FILE *file;
	struct table table_auto;
	char attrs_chars_default[] = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
	int file_name_len, i;

	file = fopen(file_name, "r");
	if(!file)
		return NULL;

	table = &table_auto;
	table_init(table);

	file_name_len = strlen(file_name);
	table->file_name = MALLOC(file_name_len + 1);
	LOG_ALLOCATE_FAIL_RETURN_NULL(table->file_name)
	strcpy(table->file_name, file_name);

	rule_attrs = 0;
	rule_filter_forward =
	rule_filter_backward = NULL;
	variables = NULL;
	macros = NULL;
	var_enum = 0;
	macro_depth = 0;
	include_depth = -1;

	/*   set defaults   */
	table->marker_user      = TABLE_MARKER_USER;
	table->marker_begin     = TABLE_MARKER_BEGIN;
	table->marker_end       = TABLE_MARKER_END;
	table->marker_modifier  = TABLE_MARKER_MODIFIER;
	table->marker_hard      = TABLE_MARKER_HARD;
	table->marker_soft      = TABLE_MARKER_SOFT;
	table->marker_internal  = TABLE_MARKER_INTERNAL;
	for(i = 0; i < 32; i++)
		table->attrs_chars[i] = attrs_chars_default[i];

	file_read(file, table->file_name);
	fclose(file);

	variable_free(variables);
	variables = NULL;
	macro_free(macros);
	macros = NULL;

	/*   this could happen if file_name was a directory
	     or an empty file   */
	if(!table_file_lines[0])
	{
		FREE(table->file_name);
		return NULL;
	}

	table = table_allocate();
	*table = table_auto;

#ifdef DEBUG

	if(!table->nocontract_set)
	{
		ASSERT(!table->nocontract.begin_len)
		ASSERT(!table->nocontract.end_len)
		ASSERT(!table->nocontract.word_len)
		ASSERT(!table->nocontract.term_len)
		ASSERT(!table->nocontract.symbol_len)
	}
	if(!table->capital_set)
	{
		ASSERT(!table->capital.begin_len)
		ASSERT(!table->capital.end_len)
		ASSERT(!table->capital.word_len)
		ASSERT(!table->capital.term_len)
		ASSERT(!table->capital.symbol_len)
	}
	if(!table->numeric_set)
	{
		ASSERT(!table->numeric.begin_len)
		ASSERT(!table->numeric.end_len)
		ASSERT(!table->numeric.word_len)
		ASSERT(!table->numeric.term_len)
		ASSERT(!table->numeric.symbol_len)
	}

#endif

	return table;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x320, %rsp            # imm = 0x320
movq %rdi, %r14
leaq 0x10f44(%rip), %rsi     # 0x13d3e
callq 0x11b0
testq %rax, %rax
je 0x300f
movq %rax, %rbx
movq %rsp, %rdi
movq %rdi, 0x1536b(%rip)     # 0x18180
callq 0x1904
movq %r14, %rdi
callq 0x10b0
incl %eax
movslq %eax, %rdi
callq 0x1180
movq 0x1534d(%rip), %r15     # 0x18180
movq %rax, 0x10(%r15)
testq %rax, %rax
je 0x2fdc
movq %rax, %rdi
movq %r14, %rsi
callq 0x1080
xorl %r14d, %r14d
movl %r14d, 0x15333(%rip)    # 0x18188
movq %r14, 0x15334(%rip)     # 0x18190
movq %r14, 0x15335(%rip)     # 0x18198
movq %r14, 0x15336(%rip)     # 0x181a0
movq %r14, 0x15337(%rip)     # 0x181a8
movl %r14d, 0x15338(%rip)    # 0x181b0
movl %r14d, 0x15335(%rip)    # 0x181b4
movl $0xffffffff, 0x1532f(%rip) # imm = 0xFFFFFFFF
movabsq $-0xffb0ffc0ffd0fff, %rax # imm = 0xF004F003F002F001
movq %rax, 0x1e8(%r15)
movl $0xf006f005, 0x1f0(%r15) # imm = 0xF006F005
movw $0xf007, 0x1f4(%r15)    # imm = 0xF007
movaps 0x103ca(%rip), %xmm0    # 0x13280
movups %xmm0, 0x30(%r15)
movaps 0x103ce(%rip), %xmm0    # 0x13290
movups %xmm0, 0x40(%r15)
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0x3021
movq %rbx, %rdi
callq 0x10a0
movq 0x152be(%rip), %rdi     # 0x181a0
callq 0x34a8
movq %r14, 0x152b2(%rip)     # 0x181a0
movq 0x152b3(%rip), %rdi     # 0x181a8
callq 0x34d7
movq %r14, 0x152a7(%rip)     # 0x181a8
cmpl %r14d, 0x152b8(%rip)    # 0x181c0
je 0x2fff
callq 0x1dec
movq %rax, %rbx
movq %rax, 0x15263(%rip)     # 0x18180
movq %rsp, %rsi
movl $0x320, %edx            # imm = 0x320
movq %rax, %rdi
callq 0x1170
cmpl $0x0, 0x1d8(%rbx)
jne 0x2f6b
cmpl $0x0, 0xa4(%rbx)
jne 0x2fd7
cmpl $0x0, 0xa8(%rbx)
jne 0x2fd7
cmpl $0x0, 0xac(%rbx)
jne 0x2fd7
cmpl $0x0, 0xb0(%rbx)
jne 0x2fd7
cmpl $0x0, 0xb4(%rbx)
jne 0x2fd7
cmpl $0x0, 0x1dc(%rbx)
jne 0x2fa1
cmpl $0x0, 0x124(%rbx)
jne 0x2fd7
cmpl $0x0, 0x128(%rbx)
jne 0x2fd7
cmpl $0x0, 0x12c(%rbx)
jne 0x2fd7
cmpl $0x0, 0x130(%rbx)
jne 0x2fd7
cmpl $0x0, 0x134(%rbx)
jne 0x2fd7
cmpl $0x0, 0x1e0(%rbx)
jne 0x3011
cmpl $0x0, 0x1a4(%rbx)
jne 0x2fd7
cmpl $0x0, 0x1a8(%rbx)
jne 0x2fd7
cmpl $0x0, 0x1ac(%rbx)
jne 0x2fd7
cmpl $0x0, 0x1b0(%rbx)
jne 0x2fd7
cmpl $0x0, 0x1b4(%rbx)
je 0x3011
callq 0x1060
leaq 0x10211(%rip), %rsi     # 0x131f4
leaq 0x102b7(%rip), %rdx     # 0x132a1
xorl %ebx, %ebx
movl $0x7, %edi
movl $0x847, %ecx            # imm = 0x847
xorl %eax, %eax
callq 0xa36c
jmp 0x3011
movq 0x1517a(%rip), %rax     # 0x18180
movq 0x10(%rax), %rdi
callq 0x1040
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x320, %rsp            # imm = 0x320
popq %rbx
popq %r14
popq %r15
retq