// File: /workspace/github_c_makefile_star2_O3/MikeGray-APH[P]LibLouisAPH/source/table.c
// Function: table_fini
void table_fini(struct table *table)
{
	struct rule rule_auto;
	int i;

	if(!table)
		return;

	memset(&rule_auto, 0, sizeof(struct rule));

	for(i = 0; i < TABLE_UNICHAR_HASH_SIZE; i++)
		character_free(table->character_hash[i]);

#ifdef TABLE_ALLOCATE_HASHES

	if(table->init_dots_hash)
	{
		for(i = 0; i < TABLE_DOTS_HASH_SIZE; i++)
		{
			rule_auto.dots_nxt = table->init_dots_hash[i];
			rule_free_backward(&rule_auto);
		}
		FREE(table->init_dots_hash);
	}
	if(table->init_chars_hash)
	{
		for(i = 0; i < TABLE_INIT_HASH_SIZE; i++)
			rule_free(table->init_chars_hash[i]);
		FREE(table->init_chars_hash);
	}

	if(table->premode_dots_hash)
	{
		for(i = 0; i < TABLE_DOTS_HASH_SIZE; i++)
		{
			rule_auto.dots_nxt = table->premode_dots_hash[i];
			rule_free_backward(&rule_auto);
		}
		FREE(table->premode_dots_hash);
	}
	if(table->premode_chars_hash)
	{
		for(i = 0; i < TABLE_PREMODE_HASH_SIZE; i++)
			rule_free(table->premode_chars_hash[i]);
		FREE(table->premode_chars_hash);
	}

	if(table->postmode_dots_hash)
	{
		for(i = 0; i < TABLE_DOTS_HASH_SIZE; i++)
		{
			rule_auto.dots_nxt = table->postmode_dots_hash[i];
			rule_free_backward(&rule_auto);
		}
		FREE(table->postmode_dots_hash);
	}
	if(table->postmode_chars_hash)
	{
		for(i = 0; i < TABLE_POSTMODE_HASH_SIZE; i++)
			rule_free(table->postmode_chars_hash[i]);
		FREE(table->postmode_chars_hash);
	}

	if(table->pretrans_dots_hash)
	{
		for(i = 0; i < TABLE_DOTS_HASH_SIZE; i++)
		{
			rule_auto.dots_nxt = table->pretrans_dots_hash[i];
			rule_free_backward(&rule_auto);
		}
		FREE(table->pretrans_dots_hash);
	}
	if(table->pretrans_chars_hash)
	{
		for(i = 0; i < TABLE_PRETRANS_HASH_SIZE; i++)
			rule_free(table->pretrans_chars_hash[i]);
		FREE(table->pretrans_chars_hash);
	}

	if(table->trans_dots_hash)
	{
		for(i = 0; i < TABLE_DOTS_HASH_SIZE; i++)
		{
			rule_auto.dots_nxt = table->trans_dots_hash[i];
			rule_free_backward(&rule_auto);
		}
		FREE(table->trans_dots_hash);
	}
	if(table->trans_chars_hash)
	{
		for(i = 0; i < TABLE_TRANS_HASH_SIZE; i++)
			rule_free(table->trans_chars_hash[i]);
		FREE(table->trans_chars_hash);
	}

	if(table->posttrans_dots_hash)
	{
		for(i = 0; i < TABLE_DOTS_HASH_SIZE; i++)
		{
			rule_auto.dots_nxt = table->posttrans_dots_hash[i];
			rule_free_backward(&rule_auto);
		}
		FREE(table->posttrans_dots_hash);
	}
	if(table->posttrans_chars_hash)
	{
		for(i = 0; i < TABLE_POSTTRANS_HASH_SIZE; i++)
			rule_free(table->posttrans_chars_hash[i]);
		FREE(table->posttrans_chars_hash);
	}

	if(table->fini_dots_hash)
	{
		for(i = 0; i < TABLE_DOTS_HASH_SIZE; i++)
		{
			rule_auto.dots_nxt = table->fini_dots_hash[i];
			rule_free_backward(&rule_auto);
		}
		FREE(table->fini_dots_hash);
	}
	if(table->fini_chars_hash)
	{
		for(i = 0; i < TABLE_FINI_HASH_SIZE; i++)
			rule_free(table->fini_chars_hash[i]);
		FREE(table->fini_chars_hash);
	}

#else

	for(i = 0; i < TABLE_DOTS_HASH_SIZE; i++)
	{
		rule_auto.dots_nxt = table->init_dots_hash[i];
		rule_free_backward(&rule_auto);
	}
	for(i = 0; i < TABLE_INIT_HASH_SIZE; i++)
		rule_free(table->init_chars_hash[i]);

	for(i = 0; i < TABLE_DOTS_HASH_SIZE; i++)
	{
		rule_auto.dots_nxt = table->premode_dots_hash[i];
		rule_free_backward(&rule_auto);
	}
	for(i = 0; i < TABLE_PREMODE_HASH_SIZE; i++)
		rule_free(table->premode_chars_hash[i]);

	for(i = 0; i < TABLE_DOTS_HASH_SIZE; i++)
	{
		rule_auto.dots_nxt = table->postmode_dots_hash[i];
		rule_free_backward(&rule_auto);
	}
	for(i = 0; i < TABLE_POSTMODE_HASH_SIZE; i++)
		rule_free(table->postmode_chars_hash[i]);

	for(i = 0; i < TABLE_DOTS_HASH_SIZE; i++)
	{
		rule_auto.dots_nxt = table->pretrans_dots_hash[i];
		rule_free_backward(&rule_auto);
	}
	for(i = 0; i < TABLE_PRETRANS_HASH_SIZE; i++)
		rule_free(table->pretrans_chars_hash[i]);

	for(i = 0; i < TABLE_DOTS_HASH_SIZE; i++)
	{
		rule_auto.dots_nxt = table->trans_dots_hash[i];
		rule_free_backward(&rule_auto);
	}
	for(i = 0; i < TABLE_TRANS_HASH_SIZE; i++)
		rule_free(table->trans_chars_hash[i]);

	for(i = 0; i < TABLE_DOTS_HASH_SIZE; i++)
	{
		rule_auto.dots_nxt = table->posttrans_dots_hash[i];
		rule_free_backward(&rule_auto);
	}
	for(i = 0; i < TABLE_POSTTRANS_HASH_SIZE; i++)
		rule_free(table->posttrans_chars_hash[i]);

	for(i = 0; i < TABLE_DOTS_HASH_SIZE; i++)
	{
		rule_auto.dots_nxt = table->fini_dots_hash[i];
		rule_free_backward(&rule_auto);
	}
	for(i = 0; i < TABLE_FINI_HASH_SIZE; i++)
		rule_free(table->fini_chars_hash[i]);

#endif

	mode_free(table->emphases);
	filter_free(table->filters);
	subpattern_free(table->subpatterns);
	if(table->file_name)
		FREE(table->file_name);
}

// Assembly:
testq %rdi, %rdi
je 0x1d21
pushq %r15
pushq %r14
pushq %rbx
subq $0x90, %rsp
movq %rdi, %rbx
movq %rsp, %rdi
xorl %r14d, %r14d
movl $0x90, %edx
xorl %esi, %esi
callq 0x1110
movq 0x1f8(%rbx,%r14,8), %rdi
callq 0x1d22
incq %r14
cmpq $0x10, %r14
jne 0x19a0
cmpq $0x0, 0x280(%rbx)
je 0x19f6
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x280(%rbx), %rax
movq (%rax,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1d3d
incq %r15
cmpq $0x100, %r15            # imm = 0x100
jne 0x19c6
movq 0x280(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x278(%rbx)
je 0x1a2b
xorl %r14d, %r14d
movq 0x278(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x1d88
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x1a03
movq 0x278(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x298(%rbx)
je 0x1a6b
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x298(%rbx), %rax
movq (%rax,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1d3d
incq %r15
cmpq $0x100, %r15            # imm = 0x100
jne 0x1a3b
movq 0x298(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x290(%rbx)
je 0x1aa0
xorl %r14d, %r14d
movq 0x290(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x1d88
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x1a78
movq 0x290(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x2b0(%rbx)
je 0x1ae0
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x2b0(%rbx), %rax
movq (%rax,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1d3d
incq %r15
cmpq $0x100, %r15            # imm = 0x100
jne 0x1ab0
movq 0x2b0(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x2a8(%rbx)
je 0x1b15
xorl %r14d, %r14d
movq 0x2a8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x1d88
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x1aed
movq 0x2a8(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x2c8(%rbx)
je 0x1b55
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x2c8(%rbx), %rax
movq (%rax,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1d3d
incq %r15
cmpq $0x100, %r15            # imm = 0x100
jne 0x1b25
movq 0x2c8(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x2c0(%rbx)
je 0x1b8a
xorl %r14d, %r14d
movq 0x2c0(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x1d88
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x1b62
movq 0x2c0(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x2e0(%rbx)
je 0x1bca
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x2e0(%rbx), %rax
movq (%rax,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1d3d
incq %r15
cmpq $0x100, %r15            # imm = 0x100
jne 0x1b9a
movq 0x2e0(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x2d8(%rbx)
je 0x1bff
xorl %r14d, %r14d
movq 0x2d8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x1d88
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x1bd7
movq 0x2d8(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x2f8(%rbx)
je 0x1c3f
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x2f8(%rbx), %rax
movq (%rax,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1d3d
incq %r15
cmpq $0x100, %r15            # imm = 0x100
jne 0x1c0f
movq 0x2f8(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x2f0(%rbx)
je 0x1c74
xorl %r14d, %r14d
movq 0x2f0(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x1d88
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x1c4c
movq 0x2f0(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x310(%rbx)
je 0x1cb4
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x310(%rbx), %rax
movq (%rax,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1d3d
incq %r15
cmpq $0x100, %r15            # imm = 0x100
jne 0x1c84
movq 0x310(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x308(%rbx)
je 0x1ce9
xorl %r14d, %r14d
movq 0x308(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x1d88
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x1cc1
movq 0x308(%rbx), %rdi
callq 0x1040
movq 0x1d0(%rbx), %rdi
callq 0x1de6
movq 0x20(%rbx), %rdi
callq 0x1e15
movq 0x28(%rbx), %rdi
callq 0x801c
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x1d15
callq 0x1040
addq $0x90, %rsp
popq %rbx
popq %r14
popq %r15
retq