// File: /workspace/github_c_makefile_star2_O3/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 0x110b4(%rip), %rsi     # 0x13e0e
callq 0x11c0
testq %rax, %rax
je 0x2f6f
movq %rax, %rbx
movq %rsp, %rdi
movq %rdi, 0x1540b(%rip)     # 0x18180
callq 0x1958
movq %r14, %rdi
callq 0x10b0
incl %eax
movslq %eax, %rdi
callq 0x1190
movq 0x153ed(%rip), %r15     # 0x18180
movq %rax, 0x10(%r15)
testq %rax, %rax
je 0x2f3c
movq %rax, %rdi
movq %r14, %rsi
callq 0x1080
xorl %r14d, %r14d
movl %r14d, 0x153d3(%rip)    # 0x18188
movq %r14, 0x153d4(%rip)     # 0x18190
movq %r14, 0x153d5(%rip)     # 0x18198
movq %r14, 0x153d6(%rip)     # 0x181a0
movq %r14, 0x153d7(%rip)     # 0x181a8
movl %r14d, 0x153d8(%rip)    # 0x181b0
movl %r14d, 0x153d5(%rip)    # 0x181b4
movl $0xffffffff, 0x153cf(%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 0x1050a(%rip), %xmm0    # 0x13320
movups %xmm0, 0x30(%r15)
movaps 0x1050e(%rip), %xmm0    # 0x13330
movups %xmm0, 0x40(%r15)
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0x2f81
movq %rbx, %rdi
callq 0x10a0
movq 0x1535e(%rip), %rdi     # 0x181a0
callq 0x3436
movq %r14, 0x15352(%rip)     # 0x181a0
movq 0x15353(%rip), %rdi     # 0x181a8
callq 0x3465
movq %r14, 0x15347(%rip)     # 0x181a8
cmpl %r14d, 0x15358(%rip)    # 0x181c0
je 0x2f5f
callq 0x1e5a
movq %rax, %rbx
movq %rax, 0x15303(%rip)     # 0x18180
movq %rsp, %rsi
movl $0x320, %edx            # imm = 0x320
movq %rax, %rdi
callq 0x1180
cmpl $0x0, 0x1d8(%rbx)
jne 0x2ecb
cmpl $0x0, 0xa4(%rbx)
jne 0x2f37
cmpl $0x0, 0xa8(%rbx)
jne 0x2f37
cmpl $0x0, 0xac(%rbx)
jne 0x2f37
cmpl $0x0, 0xb0(%rbx)
jne 0x2f37
cmpl $0x0, 0xb4(%rbx)
jne 0x2f37
cmpl $0x0, 0x1dc(%rbx)
jne 0x2f01
cmpl $0x0, 0x124(%rbx)
jne 0x2f37
cmpl $0x0, 0x128(%rbx)
jne 0x2f37
cmpl $0x0, 0x12c(%rbx)
jne 0x2f37
cmpl $0x0, 0x130(%rbx)
jne 0x2f37
cmpl $0x0, 0x134(%rbx)
jne 0x2f37
cmpl $0x0, 0x1e0(%rbx)
jne 0x2f71
cmpl $0x0, 0x1a4(%rbx)
jne 0x2f37
cmpl $0x0, 0x1a8(%rbx)
jne 0x2f37
cmpl $0x0, 0x1ac(%rbx)
jne 0x2f37
cmpl $0x0, 0x1b0(%rbx)
jne 0x2f37
cmpl $0x0, 0x1b4(%rbx)
je 0x2f71
callq 0x1060
leaq 0x102f9(%rip), %rsi     # 0x1323c
leaq 0x103f7(%rip), %rdx     # 0x13341
xorl %ebx, %ebx
movl $0x7, %edi
movl $0x847, %ecx            # imm = 0x847
xorl %eax, %eax
callq 0xa278
jmp 0x2f71
movq 0x1521a(%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