// File: /workspace/github_cpp_makefile_star2_O2/smallmuou[P]tinyhtml/tinyxml.cpp
// Function: TiXmlBase::EncodeString(TiXmlString const&, TiXmlString*)
void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString )
{
	int i=0;

	while( i<(int)str.length() )
	{
		unsigned char c = (unsigned char) str[i];

		if (    c == '&' 
		     && i < ( (int)str.length() - 2 )
			 && str[i+1] == '#'
			 && str[i+2] == 'x' )
		{
			// Hexadecimal character reference.
			// Pass through unchanged.
			// &#xA9;	-- copyright symbol, for example.
			//
			// The -1 is a bug fix from Rob Laveaux. It keeps
			// an overflow from happening if there is no ';'.
			// There are actually 2 ways to exit this loop -
			// while fails (error case) and break (semicolon found).
			// However, there is no mechanism (currently) for
			// this function to return an error.
			while ( i<(int)str.length()-1 )
			{
				outString->append( str.c_str() + i, 1 );
				++i;
				if ( str[i] == ';' )
					break;
			}
		}
		else if ( c == '&' )
		{
			outString->append( entity[0].str, entity[0].strLength );
			++i;
		}
		else if ( c == '<' )
		{
			outString->append( entity[1].str, entity[1].strLength );
			++i;
		}
		else if ( c == '>' )
		{
			outString->append( entity[2].str, entity[2].strLength );
			++i;
		}
		else if ( c == '\"' )
		{
			outString->append( entity[3].str, entity[3].strLength );
			++i;
		}
		else if ( c == '\'' )
		{
			outString->append( entity[4].str, entity[4].strLength );
			++i;
		}
		else if ( c < 32 )
		{
			// Easy pass at non-alpha/numeric/symbol
			// Below 32 is symbolic.
			char buf[ 32 ];
			
			#if defined(TIXML_SNPRINTF)		
				TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) );
			#else
				sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) );
			#endif		

			//*ME:	warning C4267: convert 'size_t' to 'int'
			//*ME:	Int-Cast to make compiler happy ...
			outString->append( buf, (int)strlen( buf ) );
			++i;
		}
		else
		{
			//char realc = (char) c;
			//outString->append( &realc, 1 );
			*outString += (char) c;	// somewhat more efficient function call.
			++i;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xbdb3(%rip), %rbp      # 0xf180
xorl %r13d, %r13d
movq (%r14), %rax
cmpl (%rax), %r13d
jge 0x3527
movslq %r13d, %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x5942
movzbl (%rax), %ecx
cmpl $0x22, %ecx
je 0x34e6
cmpl $0x3e, %ecx
je 0x349c
cmpl $0x27, %ecx
je 0x34ae
cmpl $0x3c, %ecx
je 0x34a5
cmpl $0x26, %ecx
jne 0x34b7
movq (%r14), %rax
movl (%rax), %eax
addl $-0x2, %eax
leal 0x1(%r13), %r15d
cmpl %eax, %r13d
jge 0x34fd
movslq %r15d, %rsi
movq %r14, %rdi
callq 0x5942
cmpb $0x23, (%rax)
jne 0x34fd
addl $0x2, %r13d
movslq %r13d, %rsi
movq %r14, %rdi
callq 0x5942
cmpb $0x78, (%rax)
jne 0x34fd
pushq $0x1
popq %r15
movq (%r14), %rax
movl (%rax), %ecx
decl %ecx
movslq %ecx, %rcx
cmpq %rcx, %r12
jge 0x3494
leaq (%rax,%r12), %rsi
addq $0x10, %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x78b6
incq %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x5942
cmpb $0x3b, (%rax)
jne 0x345f
movl %r12d, %r13d
jmp 0x33d0
movq 0x20(%rbp), %rsi
movl 0x28(%rbp), %edx
jmp 0x34ed
movq 0x10(%rbp), %rsi
movl 0x18(%rbp), %edx
jmp 0x34ed
movq 0x40(%rbp), %rsi
movl 0x48(%rbp), %edx
jmp 0x34ed
cmpb $0x1f, %cl
ja 0x3514
movq %rsp, %r15
movq %r15, %rdi
pushq $0x20
popq %rsi
leaq 0x5b38(%rip), %rdx      # 0x9004
xorl %eax, %eax
callq 0x3240
movq %r15, %rdi
callq 0x30a0
movslq %eax, %rdx
movq %rbx, %rdi
movq %r15, %rsi
jmp 0x34f0
movq 0x30(%rbp), %rsi
movl 0x38(%rbp), %edx
movq %rbx, %rdi
callq 0x78b6
incl %r13d
jmp 0x33d0
movq (%rbp), %rsi
movl 0x8(%rbp), %edx
movq %rbx, %rdi
callq 0x78b6
movl %r15d, %r13d
jmp 0x33d0
movsbl %cl, %esi
movq %rbx, %rdi
callq 0x5972
incl %r13d
jmp 0x33d0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq