// File: /workspace/github_c_makefile_star2_O3/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
movl %edx, %ebp
movl %esi, 0x14(%rsp)
movq %rdi, %rbx
movq (%rdi), %rax
movslq 0xc(%rdi), %rcx
movq -0x8(%rax,%rcx,8), %r15
xorl %eax, %eax
movl %eax, 0x8c(%rdi)
movl %eax, 0x68(%rdi)
movl %eax, 0x40(%rdi)
leaq 0x50(%r15), %r12
leaq 0x9015(%rip), %r13      # 0x13c48
movl $0x1, %r14d
movslq 0x40(%rbx), %rax
cmpl 0x44(%rbx), %eax
jge 0xb280
movq 0x58(%rbx), %rcx
testb $0x1, (%rcx,%rax)
je 0xac6b
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0x7467
testl %eax, %eax
jne 0xac39
jmp 0xb295
cmpl $0x4, %r14d
jne 0xac9e
movq 0x38(%rbx), %rcx
movzwl (%rcx,%rax,2), %esi
movq %r15, %rdi
callq 0x1ef5
testq %rax, %rax
je 0xac98
xorl %ecx, %ecx
testb $0x1, 0x24(%rax)
sete %cl
leal (%rcx,%rcx,2), %r14d
incl %r14d
jmp 0xac9e
movl $0x4, %r14d
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x6f4b
cmpl $0x6, %eax
ja 0xacd7
movl %eax, %ecx
movslq (%r13,%rcx,4), %rcx
addq %r13, %rcx
jmpq *%rcx
movl $0x1, %r14d
jmp 0xacd7
movl %eax, %r14d
jmp 0xacd7
cmpl $0x1, %r14d
movl $0x6, %eax
cmovel %eax, %r14d
movq %rbx, %rdi
callq 0x76d5
testl %eax, %eax
jg 0xac39
movq %r12, (%rsp)
movq %r15, 0x8(%rsp)
movl $0x0, 0x8(%rbx)
cmpl $0x0, 0xc(%rbx)
jle 0xaedb
xorl %eax, %eax
movslq 0x40(%rbx), %rcx
movq %rcx, %r12
addq %rcx, %r12
addq 0x38(%rbx), %r12
movl 0x44(%rbx), %r15d
subl %ecx, %r15d
movq (%rbx), %rcx
cltq
movq (%rcx,%rax,8), %rdi
movl 0x14(%rsp), %esi
movl %ebp, %edx
movq %r12, %rcx
movl %r15d, %r8d
xorl %r9d, %r9d
callq 0x2949
testq %rax, %rax
je 0xaeca
movq %rax, %r13
cmpl $0x1, %r14d
je 0xad52
testb $0x1, (%r13)
jne 0xae9f
cmpl $-0x1, %ebp
je 0xae06
cmpl $0x1, %ebp
jne 0xb2a6
movq 0x80(%r13), %rax
testq %rax, %rax
je 0xaf0f
movq 0x8(%rax), %r9
testq %r9, %r9
je 0xadbc
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
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
pushq 0x28(%rax)
pushq $0x0
callq 0x85dc
addq $0x10, %rsp
testl %eax, %eax
je 0xae9f
movq 0x80(%r13), %rax
movq 0x10(%rax), %r9
testq %r9, %r9
je 0xaf0f
movq (%rbx), %rax
movl 0x74(%r13), %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 $0x1, %r8d
pushq 0x28(%rax)
pushq $0x0
callq 0x85dc
addq $0x10, %rsp
testl %eax, %eax
je 0xae9f
jmp 0xaf0f
movq 0x88(%r13), %rax
testq %rax, %rax
je 0xb090
movq 0x8(%rax), %r9
testq %r9, %r9
je 0xae5a
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
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
pushq 0x28(%rax)
pushq $0x0
callq 0x85dc
addq $0x10, %rsp
testl %eax, %eax
je 0xae9f
movq 0x88(%r13), %rax
movq 0x10(%rax), %r9
testq %r9, %r9
je 0xb090
movq (%rbx), %rax
movl 0x78(%r13), %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 $0x1, %r8d
pushq 0x28(%rax)
pushq $0x0
callq 0x85dc
addq $0x10, %rsp
testl %eax, %eax
jne 0xb090
movq (%rbx), %rax
movslq 0x8(%rbx), %rcx
movq (%rax,%rcx,8), %rdi
movl 0x14(%rsp), %esi
movl %ebp, %edx
movq %r12, %rcx
movl %r15d, %r8d
movq %r13, %r9
callq 0x2949
movq %rax, %r13
testq %rax, %rax
jne 0xad41
movl 0x8(%rbx), %eax
incl %eax
movl %eax, 0x8(%rbx)
cmpl 0xc(%rbx), %eax
jl 0xad03
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0x7467
testl %eax, %eax
movq 0x8(%rsp), %r15
movq (%rsp), %r12
movl $0x1, %edi
leaq 0x8d44(%rip), %r13      # 0x13c48
jne 0xb273
jmp 0xb295
movl $0x1, 0x94(%rbx)
movl 0x78(%r13), %esi
movq %rbx, %rdi
callq 0x70d2
testl %eax, %eax
je 0xb295
movl 0x78(%r13), %eax
testl %eax, %eax
jle 0xaf77
movq 0x60(%rbx), %rcx
xorl %edx, %edx
movzwl 0x46(%r13,%rdx,2), %edi
movslq 0x68(%rbx), %rsi
addq %rdx, %rsi
movw %di, (%rcx,%rsi,2)
cmpl $0x0, 0x90(%rbx)
je 0xaf6c
movslq 0x40(%rbx), %rax
movq 0x50(%rbx), %rdi
movq 0x78(%rbx), %r8
movl (%rdi,%rax,4), %eax
movl %eax, (%r8,%rsi,4)
movl 0x78(%r13), %eax
incq %rdx
movslq %eax, %rsi
cmpq %rsi, %rdx
jl 0xaf3b
cmpl $0x0, 0x90(%rbx)
movl 0x74(%r13), %ecx
je 0xb20c
testl %ecx, %ecx
jle 0xb20c
xorl %eax, %eax
cmpl $0x0, 0x78(%r13)
movslq %eax, %rcx
jle 0xb011
movslq 0x40(%rbx), %rsi
addq %rsi, %rcx
cmpl 0x44(%rbx), %ecx
jge 0xb2a6
movq 0x50(%rbx), %rdi
movslq (%rdi,%rcx,4), %rcx
testq %rcx, %rcx
js 0xb079
movl 0x68(%rbx), %edx
testl %esi, %esi
je 0xafd3
movl -0x4(%rdi,%rsi,4), %r8d
cmpl (%rdi,%rsi,4), %r8d
je 0xb079
movq 0x48(%rbx), %rsi
cmpl $0x0, (%rsi,%rcx,4)
js 0xb079
leal 0x1(%rcx), %edi
cmpl 0x20(%rbx), %edi
jge 0xb00c
movl %edi, %r8d
leaq (%rsi,%r8,4), %r8
movl (%r8), %r9d
testl %r9d, %r9d
js 0xb00c
cmpl (%rsi,%rcx,4), %r9d
jne 0xb00c
movl %edx, (%r8)
incl %edi
addq $0x4, %r8
cmpl %edi, 0x20(%rbx)
jg 0xaff0
movl %edx, (%rsi,%rcx,4)
jmp 0xb079
movslq 0x40(%rbx), %rdx
addq %rdx, %rcx
cmpl 0x44(%rbx), %ecx
jge 0xb2a6
movq 0x50(%rbx), %rsi
movslq (%rsi,%rcx,4), %rcx
testq %rcx, %rcx
js 0xb079
testl %edx, %edx
je 0xb03b
movl -0x4(%rsi,%rdx,4), %edi
cmpl (%rsi,%rdx,4), %edi
je 0xb079
movq 0x48(%rbx), %rdx
cmpl $0x0, (%rdx,%rcx,4)
js 0xb079
leal 0x1(%rcx), %esi
cmpl 0x20(%rbx), %esi
jge 0xb072
movl %esi, %edi
leaq (%rdx,%rdi,4), %rdi
movl (%rdi), %r8d
testl %r8d, %r8d
js 0xb072
cmpl (%rdx,%rcx,4), %r8d
jne 0xb072
movl $0xffffffff, (%rdi)     # imm = 0xFFFFFFFF
incl %esi
addq $0x4, %rdi
cmpl %esi, 0x20(%rbx)
jg 0xb053
movl $0xffffffff, (%rdx,%rcx,4) # imm = 0xFFFFFFFF
incl %eax
movl 0x74(%r13), %ecx
cmpl %ecx, %eax
jl 0xaf92
movl 0x78(%r13), %eax
jmp 0xb20c
movl $0x1, 0x94(%rbx)
movl 0x74(%r13), %esi
movq %rbx, %rdi
callq 0x70d2
testl %eax, %eax
je 0xb295
movl 0x74(%r13), %eax
testl %eax, %eax
jle 0xb0f8
movq 0x60(%rbx), %rcx
xorl %edx, %edx
movzwl 0x18(%r13,%rdx,2), %edi
movslq 0x68(%rbx), %rsi
addq %rdx, %rsi
movw %di, (%rcx,%rsi,2)
cmpl $0x0, 0x90(%rbx)
je 0xb0ed
movslq 0x40(%rbx), %rax
movq 0x50(%rbx), %rdi
movq 0x78(%rbx), %r8
movl (%rdi,%rax,4), %eax
movl %eax, (%r8,%rsi,4)
movl 0x74(%r13), %eax
incq %rdx
movslq %eax, %rsi
cmpq %rsi, %rdx
jl 0xb0bc
cmpl $0x0, 0x90(%rbx)
movl 0x78(%r13), %ecx
je 0xb20c
testl %ecx, %ecx
jle 0xb20c
xorl %eax, %eax
cmpl $0x0, 0x74(%r13)
movslq %eax, %rcx
jle 0xb192
movslq 0x40(%rbx), %rsi
addq %rsi, %rcx
cmpl 0x44(%rbx), %ecx
jge 0xb2a6
movq 0x50(%rbx), %rdi
movslq (%rdi,%rcx,4), %rcx
testq %rcx, %rcx
js 0xb1fa
movl 0x68(%rbx), %edx
testl %esi, %esi
je 0xb154
movl -0x4(%rdi,%rsi,4), %r8d
cmpl (%rdi,%rsi,4), %r8d
je 0xb1fa
movq 0x48(%rbx), %rsi
cmpl $0x0, (%rsi,%rcx,4)
js 0xb1fa
leal 0x1(%rcx), %edi
cmpl 0x20(%rbx), %edi
jge 0xb18d
movl %edi, %r8d
leaq (%rsi,%r8,4), %r8
movl (%r8), %r9d
testl %r9d, %r9d
js 0xb18d
cmpl (%rsi,%rcx,4), %r9d
jne 0xb18d
movl %edx, (%r8)
incl %edi
addq $0x4, %r8
cmpl %edi, 0x20(%rbx)
jg 0xb171
movl %edx, (%rsi,%rcx,4)
jmp 0xb1fa
movslq 0x40(%rbx), %rdx
addq %rdx, %rcx
cmpl 0x44(%rbx), %ecx
jge 0xb2a6
movq 0x50(%rbx), %rsi
movslq (%rsi,%rcx,4), %rcx
testq %rcx, %rcx
js 0xb1fa
testl %edx, %edx
je 0xb1bc
movl -0x4(%rsi,%rdx,4), %edi
cmpl (%rsi,%rdx,4), %edi
je 0xb1fa
movq 0x48(%rbx), %rdx
cmpl $0x0, (%rdx,%rcx,4)
js 0xb1fa
leal 0x1(%rcx), %esi
cmpl 0x20(%rbx), %esi
jge 0xb1f3
movl %esi, %edi
leaq (%rdx,%rdi,4), %rdi
movl (%rdi), %r8d
testl %r8d, %r8d
js 0xb1f3
cmpl (%rdx,%rcx,4), %r8d
jne 0xb1f3
movl $0xffffffff, (%rdi)     # imm = 0xFFFFFFFF
incl %esi
addq $0x4, %rdi
cmpl %esi, 0x20(%rbx)
jg 0xb1d4
movl $0xffffffff, (%rdx,%rcx,4) # imm = 0xFFFFFFFF
incl %eax
movl 0x78(%r13), %ecx
cmpl %ecx, %eax
jl 0xb113
movl 0x74(%r13), %eax
testl %ecx, %ecx
je 0xb256
cmpl $0x0, 0x8c(%rbx)
movq 0x8(%rsp), %r15
movq (%rsp), %r12
movl $0x1, %edi
leaq 0x8a1c(%rip), %r13      # 0x13c48
jne 0xb26d
movl 0x40(%rbx), %edx
movl 0x88(%rbx), %esi
cmpl %edx, %esi
jl 0xb26d
addl %ecx, %edx
cmpl %edx, %esi
jge 0xb26d
movl $0x1, 0x8c(%rbx)
movl 0x68(%rbx), %edx
movl %edx, 0x88(%rbx)
jmp 0xb26d
xorl %ecx, %ecx
movq 0x8(%rsp), %r15
movq (%rsp), %r12
movl $0x1, %edi
leaq 0x89db(%rip), %r13      # 0x13c48
addl %ecx, 0x40(%rbx)
addl %eax, 0x68(%rbx)
cmpl $0x6, %r14d
cmovel %edi, %r14d
jmp 0xac39
movq 0x60(%rbx), %rax
movslq 0x68(%rbx), %rcx
movw $0x0, (%rax,%rcx,2)
movl $0x1, %eax
jmp 0xb297
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1060
nop