// File: /workspace/github_c_makefile_star2_O0/MikeGray-APH[P]LibLouisAPH/source/languages/generic-forward.c
// Function: mark_capitals
static void mark_capitals(unsigned int *indicators, unsigned char *words, struct translate *translate, const struct table *table)
{
	unsigned int attrs;
	int caps_begin, caps_end, caps_cnt, indicator_in, i;

	caps_begin =
	caps_end = -1;
	caps_cnt = 0;
	indicator_in = 0;

	for(i = 0; i < translate->input_len; i++)
	{
		/*   skip when notrans or nocapital is set   */
		if(translate->input_mask[i] & (MASK_NO_TRANSLATION | MASK_NO_CAPITALIZATION))
			continue;

		/*   marked indicators   */
		if(indicator_in)
		{
			words[i] |= WORD_INDICATOR;
			if(is_indicator_delimiter(table, translate->input[i]))
				indicator_in = 0;
			continue;
		}
		else if(is_indicator_delimiter(table, translate->input[i]))
		{
			words[i] |= WORD_INDICATOR;
			indicator_in = 1;
			continue;
		}

		attrs = translate_get_attributes_at(translate, i);

		/*   caps doesn't care if delimiters are counted as words,
		     they are dealt with separately   */
		if(!(attrs & CHAR_SPACE))
			words[i] |= WORD_CHAR;
		else if(caps_cnt > 0)
		{
			caps_end = i;
			caps_cnt = 0;
		}

		if(attrs & CHAR_UPPER)
		{
			if(caps_begin < 0)
				caps_begin = i;
			caps_cnt++;
		}
		else if(caps_begin >= 0)
		{
			if(attrs & CHAR_LETTER && attrs & CHAR_LOWER)
			{
				indicators[caps_begin] |= EMP_BEGIN;
				if(caps_cnt > 0)
					indicators[i] |= EMP_END;
				else
					indicators[caps_end] |= EMP_END;
				caps_begin =
				caps_end = -1;
				caps_cnt = 0;
			}
		}
	}

	/*   input end   */
	if(caps_begin >= 0)
	{
		indicators[caps_begin] |= EMP_BEGIN;
		if(caps_cnt > 0)
			indicators[translate->input_len] |= EMP_END;
		else
			indicators[caps_end] |= EMP_END;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0xffffffff, -0x2c(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x28(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x44(%rcx), %eax
jge 0x150e1
movq -0x18(%rbp), %rax
movq 0x58(%rax), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0x14f78
jmp 0x150d3
cmpl $0x0, -0x34(%rbp)
je 0x14fba
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
movzbl (%rax,%rcx), %edx
orl $0x4, %edx
movb %dl, (%rax,%rcx)
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x38(%rbp), %rcx
movzwl (%rax,%rcx,2), %esi
callq 0x15d50
cmpl $0x0, %eax
je 0x14fb5
movl $0x0, -0x34(%rbp)
jmp 0x150d3
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x38(%rbp), %rcx
movzwl (%rax,%rcx,2), %esi
callq 0x15d50
cmpl $0x0, %eax
je 0x14ff6
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
movzbl (%rax,%rcx), %edx
orl $0x4, %edx
movb %dl, (%rax,%rcx)
movl $0x1, -0x34(%rbp)
jmp 0x150d3
jmp 0x14ff8
movq -0x18(%rbp), %rdi
movl -0x38(%rbp), %esi
callq 0x14240
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x15026
movq -0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
movzbl (%rax,%rcx), %edx
orl $0x1, %edx
movb %dl, (%rax,%rcx)
jmp 0x1503b
cmpl $0x0, -0x30(%rbp)
jle 0x15039
movl -0x38(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
jmp 0x1503b
movl -0x24(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x1505f
cmpl $0x0, -0x28(%rbp)
jge 0x15054
movl -0x38(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x150d1
cmpl $0x0, -0x28(%rbp)
jl 0x150cf
movl -0x24(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x150cd
movl -0x24(%rbp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x150cd
movq -0x8(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %edx
orl $0x1, %edx
movl %edx, (%rax,%rcx,4)
cmpl $0x0, -0x30(%rbp)
jle 0x150a7
movq -0x8(%rbp), %rax
movslq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %edx
orl $0x2, %edx
movl %edx, (%rax,%rcx,4)
jmp 0x150b8
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl (%rax,%rcx,4), %edx
orl $0x2, %edx
movl %edx, (%rax,%rcx,4)
movl $0xffffffff, -0x2c(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x28(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x30(%rbp)
jmp 0x150cf
jmp 0x150d1
jmp 0x150d3
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x14f4b
cmpl $0x0, -0x28(%rbp)
jl 0x15128
movq -0x8(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %edx
orl $0x1, %edx
movl %edx, (%rax,%rcx,4)
cmpl $0x0, -0x30(%rbp)
jle 0x15115
movq -0x8(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq 0x44(%rcx), %rcx
movl (%rax,%rcx,4), %edx
orl $0x2, %edx
movl %edx, (%rax,%rcx,4)
jmp 0x15126
movq -0x8(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movl (%rax,%rcx,4), %edx
orl $0x2, %edx
movl %edx, (%rax,%rcx,4)
jmp 0x15128
addq $0x40, %rsp
popq %rbp
retq
nop