// File: /workspace/github_c_makefile_star2_O0/MikeGray-APH[P]LibLouisAPH/source/table.c
// Function: table_convert_escape_markers
int table_convert_escape_markers(const struct table *table, unichar *uchars, const int uchars_len)
{
	int crs, off;

	if(uchars_len < 2)
		return uchars_len;

	crs =
	off = 0;
	while(off < uchars_len)
	{
		if(!uchars[off])
			break;
		else if(uchars[off] == u'\\')
		{
			off++;
			if(!uchars[off])
				return 0;
			else if(off >= uchars_len)
				return 0;
			switch(uchars[off])
			{
			case u'U':  uchars[crs++] = table->marker_user;      off++;  break;
			case u'B':  uchars[crs++] = table->marker_begin;     off++;  break;
			case u'E':  uchars[crs++] = table->marker_end;       off++;  break;
			case u'M':  uchars[crs++] = table->marker_modifier;  off++;  break;
			case u'H':  uchars[crs++] = table->marker_hard;      off++;  break;
			case u'S':  uchars[crs++] = table->marker_soft;      off++;  break;
			case u'I':  uchars[crs++] = table->marker_internal;  off++;  break;

			default:

				uchars[crs++] = uchars[off - 1];
				uchars[crs++] = uchars[off++];
				break;
			}
		}
		else
			uchars[crs++] = uchars[off++];
	}

	if(crs <= uchars_len)
		uchars[crs] = 0;
#ifdef DEBUG
	else
		ASSERT(0)
#endif
	return crs;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
cmpl $0x2, -0x1c(%rbp)
jge 0x2bf4
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2e91
movl $0x0, -0x24(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x2e6e
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
cmpw $0x0, (%rax,%rcx,2)
jne 0x2c22
jmp 0x2e6e
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
cmpl $0x5c, %eax
jne 0x2e3b
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
cmpw $0x0, (%rax,%rcx,2)
jne 0x2c5b
movl $0x0, -0x4(%rbp)
jmp 0x2e91
movl -0x24(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jl 0x2c6f
movl $0x0, -0x4(%rbp)
jmp 0x2e91
jmp 0x2c71
movq -0x18(%rbp), %rax
movslq -0x24(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
addl $-0x42, %eax
movl %eax, %ecx
movq %rcx, -0x30(%rbp)
subl $0x13, %eax
ja 0x2de6
movq -0x30(%rbp), %rax
leaq 0x1b54e(%rip), %rcx     # 0x1e1e8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movw 0x1e8(%rax), %dx
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2e39
movq -0x10(%rbp), %rax
movw 0x1ea(%rax), %dx
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2e39
movq -0x10(%rbp), %rax
movw 0x1ec(%rax), %dx
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2e39
movq -0x10(%rbp), %rax
movw 0x1ee(%rax), %dx
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2e39
movq -0x10(%rbp), %rax
movw 0x1f0(%rax), %dx
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2e39
movq -0x10(%rbp), %rax
movw 0x1f2(%rax), %dx
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2e39
movq -0x10(%rbp), %rax
movw 0x1f4(%rax), %dx
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2e39
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movw (%rax,%rcx,2), %dx
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x24(%rbp)
movslq %ecx, %rcx
movw (%rax,%rcx,2), %dx
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
jmp 0x2e67
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x24(%rbp)
movslq %ecx, %rcx
movw (%rax,%rcx,2), %dx
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %ecx, %rcx
movw %dx, (%rax,%rcx,2)
jmp 0x2e69
jmp 0x2c02
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jg 0x2e86
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movw $0x0, (%rax,%rcx,2)
jmp 0x2e8b
callq 0x1050
movl -0x20(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)