// File: /workspace/github_cpp_makefile_star2_O2/smallmuou[P]tinyhtml/tinyxmlparser.cpp
// Function: TiXmlDocument::Parse(char const*, TiXmlParsingData*, TiXmlEncoding)
const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding )
{
	ClearError();

	// Parse away, at the document level. Since a document
	// contains nothing but other tags, most of what happens
	// here is skipping white space.
	if ( !p || !*p )
	{
		SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
		return 0;
	}

	// Note that, for a document, this needs to come
	// before the while space skip, so that parsing
	// starts from the pointer we are given.
	location.Clear();
	if ( prevData )
	{
		location.row = prevData->cursor.row;
		location.col = prevData->cursor.col;
	}
	else
	{
		location.row = 0;
		location.col = 0;
	}
	TiXmlParsingData data( p, TabSize(), location.row, location.col );
	location = data.Cursor();

	if ( encoding == TIXML_ENCODING_UNKNOWN )
	{
		// Check for the Microsoft UTF-8 lead bytes.
		const unsigned char* pU = (const unsigned char*)p;
		if (	*(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0
			 && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1
			 && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 )
		{
			encoding = TIXML_ENCODING_UTF8;
			useMicrosoftBOM = true;
		}
	}

    p = SkipWhiteSpace( p, encoding );
	if ( !p )
	{
		SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
		return 0;
	}

	while ( p && *p )
	{
		TiXmlNode* node = Identify( p, encoding );
		if ( node )
		{
			p = node->Parse( p, &data, encoding );
			LinkEndChild( node );
		}
		else
		{
			break;
		}

		// Did we get encoding info?
		if (    encoding == TIXML_ENCODING_UNKNOWN
			 && node->ToDeclaration() )
		{
			TiXmlDeclaration* dec = node->ToDeclaration();
			const char* enc = dec->Encoding();
			assert( enc );

			if ( *enc == 0 )
				encoding = TIXML_ENCODING_UTF8;
			else if ( StringEqual( enc, "UTF-8", true, TIXML_ENCODING_UNKNOWN ) )
				encoding = TIXML_ENCODING_UTF8;
			else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) )
				encoding = TIXML_ENCODING_UTF8;	// incorrect, but be nice
			else 
				encoding = TIXML_ENCODING_LEGACY;
		}

		p = SkipWhiteSpace( p, encoding );
	}

	// Was this empty?
	if ( !firstChild ) {
		SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding );
		return 0;
	}

	// All is well.
	return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
callq 0x59ba
testq %r14, %r14
je 0x671f
cmpb $0x0, (%r14)
je 0x671f
orq $-0x1, 0x8(%rbx)
testq %r15, %r15
je 0x6602
movsd (%r15), %xmm0
jmp 0x6605
xorps %xmm0, %xmm0
movl 0x60(%rbx), %eax
movq %r14, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movlps %xmm0, (%rsp)
movlps %xmm0, 0x8(%rbx)
testl %ebp, %ebp
jne 0x663a
xorl %ebp, %ebp
cmpb $-0x11, (%r14)
jne 0x663a
cmpb $-0x45, 0x1(%r14)
jne 0x663a
cmpb $-0x41, 0x2(%r14)
jne 0x663a
movb $0x1, 0x6c(%rbx)
pushq $0x1
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
callq 0x5fec
testq %rax, %rax
je 0x671f
movq %rax, %r13
movq %rsp, %r14
pushq $0x1
popq %r15
testq %r13, %r13
je 0x6746
cmpb $0x0, (%r13)
je 0x6746
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x67f2
testq %rax, %rax
je 0x6746
movq %rax, %r12
movq (%rax), %rax
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
movl %ebp, %ecx
callq *0x18(%rax)
movq %rax, %r13
movq %rbx, %rdi
movq %r12, %rsi
callq 0x35cc
testl %ebp, %ebp
je 0x66b6
movq %r13, %rdi
movl %ebp, %esi
callq 0x5fec
movq %rax, %r13
jmp 0x6657
movq (%r12), %rax
movq %r12, %rdi
callq *0x78(%rax)
testq %rax, %rax
je 0x671b
movq (%r12), %rax
movq %r12, %rdi
callq *0x78(%rax)
movq 0x58(%rax), %r12
cmpb $0x0, 0x10(%r12)
movl %r15d, %ebp
je 0x66a7
addq $0x10, %r12
movq %r12, %rdi
leaq 0x30ce(%rip), %rsi      # 0x97ba
movl %r15d, %edx
xorl %ecx, %ecx
callq 0x632a
movl %r15d, %ebp
testb %al, %al
jne 0x66a7
movq %r12, %rdi
leaq 0x30b9(%rip), %rsi      # 0x97c0
movl %r15d, %edx
xorl %ecx, %ecx
callq 0x632a
movzbl %al, %eax
pushq $0x2
popq %rbp
subl %eax, %ebp
jmp 0x66a7
xorl %ebp, %ebp
jmp 0x66a7
xorl %r13d, %r13d
pushq $0xc
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x6760
movq %r13, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x28(%rbx)
jne 0x6734
xorl %r13d, %r13d
pushq $0xc
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
movl %ebp, %r8d
jmp 0x672f
nop