// File: /workspace/github_c_makefile_star2_O2/MikeGray-APH[P]LibLouisAPH/source/languages/generic-common.c
// Function: generic_process
int generic_process(struct translate *translate, const enum table_hash_type hash_type, const enum rule_direction direction)
{
	const struct table *table;
	const struct rule *rule;
	enum mode_type nocontract_state;

	/*   only copy indicators from last table in tables   */
	table = translate->tables[translate->table_cnt - 1];

	/*   reset tracked cursor   */
	translate->cursor_set = 0;

	nocontract_state = NONE;

	translate->input_crs =
	translate->output_len = 0;
	while(translate->input_crs < translate->input_len)
	{
		/*   just copy when notrans is set   */
		if(translate->input_mask[translate->input_crs] & MASK_NO_TRANSLATION)
		{
			if(!translate_copy_to_output(translate, 1, 1))
				return 0;
			continue;
		}

		/*   nocontract word stops on space   */
		if(nocontract_state == WORD)
		if(table_get_character_attributes(table, translate->input[translate->input_crs]) & CHAR_SPACE)
			nocontract_state = NONE;

		/*   nocontract   */
		switch(translate_get_mode_indicator(translate, table, &table->nocontract))
		{
		case FAIL:   return 0;
		case NONE:                              break;
		case BEGIN:  nocontract_state = BEGIN;  break;
		case WORD:   nocontract_state = WORD;   break;
		case END:
		case TERM:   nocontract_state = NONE;   break;

		case SYMBOL:

			/*   it is possible for symbol to be inside WORD or PASSAGE   */
			if(nocontract_state == NONE)
				nocontract_state = SYMBOL;
			break;
		}

		if(translate_copy_marked_indicators(translate) > 0)
			continue;

		/*   find rule   */
		rule = generic_match_rule(translate, hash_type, direction, nocontract_state == NONE);
		if(!rule)
		{
			if(!translate_copy_to_output(translate, 1, 1))
				return 0;
		}
		else
		{
			CHANGE_MARK
			if(!generic_apply_rule(translate, rule, direction))
				return 0;
		}

		/*   reset nocontract symbol   */
		if(nocontract_state == SYMBOL)
			nocontract_state = NONE;
	}

#ifdef DEBUG
	translate->output[translate->output_len] = 0;
#endif

	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
movslq 0xc(%rdi), %rcx
movq -0x8(%rax,%rcx,8), %r15
andl $0x0, 0x8c(%rdi)
andl $0x0, 0x68(%rdi)
movl %edx, %ebp
andl $0x0, 0x40(%rdi)
movl %esi, 0x4(%rsp)
leaq 0x50(%r15), %r14
pushq $0x1
popq %r13
pushq $0x4
popq %r12
movl %r13d, (%rsp)
movslq 0x40(%rbx), %rax
cmpl 0x44(%rbx), %eax
jge 0x9f08
movq 0x58(%rbx), %rcx
testb $0x1, (%rcx,%rax)
je 0x9b35
movq %rbx, %rdi
movl %r13d, %esi
movl %r13d, %edx
callq 0x6b0c
testl %eax, %eax
jne 0x9b07
jmp 0x9f04
cmpl $0x4, (%rsp)
jne 0x9b65
movq 0x38(%rbx), %rcx
movzwl (%rcx,%rax,2), %esi
movq %r15, %rdi
callq 0x1e48
movl %r12d, (%rsp)
testq %rax, %rax
je 0x9b65
xorl %ecx, %ecx
testb $0x1, 0x24(%rax)
sete %cl
leal (%rcx,%rcx,2), %eax
incl %eax
movl %eax, (%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x66bb
cmpl $0x6, %eax
ja 0x9ba4
movl %eax, %ecx
leaq 0x8037(%rip), %rdx      # 0x11bb8
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl %r13d, (%rsp)
jmp 0x9ba4
movl %eax, (%rsp)
jmp 0x9ba4
movl (%rsp), %ecx
cmpl $0x1, %ecx
pushq $0x6
popq %rax
cmovel %eax, %ecx
movl %ecx, (%rsp)
movq %rbx, %rdi
callq 0x6c6c
testl %eax, %eax
jg 0x9b07
xorl %eax, %eax
movq %r15, 0x10(%rsp)
movq %r14, 0x8(%rsp)
movl %eax, 0x8(%rbx)
cmpl 0xc(%rbx), %eax
jge 0x9ef2
movslq 0x40(%rbx), %rcx
movq %rcx, %r14
addq %rcx, %r14
addq 0x38(%rbx), %r14
movl 0x44(%rbx), %r15d
subl %ecx, %r15d
movq (%rbx), %rcx
cltq
movq (%rcx,%rax,8), %rdi
movl 0x4(%rsp), %esi
movl %ebp, %edx
movq %r14, %rcx
movl %r15d, %r8d
xorl %r9d, %r9d
callq 0x286c
movq %rax, %r12
testq %rax, %rax
je 0x9d75
cmpl $0x1, (%rsp)
je 0x9c1b
testb $0x1, (%r12)
jne 0x9d56
cmpl $-0x1, %ebp
je 0x9cc6
cmpl $0x1, %ebp
jne 0x9f27
movq 0x80(%r12), %rax
testq %rax, %rax
je 0x9d8d
movq 0x8(%rax), %r9
testq %r9, %r9
je 0x9c80
movq (%rbx), %rax
movq 0x38(%rbx), %rsi
movl 0x40(%rbx), %edx
decl %edx
movslq 0x8(%rbx), %rcx
movq (%rax,%rcx,8), %rax
movq %rbx, %rdi
pushq $-0x1
popq %rcx
movl %ecx, %r8d
pushq 0x28(%rax)
pushq $0x0
callq 0x79e3
popq %rcx
popq %rdx
testl %eax, %eax
je 0x9d56
movq 0x80(%r12), %rax
movq 0x10(%rax), %r9
testq %r9, %r9
je 0x9d8d
movq (%rbx), %rax
movl 0x74(%r12), %edx
addl 0x40(%rbx), %edx
movq 0x38(%rbx), %rsi
movl 0x44(%rbx), %ecx
movslq 0x8(%rbx), %rdi
movq (%rax,%rdi,8), %rax
movq %rbx, %rdi
movl %r13d, %r8d
pushq 0x28(%rax)
pushq $0x0
callq 0x79e3
popq %rcx
popq %rdx
testl %eax, %eax
je 0x9d56
jmp 0x9d8d
movq 0x88(%r12), %rax
testq %rax, %rax
je 0x9df6
movq 0x8(%rax), %r9
testq %r9, %r9
je 0x9d15
movq (%rbx), %rax
movq 0x38(%rbx), %rsi
movl 0x40(%rbx), %edx
decl %edx
movslq 0x8(%rbx), %rcx
movq (%rax,%rcx,8), %rax
movq %rbx, %rdi
pushq $-0x1
popq %rcx
movl %ecx, %r8d
pushq 0x28(%rax)
pushq $0x0
callq 0x79e3
popq %rcx
popq %rdx
testl %eax, %eax
je 0x9d56
movq 0x88(%r12), %rax
movq 0x10(%rax), %r9
testq %r9, %r9
je 0x9df6
movq (%rbx), %rax
movl 0x78(%r12), %edx
addl 0x40(%rbx), %edx
movq 0x38(%rbx), %rsi
movl 0x44(%rbx), %ecx
movslq 0x8(%rbx), %rdi
movq (%rax,%rdi,8), %rax
movq %rbx, %rdi
movl %r13d, %r8d
pushq 0x28(%rax)
pushq $0x0
callq 0x79e3
popq %rcx
popq %rdx
testl %eax, %eax
jne 0x9df6
movq (%rbx), %rax
movslq 0x8(%rbx), %rcx
movq (%rax,%rcx,8), %rdi
movl 0x4(%rsp), %esi
movl %ebp, %edx
movq %r14, %rcx
movl %r15d, %r8d
movq %r12, %r9
jmp 0x9bf9
movl 0x8(%rbx), %eax
incl %eax
movq 0x10(%rsp), %r15
movq 0x8(%rsp), %r14
pushq $0x4
popq %r12
jmp 0x9bc0
movl $0x1, 0x94(%rbx)
movl 0x78(%r12), %esi
movq %rbx, %rdi
callq 0x67c5
testl %eax, %eax
je 0x9f04
xorl %eax, %eax
movq 0x10(%rsp), %r15
movslq 0x78(%r12), %rdx
cmpq %rdx, %rax
jge 0x9e5b
movzwl 0x46(%r12,%rax,2), %edx
movq 0x60(%rbx), %rsi
movslq 0x68(%rbx), %rcx
addq %rax, %rcx
movw %dx, (%rsi,%rcx,2)
cmpl $0x0, 0x90(%rbx)
je 0x9df1
movslq 0x40(%rbx), %rdx
movq 0x50(%rbx), %rsi
movq 0x78(%rbx), %rdi
movl (%rsi,%rdx,4), %edx
movl %edx, (%rdi,%rcx,4)
incq %rax
jmp 0x9db3
movl $0x1, 0x94(%rbx)
movl 0x74(%r12), %esi
movq %rbx, %rdi
callq 0x67c5
testl %eax, %eax
je 0x9f04
xorl %eax, %eax
movq 0x10(%rsp), %r15
movslq 0x74(%r12), %rdx
cmpq %rdx, %rax
jge 0x9e8f
movzwl 0x18(%r12,%rax,2), %edx
movq 0x60(%rbx), %rsi
movslq 0x68(%rbx), %rcx
addq %rax, %rcx
movw %dx, (%rsi,%rcx,2)
cmpl $0x0, 0x90(%rbx)
je 0x9e56
movslq 0x40(%rbx), %rdx
movq 0x50(%rbx), %rsi
movq 0x78(%rbx), %rdi
movl (%rsi,%rdx,4), %edx
movl %edx, (%rdi,%rcx,4)
incq %rax
jmp 0x9e1c
cmpl $0x0, 0x90(%rbx)
je 0x9ec3
xorl %r14d, %r14d
movl 0x74(%r12), %esi
movl 0x78(%r12), %edx
cmpl %esi, %r14d
jge 0x9ecf
xorl %eax, %eax
testl %edx, %edx
setle %al
movq %rbx, %rdi
movl %r14d, %esi
movl %eax, %edx
callq 0x9f2c
incl %r14d
jmp 0x9e67
cmpl $0x0, 0x90(%rbx)
je 0x9eca
xorl %r14d, %r14d
movl 0x74(%r12), %edx
movl 0x78(%r12), %esi
cmpl %esi, %r14d
jge 0x9ecf
xorl %eax, %eax
testl %edx, %edx
setle %al
movq %rbx, %rdi
movl %r14d, %esi
movl %eax, %edx
callq 0x9f2c
incl %r14d
jmp 0x9e9b
movl 0x74(%r12), %esi
jmp 0x9ecf
movl 0x78(%r12), %esi
movq %rbx, %rdi
callq 0x9f9b
movq 0x8(%rsp), %r14
pushq $0x4
popq %r12
movl (%rsp), %eax
cmpl $0x6, %eax
cmovel %r13d, %eax
movl %eax, (%rsp)
jmp 0x9b07
movq %rbx, %rdi
movl %r13d, %esi
movl %r13d, %edx
callq 0x6b0c
testl %eax, %eax
jne 0x9ee0
xorl %eax, %eax
jmp 0x9f18
movq 0x60(%rbx), %rax
movslq 0x68(%rbx), %rcx
andw $0x0, (%rax,%rcx,2)
pushq $0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1060