// File: /workspace/github_cpp_makefile_star2_O1/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 0x2dbc(%rip), %rsi      # 0xa3e5
xorl %edx, %edx
callq 0x8ae8
movq $0x0, 0x64(%rbx)
testq %r14, %r14
je 0x765c
cmpb $0x0, (%r14)
je 0x765c
movq $-0x1, 0x8(%rbx)
testq %r15, %r15
je 0x7673
movl (%r15), %eax
movl %eax, 0x8(%rbx)
movl 0x4(%r15), %eax
jmp 0x767c
xorl %r12d, %r12d
movq %rbx, %rdi
movl $0xc, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
jmp 0x77df
movl $0x0, 0x8(%rbx)
xorl %eax, %eax
movl %eax, 0xc(%rbx)
movl 0x8(%rbx), %ecx
movl 0x60(%rbx), %edx
movq $-0x1, (%rsp)
movq %r14, 0x8(%rsp)
movl %edx, 0x10(%rsp)
movl %ecx, (%rsp)
movl %eax, 0x4(%rsp)
movq (%rsp), %rax
movq %rax, 0x8(%rbx)
testl %ebp, %ebp
jne 0x76c8
xorl %ebp, %ebp
cmpb $-0x11, (%r14)
jne 0x76c8
cmpb $-0x45, 0x1(%r14)
jne 0x76c8
cmpb $-0x41, 0x2(%r14)
jne 0x76c8
movb $0x1, 0x6c(%rbx)
movl $0x1, %ebp
movq %r14, %rdi
movl %ebp, %esi
callq 0x6e8a
testq %rax, %rax
je 0x77bf
movq %rax, %r12
movq %rsp, %r14
testq %r12, %r12
je 0x77c3
cmpb $0x0, (%r12)
je 0x77c6
movq %rbx, %rdi
movq %r12, %rsi
movl %ebp, %edx
callq 0x78a4
movq %rax, %r13
testq %rax, %rax
je 0x773b
movq (%r13), %rax
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
movl %ebp, %ecx
callq *0x18(%rax)
movq %rax, %r12
movq %rbx, %rdi
movq %r13, %rsi
callq 0x369c
testl %ebp, %ebp
je 0x7745
movq %r12, %rdi
movl %ebp, %esi
callq 0x6e8a
movq %rax, %r12
testq %r13, %r13
jne 0x76e1
jmp 0x77c6
movq (%r13), %rax
movq %r13, %rdi
callq *0x78(%rax)
testq %rax, %rax
je 0x77ae
movq (%r13), %rax
movq %r13, %rdi
callq *0x78(%rax)
movq 0x58(%rax), %r15
cmpb $0x0, 0x10(%r15)
je 0x77b5
addq $0x10, %r15
movl $0x1, %ebp
movq %r15, %rdi
leaq 0x3492(%rip), %rsi      # 0xac0e
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x7254
testb %al, %al
jne 0x772e
movq %r15, %rdi
leaq 0x347e(%rip), %rsi      # 0xac14
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x7254
movzbl %al, %eax
movl $0x2, %ebp
subl %eax, %ebp
jmp 0x772e
xorl %ebp, %ebp
jmp 0x772e
movl $0x1, %ebp
jmp 0x772e
xorl %ebp, %ebp
jmp 0x77cd
xorl %r12d, %r12d
cmpq $0x0, 0x28(%rbx)
jne 0x77e4
xorl %r12d, %r12d
movq %rbx, %rdi
movl $0xc, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl %ebp, %r8d
callq 0x77f6
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq