// File: /workspace/github_cpp_makefile_star2_O3/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
movb $0x0, 0x50(%rdi)
movl $0x0, 0x54(%rdi)
addq $0x58, %rdi
leaq 0x2efe(%rip), %rsi      # 0xa3e5
xorl %edx, %edx
callq 0x890e
movq $0x0, 0x64(%rbx)
testq %r14, %r14
je 0x7645
cmpb $0x0, (%r14)
je 0x7645
movq $-0x1, 0x8(%rbx)
testq %r15, %r15
je 0x751d
movsd (%r15), %xmm0
jmp 0x7520
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 0x7557
xorl %ebp, %ebp
cmpb $-0x11, (%r14)
jne 0x7557
cmpb $-0x45, 0x1(%r14)
jne 0x7557
cmpb $-0x41, 0x2(%r14)
jne 0x7557
movb $0x1, 0x6c(%rbx)
movl $0x1, %ebp
movq %r14, %rdi
movl %ebp, %esi
callq 0x6d4c
testq %rax, %rax
je 0x7645
movq %rax, %r13
movq %rsp, %r14
leaq 0x3257(%rip), %r15      # 0xa7ce
cmpb $0x0, (%r13)
je 0x7671
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x773a
testq %rax, %rax
je 0x7671
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 0x36ac
testl %ebp, %ebp
je 0x75d5
movq %r13, %rdi
movl %ebp, %esi
callq 0x6d4c
movq %rax, %r13
testq %rax, %rax
jne 0x7577
jmp 0x766e
movq (%r12), %rax
movq %r12, %rdi
callq *0x78(%rax)
testq %rax, %rax
je 0x7637
movq (%r12), %rax
movq %r12, %rdi
callq *0x78(%rax)
movq 0x58(%rax), %r12
cmpb $0x0, 0x10(%r12)
je 0x763b
addq $0x10, %r12
movl $0x1, %ebp
movq %r12, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x70e8
testb %al, %al
jne 0x75be
movq %r12, %rdi
leaq 0x31b3(%rip), %rsi      # 0xa7d4
movl $0x1, %edx
callq 0x70e8
movzbl %al, %eax
movl $0x2, %ebp
subl %eax, %ebp
jmp 0x75be
xorl %ebp, %ebp
jmp 0x75be
movl $0x1, %ebp
jmp 0x75be
xorl %r13d, %r13d
movq %rbx, %rdi
movl $0xc, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x768c
movq %r13, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r13d, %r13d
cmpq $0x0, 0x28(%rbx)
jne 0x765c
xorl %r13d, %r13d
movq %rbx, %rdi
movl $0xc, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl %ebp, %r8d
jmp 0x7657