// File: /workspace/github_c_makefile_star2_O0/MikeGray-APH[P]LibLouisAPH/source/table.c
// Function: table_match_rule
const struct rule* table_match_rule(
	const struct table *table,
	const enum table_hash_type hash_type,
	const enum rule_direction direction,
	const unichar *uchars,
	const int uchars_len,
	const struct rule *at)
{
	switch(hash_type)
	{
#ifdef TABLE_ALLOCATE_HASHES
//NOTE:  this code will actually work whether TABLE_ALLOCATE_HASHES is defined or not

	case TABLE_HASH_INIT:

		if(direction == FORWARD)
			return rule_match_forward((const struct rule* const*)table->init_chars_hash, TABLE_INIT_HASH_SIZE, uchars, uchars_len, at);
		else
			return rule_match_backward((const struct rule* const*)table->init_dots_hash, TABLE_DOTS_HASH_SIZE, uchars, uchars_len, at);

	case TABLE_HASH_PREMODE:

		if(direction == FORWARD)
			return rule_match_forward((const struct rule* const*)table->premode_chars_hash, TABLE_PREMODE_HASH_SIZE, uchars, uchars_len, at);
		else
			return rule_match_backward((const struct rule* const*)table->premode_dots_hash, TABLE_DOTS_HASH_SIZE, uchars, uchars_len, at);

	case TABLE_HASH_POSTMODE:

		if(direction == FORWARD)
			return rule_match_forward((const struct rule* const*)table->postmode_chars_hash, TABLE_POSTMODE_HASH_SIZE, uchars, uchars_len, at);
		else
			return rule_match_backward((const struct rule* const*)table->postmode_dots_hash, TABLE_DOTS_HASH_SIZE, uchars, uchars_len, at);

	case TABLE_HASH_PRETRANS:

		if(direction == FORWARD)
			return rule_match_forward((const struct rule* const*)table->pretrans_chars_hash, TABLE_PRETRANS_HASH_SIZE, uchars, uchars_len, at);
		else
			return rule_match_backward((const struct rule* const*)table->pretrans_dots_hash, TABLE_DOTS_HASH_SIZE, uchars, uchars_len, at);

	case TABLE_HASH_TRANS:

		if(direction == FORWARD)
			return rule_match_forward((const struct rule* const*)table->trans_chars_hash, TABLE_TRANS_HASH_SIZE, uchars, uchars_len, at);
		else
			return rule_match_backward((const struct rule* const*)table->trans_dots_hash, TABLE_DOTS_HASH_SIZE, uchars, uchars_len, at);

	case TABLE_HASH_POSTTRANS:

		if(direction == FORWARD)
			return rule_match_forward((const struct rule* const*)table->posttrans_chars_hash, TABLE_POSTTRANS_HASH_SIZE, uchars, uchars_len, at);
		else
			return rule_match_backward((const struct rule* const*)table->posttrans_dots_hash, TABLE_DOTS_HASH_SIZE, uchars, uchars_len, at);

	case TABLE_HASH_FINI:

		if(direction == FORWARD)
			return rule_match_forward((const struct rule* const*)table->fini_chars_hash, TABLE_FINI_HASH_SIZE, uchars, uchars_len, at);
		else
			return rule_match_backward((const struct rule* const*)table->fini_dots_hash, TABLE_DOTS_HASH_SIZE, uchars, uchars_len, at);

#else

	case TABLE_HASH_INIT:

		if(direction == FORWARD)
			return rule_match_forward((const struct rule* const*)&table->init_chars_hash, TABLE_INIT_HASH_SIZE, uchars, uchars_len, at);
		else
			return rule_match_backward((const struct rule* const*)&table->init_dots_hash, TABLE_DOTS_HASH_SIZE, uchars, uchars_len, at);

	case TABLE_HASH_PREMODE:

		if(direction == FORWARD)
			return rule_match_forward((const struct rule* const*)&table->premode_chars_hash, TABLE_PREMODE_HASH_SIZE, uchars, uchars_len, at);
		else
			return rule_match_backward((const struct rule* const*)&table->premode_dots_hash, TABLE_DOTS_HASH_SIZE, uchars, uchars_len, at);

	case TABLE_HASH_POSTMODE:

		if(direction == FORWARD)
			return rule_match_forward((const struct rule* const*)&table->postmode_chars_hash, TABLE_POSTMODE_HASH_SIZE, uchars, uchars_len, at);
		else
			return rule_match_backward((const struct rule* const*)&table->postmode_dots_hash, TABLE_DOTS_HASH_SIZE, uchars, uchars_len, at);

	case TABLE_HASH_PRETRANS:

		if(direction == FORWARD)
			return rule_match_forward((const struct rule* const*)&table->pretrans_chars_hash, TABLE_PRETRANS_HASH_SIZE, uchars, uchars_len, at);
		else
			return rule_match_backward((const struct rule* const*)&table->pretrans_dots_hash, TABLE_DOTS_HASH_SIZE, uchars, uchars_len, at);

	case TABLE_HASH_TRANS:

		if(direction == FORWARD)
			return rule_match_forward((const struct rule* const*)&table->trans_chars_hash, TABLE_TRANS_HASH_SIZE, uchars, uchars_len, at);
		else
			return rule_match_backward((const struct rule* const*)&table->trans_dots_hash, TABLE_DOTS_HASH_SIZE, uchars, uchars_len, at);

	case TABLE_HASH_POSTTRANS:

		if(direction == FORWARD)
			return rule_match_forward((const struct rule* const*)&table->posttrans_chars_hash, TABLE_POSTTRANS_HASH_SIZE, uchars, uchars_len, at);
		else
			return rule_match_backward((const struct rule* const*)&table->posttrans_dots_hash, TABLE_DOTS_HASH_SIZE, uchars, uchars_len, at);

	case TABLE_HASH_FINI:

		if(direction == FORWARD)
			return rule_match_forward((const struct rule* const*)&table->fini_chars_hash, TABLE_FINI_HASH_SIZE, uchars, uchars_len, at);
		else
			return rule_match_backward((const struct rule* const*)&table->fini_dots_hash, TABLE_DOTS_HASH_SIZE, uchars, uchars_len, at);

#endif

	case TABLE_HASH_NONE:  ;
	}

	log_message(LOG_FATAL, "%s:%d  table_match_rule failed", __FILE__, __LINE__);
	ASSERT(0)
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
movl -0x14(%rbp), %eax
movq %rax, -0x38(%rbp)
subq $0x7, %rax
ja 0x40c4
movq -0x38(%rbp), %rax
leaq 0x1a3fe(%rip), %rcx     # 0x1e258
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x1, -0x18(%rbp)
jne 0x3e92
movq -0x10(%rbp), %rax
movq 0x278(%rax), %rdi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %r8
movl $0x100, %esi            # imm = 0x100
callq 0x4100
movq %rax, -0x8(%rbp)
jmp 0x40e8
movq -0x10(%rbp), %rax
movq 0x280(%rax), %rdi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %r8
movl $0x100, %esi            # imm = 0x100
callq 0x41b0
movq %rax, -0x8(%rbp)
jmp 0x40e8
cmpl $0x1, -0x18(%rbp)
jne 0x3eea
movq -0x10(%rbp), %rax
movq 0x290(%rax), %rdi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %r8
movl $0x100, %esi            # imm = 0x100
callq 0x4100
movq %rax, -0x8(%rbp)
jmp 0x40e8
movq -0x10(%rbp), %rax
movq 0x298(%rax), %rdi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %r8
movl $0x100, %esi            # imm = 0x100
callq 0x41b0
movq %rax, -0x8(%rbp)
jmp 0x40e8
cmpl $0x1, -0x18(%rbp)
jne 0x3f42
movq -0x10(%rbp), %rax
movq 0x2a8(%rax), %rdi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %r8
movl $0x100, %esi            # imm = 0x100
callq 0x4100
movq %rax, -0x8(%rbp)
jmp 0x40e8
movq -0x10(%rbp), %rax
movq 0x2b0(%rax), %rdi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %r8
movl $0x100, %esi            # imm = 0x100
callq 0x41b0
movq %rax, -0x8(%rbp)
jmp 0x40e8
cmpl $0x1, -0x18(%rbp)
jne 0x3f9a
movq -0x10(%rbp), %rax
movq 0x2c0(%rax), %rdi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %r8
movl $0x100, %esi            # imm = 0x100
callq 0x4100
movq %rax, -0x8(%rbp)
jmp 0x40e8
movq -0x10(%rbp), %rax
movq 0x2c8(%rax), %rdi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %r8
movl $0x100, %esi            # imm = 0x100
callq 0x41b0
movq %rax, -0x8(%rbp)
jmp 0x40e8
cmpl $0x1, -0x18(%rbp)
jne 0x3ff2
movq -0x10(%rbp), %rax
movq 0x2d8(%rax), %rdi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %r8
movl $0x100, %esi            # imm = 0x100
callq 0x4100
movq %rax, -0x8(%rbp)
jmp 0x40e8
movq -0x10(%rbp), %rax
movq 0x2e0(%rax), %rdi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %r8
movl $0x100, %esi            # imm = 0x100
callq 0x41b0
movq %rax, -0x8(%rbp)
jmp 0x40e8
cmpl $0x1, -0x18(%rbp)
jne 0x404a
movq -0x10(%rbp), %rax
movq 0x2f0(%rax), %rdi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %r8
movl $0x100, %esi            # imm = 0x100
callq 0x4100
movq %rax, -0x8(%rbp)
jmp 0x40e8
movq -0x10(%rbp), %rax
movq 0x2f8(%rax), %rdi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %r8
movl $0x100, %esi            # imm = 0x100
callq 0x41b0
movq %rax, -0x8(%rbp)
jmp 0x40e8
cmpl $0x1, -0x18(%rbp)
jne 0x409c
movq -0x10(%rbp), %rax
movq 0x308(%rax), %rdi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %r8
movl $0x100, %esi            # imm = 0x100
callq 0x4100
movq %rax, -0x8(%rbp)
jmp 0x40e8
movq -0x10(%rbp), %rax
movq 0x310(%rax), %rdi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movq -0x30(%rbp), %r8
movl $0x100, %esi            # imm = 0x100
callq 0x41b0
movq %rax, -0x8(%rbp)
jmp 0x40e8
jmp 0x40c4
movl $0x7, %edi
leaq 0x1a1f4(%rip), %rsi     # 0x1e2c4
leaq 0x1a1c1(%rip), %rdx     # 0x1e298
movl $0x4b9, %ecx            # imm = 0x4B9
movb $0x0, %al
callq 0xf610
callq 0x1050
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)