// File: /workspace/github_c_makefile_star2_O2/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 0x1caa
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
cmpq $0x10, %r14
je 0x198a
movq 0x1f8(%rbx,%r14,8), %rdi
callq 0x1cab
incq %r14
jmp 0x1972
cmpq $0x0, 0x280(%rbx)
je 0x19c5
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x280(%rbx), %rdi
cmpq $0x100, %r15            # imm = 0x100
je 0x19c0
movq (%rdi,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1cc6
incq %r15
jmp 0x199a
callq 0x1040
cmpq $0x0, 0x278(%rbx)
je 0x19f5
xorl %r14d, %r14d
movq 0x278(%rbx), %rdi
cmpq $0x100, %r14            # imm = 0x100
je 0x19f0
movq (%rdi,%r14,8), %rdi
callq 0x1cf4
incq %r14
jmp 0x19d2
callq 0x1040
cmpq $0x0, 0x298(%rbx)
je 0x1a30
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x298(%rbx), %rdi
cmpq $0x100, %r15            # imm = 0x100
je 0x1a2b
movq (%rdi,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1cc6
incq %r15
jmp 0x1a05
callq 0x1040
cmpq $0x0, 0x290(%rbx)
je 0x1a60
xorl %r14d, %r14d
movq 0x290(%rbx), %rdi
cmpq $0x100, %r14            # imm = 0x100
je 0x1a5b
movq (%rdi,%r14,8), %rdi
callq 0x1cf4
incq %r14
jmp 0x1a3d
callq 0x1040
cmpq $0x0, 0x2b0(%rbx)
je 0x1a9b
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x2b0(%rbx), %rdi
cmpq $0x100, %r15            # imm = 0x100
je 0x1a96
movq (%rdi,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1cc6
incq %r15
jmp 0x1a70
callq 0x1040
cmpq $0x0, 0x2a8(%rbx)
je 0x1acb
xorl %r14d, %r14d
movq 0x2a8(%rbx), %rdi
cmpq $0x100, %r14            # imm = 0x100
je 0x1ac6
movq (%rdi,%r14,8), %rdi
callq 0x1cf4
incq %r14
jmp 0x1aa8
callq 0x1040
cmpq $0x0, 0x2c8(%rbx)
je 0x1b06
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x2c8(%rbx), %rdi
cmpq $0x100, %r15            # imm = 0x100
je 0x1b01
movq (%rdi,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1cc6
incq %r15
jmp 0x1adb
callq 0x1040
cmpq $0x0, 0x2c0(%rbx)
je 0x1b36
xorl %r14d, %r14d
movq 0x2c0(%rbx), %rdi
cmpq $0x100, %r14            # imm = 0x100
je 0x1b31
movq (%rdi,%r14,8), %rdi
callq 0x1cf4
incq %r14
jmp 0x1b13
callq 0x1040
cmpq $0x0, 0x2e0(%rbx)
je 0x1b71
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x2e0(%rbx), %rdi
cmpq $0x100, %r15            # imm = 0x100
je 0x1b6c
movq (%rdi,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1cc6
incq %r15
jmp 0x1b46
callq 0x1040
cmpq $0x0, 0x2d8(%rbx)
je 0x1ba1
xorl %r14d, %r14d
movq 0x2d8(%rbx), %rdi
cmpq $0x100, %r14            # imm = 0x100
je 0x1b9c
movq (%rdi,%r14,8), %rdi
callq 0x1cf4
incq %r14
jmp 0x1b7e
callq 0x1040
cmpq $0x0, 0x2f8(%rbx)
je 0x1bdc
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x2f8(%rbx), %rdi
cmpq $0x100, %r15            # imm = 0x100
je 0x1bd7
movq (%rdi,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1cc6
incq %r15
jmp 0x1bb1
callq 0x1040
cmpq $0x0, 0x2f0(%rbx)
je 0x1c0c
xorl %r14d, %r14d
movq 0x2f0(%rbx), %rdi
cmpq $0x100, %r14            # imm = 0x100
je 0x1c07
movq (%rdi,%r14,8), %rdi
callq 0x1cf4
incq %r14
jmp 0x1be9
callq 0x1040
cmpq $0x0, 0x310(%rbx)
je 0x1c47
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x310(%rbx), %rdi
cmpq $0x100, %r15            # imm = 0x100
je 0x1c42
movq (%rdi,%r15,8), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1cc6
incq %r15
jmp 0x1c1c
callq 0x1040
cmpq $0x0, 0x308(%rbx)
je 0x1c77
xorl %r14d, %r14d
movq 0x308(%rbx), %rdi
cmpq $0x100, %r14            # imm = 0x100
je 0x1c72
movq (%rdi,%r14,8), %rdi
callq 0x1cf4
incq %r14
jmp 0x1c54
callq 0x1040
movq 0x1d0(%rbx), %rdi
callq 0x1d52
movq 0x20(%rbx), %rdi
callq 0x1d81
movq 0x28(%rbx), %rdi
callq 0x745a
movq 0x10(%rbx), %rdi
callq 0x1040
addq $0x90, %rsp
popq %rbx
popq %r14
popq %r15
retq