// File: /workspace/github_c_makefile_star2_O0/MikeGray-APH[P]LibLouisAPH/source/languages/generic-common.c
// Function: rule_is_filtered
static int rule_is_filtered(const struct translate *translate, const struct rule *rule, const enum rule_direction direction)
{
	if(direction == FORWARD)
	{
		if(!rule->filter_forward)
		{
#ifdef PATTERN_OUTPUT_TRACE
			puts("==========");
			output_hash_type();
			puts("forward = NULL");
			debug_output_line(rule->chars, rule->chars_len);
			debug_output_line(rule->dots, rule->dots_len);
			debug_output_line(translate->input, translate->input_len);
			for(int i = 0; i < translate->input_crs; i++)
				printf(" ");
			puts("^");
#endif
			return 0;
		}

		if(rule->filter_forward->before)
		{
#ifdef PATTERN_OUTPUT_TRACE
			puts("==========");
			output_hash_type();
			puts("forward-before");
			debug_output_line(rule->filter_forward->name, rule->filter_forward->name_len);
			debug_output_line(rule->chars, rule->chars_len);
			debug_output_line(rule->dots, rule->dots_len);
			debug_output_line(translate->input, translate->input_len);
			for(int i = 0; i < translate->input_crs; i++)
				printf(" ");
			puts("^");
#endif
			if(!pattern_check(translate, translate->input, translate->input_crs - 1, -1, -1, rule->filter_forward->before, NULL, translate->tables[translate->table_crs]->subpatterns))
				return 1;
		}

		if(rule->filter_forward->after)
		{
#ifdef PATTERN_OUTPUT_TRACE
			puts("==========");
			output_hash_type();
			puts("forward-after");
			debug_output_line(rule->filter_forward->name, rule->filter_forward->name_len);
			debug_output_line(rule->chars, rule->chars_len);
			debug_output_line(rule->dots, rule->dots_len);
			debug_output_line(translate->input, translate->input_len);
			for(int i = 0; i < translate->input_crs; i++)
				printf(" ");
			puts("^");
#endif
			if(!pattern_check(translate, translate->input, translate->input_crs + rule->chars_len, translate->input_len, 1, rule->filter_forward->after, NULL, translate->tables[translate->table_crs]->subpatterns))
				return 1;
		}
	}
	else
	{
		ASSERT(direction == BACKWARD)

		if(!rule->filter_backward)
		{
#ifdef PATTERN_OUTPUT_TRACE
			puts("==========");
			output_hash_type();
			puts("backward = NULL");
			debug_output_line(rule->chars, rule->chars_len);
			debug_output_line(rule->dots, rule->dots_len);
			debug_output_line(translate->input, translate->input_len);
			for(int i = 0; i < translate->input_crs; i++)
				printf(" ");
			puts("^");
#endif
			return 0;
		}

		if(rule->filter_backward->before)
		{
#ifdef PATTERN_OUTPUT_TRACE
			puts("==========");
			output_hash_type();
			puts("backward-before");
			debug_output_line(rule->filter_backward->name, rule->filter_backward->name_len);
			debug_output_line(rule->chars, rule->chars_len);
			debug_output_line(rule->dots, rule->dots_len);
			debug_output_line(translate->input, translate->input_len);
			for(int i = 0; i < translate->input_crs; i++)
				printf(" ");
			puts("^");
#endif
			if(!pattern_check(translate, translate->input, translate->input_crs - 1, -1, -1, rule->filter_backward->before, NULL, translate->tables[translate->table_crs]->subpatterns))
				return 1;
		}

		if(rule->filter_backward->after)
		{
#ifdef PATTERN_OUTPUT_TRACE
			puts("==========");
			output_hash_type();
			puts("backward-after");
			debug_output_line(rule->filter_backward->name, rule->filter_backward->name_len);
			debug_output_line(rule->chars, rule->chars_len);
			debug_output_line(rule->dots, rule->dots_len);
			debug_output_line(translate->input, translate->input_len);
			for(int i = 0; i < translate->input_crs; i++)
				printf(" ");
			puts("^");
#endif
			if(!pattern_check(translate, translate->input, translate->input_crs + rule->dots_len, translate->input_len, 1, rule->filter_backward->after, NULL, translate->tables[translate->table_crs]->subpatterns))
				return 1;
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
cmpl $0x1, -0x1c(%rbp)
jne 0x10e51
movq -0x18(%rbp), %rax
cmpq $0x0, 0x80(%rax)
jne 0x10d47
movl $0x0, -0x4(%rbp)
jmp 0x10f81
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rax
cmpq $0x0, 0x8(%rax)
je 0x10dc5
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
movq -0x10(%rbp), %rax
movl 0x40(%rax), %edx
subl $0x1, %edx
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rax
movq 0x8(%rax), %r9
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rax
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
movl %r8d, %ecx
movq $0x0, (%rsp)
movq %rax, 0x8(%rsp)
callq 0xcc20
cmpl $0x0, %eax
jne 0x10dc3
movl $0x1, -0x4(%rbp)
jmp 0x10f81
jmp 0x10dc5
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rax
cmpq $0x0, 0x10(%rax)
je 0x10e4c
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
movq -0x10(%rbp), %rax
movl 0x40(%rax), %edx
movq -0x18(%rbp), %rax
addl 0x74(%rax), %edx
movq -0x10(%rbp), %rax
movl 0x44(%rax), %ecx
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rax
movq 0x10(%rax), %r9
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %r8
movslq 0x8(%r8), %r8
movq (%rax,%r8,8), %rax
movq 0x28(%rax), %rax
movl $0x1, %r8d
xorl %r10d, %r10d
movq $0x0, (%rsp)
movq %rax, 0x8(%rsp)
callq 0xcc20
cmpl $0x0, %eax
jne 0x10e4a
movl $0x1, -0x4(%rbp)
jmp 0x10f81
jmp 0x10e4c
jmp 0x10f7a
cmpl $-0x1, -0x1c(%rbp)
je 0x10e5c
callq 0x1050
movq -0x18(%rbp), %rax
cmpq $0x0, 0x88(%rax)
jne 0x10e76
movl $0x0, -0x4(%rbp)
jmp 0x10f81
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rax
cmpq $0x0, 0x8(%rax)
je 0x10ef4
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
movq -0x10(%rbp), %rax
movl 0x40(%rax), %edx
subl $0x1, %edx
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rax
movq 0x8(%rax), %r9
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq 0x28(%rax), %rax
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
movl %r8d, %ecx
movq $0x0, (%rsp)
movq %rax, 0x8(%rsp)
callq 0xcc20
cmpl $0x0, %eax
jne 0x10ef2
movl $0x1, -0x4(%rbp)
jmp 0x10f81
jmp 0x10ef4
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rax
cmpq $0x0, 0x10(%rax)
je 0x10f78
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rsi
movq -0x10(%rbp), %rax
movl 0x40(%rax), %edx
movq -0x18(%rbp), %rax
addl 0x78(%rax), %edx
movq -0x10(%rbp), %rax
movl 0x44(%rax), %ecx
movq -0x18(%rbp), %rax
movq 0x88(%rax), %rax
movq 0x10(%rax), %r9
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %r8
movslq 0x8(%r8), %r8
movq (%rax,%r8,8), %rax
movq 0x28(%rax), %rax
movl $0x1, %r8d
xorl %r10d, %r10d
movq $0x0, (%rsp)
movq %rax, 0x8(%rsp)
callq 0xcc20
cmpl $0x0, %eax
jne 0x10f76
movl $0x1, -0x4(%rbp)
jmp 0x10f81
jmp 0x10f78
jmp 0x10f7a
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)