// File: /workspace/github_c_makefile_star2_O1/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 0x1ccd
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 0x1cce
incq %r14
cmpq $0x10, %r14
jne 0x194c
cmpq $0x0, 0x280(%rbx)
je 0x19a2
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x280(%rbx), %rax
movq (%rax,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1ce9
incq %r15
cmpq $0x100, %r15            # imm = 0x100
jne 0x1972
movq 0x280(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x278(%rbx)
je 0x19d7
xorl %r14d, %r14d
movq 0x278(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x1d1a
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x19af
movq 0x278(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x298(%rbx)
je 0x1a17
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x298(%rbx), %rax
movq (%rax,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1ce9
incq %r15
cmpq $0x100, %r15            # imm = 0x100
jne 0x19e7
movq 0x298(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x290(%rbx)
je 0x1a4c
xorl %r14d, %r14d
movq 0x290(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x1d1a
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x1a24
movq 0x290(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x2b0(%rbx)
je 0x1a8c
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x2b0(%rbx), %rax
movq (%rax,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1ce9
incq %r15
cmpq $0x100, %r15            # imm = 0x100
jne 0x1a5c
movq 0x2b0(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x2a8(%rbx)
je 0x1ac1
xorl %r14d, %r14d
movq 0x2a8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x1d1a
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x1a99
movq 0x2a8(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x2c8(%rbx)
je 0x1b01
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x2c8(%rbx), %rax
movq (%rax,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1ce9
incq %r15
cmpq $0x100, %r15            # imm = 0x100
jne 0x1ad1
movq 0x2c8(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x2c0(%rbx)
je 0x1b36
xorl %r14d, %r14d
movq 0x2c0(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x1d1a
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x1b0e
movq 0x2c0(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x2e0(%rbx)
je 0x1b76
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x2e0(%rbx), %rax
movq (%rax,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1ce9
incq %r15
cmpq $0x100, %r15            # imm = 0x100
jne 0x1b46
movq 0x2e0(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x2d8(%rbx)
je 0x1bab
xorl %r14d, %r14d
movq 0x2d8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x1d1a
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x1b83
movq 0x2d8(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x2f8(%rbx)
je 0x1beb
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x2f8(%rbx), %rax
movq (%rax,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1ce9
incq %r15
cmpq $0x100, %r15            # imm = 0x100
jne 0x1bbb
movq 0x2f8(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x2f0(%rbx)
je 0x1c20
xorl %r14d, %r14d
movq 0x2f0(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x1d1a
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x1bf8
movq 0x2f0(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x310(%rbx)
je 0x1c60
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x310(%rbx), %rax
movq (%rax,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1ce9
incq %r15
cmpq $0x100, %r15            # imm = 0x100
jne 0x1c30
movq 0x310(%rbx), %rdi
callq 0x1040
cmpq $0x0, 0x308(%rbx)
je 0x1c95
xorl %r14d, %r14d
movq 0x308(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x1d1a
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x1c6d
movq 0x308(%rbx), %rdi
callq 0x1040
movq 0x1d0(%rbx), %rdi
callq 0x1d78
movq 0x20(%rbx), %rdi
callq 0x1da7
movq 0x28(%rbx), %rdi
callq 0x80ff
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x1cc1
callq 0x1040
addq $0x90, %rsp
popq %rbx
popq %r14
popq %r15
retq