// File: /workspace/github_c_makefile_star2_O2/MikeGray-APH[P]LibLouisAPH/source/languages/generic-forward.c
// Function: indicators_to_words
static void indicators_to_words(unsigned int *indicators, unsigned char *words, const struct translate *translate)
{
	int ind_in, emp_in, emp_len, word_in, word_begin, word_began, word_whole, word_stop, word_len, i;

	ind_in =
	emp_in =
	word_in =
	word_whole = 0;
	word_began = 0;
	word_begin = -1;
	word_len =
	emp_len = 0;

	for(i = 0; i < translate->input_len; i++)
	{
		/*   keep track of indicators   */
		if(words[i] & WORD_INDICATOR)
			ind_in = 1;
		else
			ind_in = 0;

		/*   clear out previous whole word markings   */
		words[i] &= ~WORD_WHOLE;

		/*   beginning of mode   */
		if(!emp_in)
		if(indicators[i] & EMP_BEGIN)
		{
			emp_in = 1;
			emp_len = 0;
			indicators[i] &= ~EMP_BEGIN;

			/*   mode starting inside word   */
			if(words[i] & WORD_CHAR)
			{
				word_begin = i;
				word_len = 0;
				if(word_began)
					word_whole = 0;
				else
					word_whole = WORD_WHOLE;
			}
		}

		/*   end of mode   */
		if(emp_in)
		if(indicators[i] & EMP_END)
		{
			emp_in = 0;
			indicators[i] &= ~EMP_END;

			if(word_in && word_begin >= 0)
			{
				/*   check if mode ended inside a word   */
				word_stop = EMP_END | EMP_WORD;
				if(words[i] & WORD_CHAR)
					word_whole = 0;
				else
					word_stop = 0;

				/*   if whole word is one symbol,
				     turn it into a symbol   */
				if(EMP_SYMBOL && word_len == 1)
					indicators[word_begin] |= EMP_SYMBOL;
				else
				{
					indicators[word_begin] |= EMP_WORD;
					indicators[i] |= word_stop;
				}
				words[word_begin] |= word_whole;
			}
		}
		else if(!ind_in)
			emp_len++;

		/*   beginning of word   */
		if(!word_in)
		if(words[i] & WORD_CHAR)
		{
			if(!(words[i] & WORD_INDICATOR))
				word_began = 1;
			word_in = 1;
			word_len = 0;
			if(emp_in)
			{
				word_begin = i;
				word_whole = WORD_WHOLE;
			}
		}

		/*   end of word   */
		if(word_in)
		if(!(words[i] & WORD_CHAR) && !ind_in)
		{
			/*   made it through whole word   */
			if(emp_in && word_begin >= 0)
			{
				/*   if word is one character,
				     turn it into a symbol   */
				if(EMP_SYMBOL && word_len == 1)
						indicators[word_begin] |= EMP_SYMBOL;
				else
					indicators[word_begin] |= EMP_WORD;
				words[word_begin] |= word_whole;
			}

			word_in = 0;
			word_whole = 0;
			word_begin = -1;
			word_began = 0;
		}
		else
		{
			/*   words don't start on indicators   */
			if(!(words[i] & WORD_INDICATOR))
			{
				word_began = 1;
				word_len++;
			}
		}
	}

	/*   input end   */
	if(emp_in)
	{
		indicators[i] &= ~EMP_END;

		if(word_in)
		if(word_begin >= 0)
		{
			/*   if word is one character,
			     turn it into a symbol   */
			if(EMP_SYMBOL && word_len == 1)
					indicators[word_begin] |= EMP_SYMBOL;
			else
				indicators[word_begin] |= EMP_WORD;
			words[word_begin] |= word_whole;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %r9
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl $0x1, %edi
movq %r9, -0x8(%rsp)
xorl %r14d, %r14d
xorl %ebx, %ebx
xorl %r10d, %r10d
xorl %r13d, %r13d
xorl %eax, %eax
xorl %r15d, %r15d
movslq 0x44(%rdx), %rcx
cmpq %rcx, %r14
jge 0xc7c7
movb (%rsi,%r14), %r8b
movl %r8d, %ebp
andb $-0x3, %bpl
movb %bpl, (%rsi,%r14)
movl (%r9), %r11d
testl %ebx, %ebx
je 0xc6ba
xorl %ebx, %ebx
xorl %ecx, %ecx
testb $0x2, %r11b
jne 0xc67a
movb $0x1, %cl
xorl %r11d, %r11d
movl %edi, %ebx
jmp 0xc6c7
andl $-0x3, %r11d
movl %r11d, (%r9)
movb (%rsi,%r14), %bpl
movb $0x1, %r11b
testl %r10d, %r10d
je 0xc6c5
testl %r12d, %r12d
js 0xc6c5
testb $0x1, %bpl
cmovnel %ebx, %eax
movl %r12d, %ecx
cmpl $0x1, %r15d
jne 0xc72a
movq -0x8(%rsp), %r10
leaq (%r10,%rcx,4), %r11
movl $0x8, %r10d
jmp 0xc745
testb $0x1, %r11b
jne 0xc6fb
xorl %ecx, %ecx
movb $0x1, %r11b
xorl %ebx, %ebx
testl %r10d, %r10d
jne 0xc753
xorl %r10d, %r10d
testb $0x1, %bpl
je 0xc7bb
testb $0x4, %bpl
cmovel %edi, %r13d
testb %r11b, %r11b
cmovel %r14d, %r12d
movl $0x2, %r10d
cmovel %r10d, %eax
xorl %r15d, %r15d
jmp 0xc753
andl $-0x2, %r11d
movl %r11d, (%r9)
movb (%rsi,%r14), %bpl
testb $0x1, %bpl
movl $0x0, %ebx
je 0xc669
xorl %eax, %eax
testl %r13d, %r13d
sete %al
addl %eax, %eax
xorl %r15d, %r15d
movl %r14d, %r12d
jmp 0xc669
testb $0x1, %bpl
movl $0x6, %r10d
cmovel %ebx, %r10d
movq -0x8(%rsp), %r11
orb $0x4, (%r11,%rcx,4)
movq %r9, %r11
orl %r10d, (%r11)
orb %al, (%rsi,%rcx)
movb (%rsi,%r14), %bpl
xorl %ebx, %ebx
xorl %ecx, %ecx
movzbl %bpl, %r10d
testb $0x4, %r8b
jne 0xc7a5
movl %r10d, %r8d
andl $0x1, %r8d
jne 0xc7a5
testl %r12d, %r12d
setns %r8b
andb %r8b, %cl
xorl %r10d, %r10d
cmpb $0x1, %cl
jne 0xc798
xorl %ecx, %ecx
cmpl $0x1, %r15d
sete %cl
movl %r12d, %r8d
leal 0x4(,%rcx,4), %ecx
movq -0x8(%rsp), %r11
orl %ecx, (%r11,%r8,4)
orb %al, (%rsi,%r8)
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
xorl %r13d, %r13d
xorl %eax, %eax
jmp 0xc7bb
andl $0x4, %r10d
cmovel %edi, %r13d
shrl $0x2, %r10d
xorl $0x1, %r10d
addl %r10d, %r15d
movl %edi, %r10d
incq %r14
addq $0x4, %r9
jmp 0xc644
testl %ebx, %ebx
je 0xc7f7
andb $-0x3, (%r9)
testl %r10d, %r10d
je 0xc7f7
testl %r12d, %r12d
js 0xc7f7
xorl %ecx, %ecx
cmpl $0x1, %r15d
sete %cl
movl %r12d, %edx
leal 0x4(,%rcx,4), %ecx
movq -0x8(%rsp), %rdi
orl %ecx, (%rdi,%rdx,4)
orb %al, (%rsi,%rdx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq