// File: /workspace/github_cpp_makefile_star2_O2/smallmuou[P]tinyhtml/tinyxmlparser.cpp
// Function: TiXmlElement::Parse(char const*, TiXmlParsingData*, TiXmlEncoding)
const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
{
	p = SkipWhiteSpace( p, encoding );
	TiXmlDocument* document = GetDocument();

	if ( !p || !*p )
	{
		if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, 0, 0, encoding );
		return 0;
	}

	if ( data )
	{
		data->Stamp( p, encoding );
		location = data->Cursor();
	}

	if ( *p != '<' )
	{
		if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, p, data, encoding );
		return 0;
	}

	p = SkipWhiteSpace( p+1, encoding );

	// Read the name.
	const char* pErr = p;

    p = ReadName( p, &value, encoding );
	if ( !p || !*p )
	{
		if ( document )	document->SetError( TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, pErr, data, encoding );
		return 0;
	}

    TIXML_STRING endTag ("</");
	endTag += value;

	// Check for and read attributes. Also look for an empty
	// tag or an end tag.
	while ( p && *p )
	{
		pErr = p;
		p = SkipWhiteSpace( p, encoding );
		if ( !p || !*p )
		{
			if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding );
			return 0;
		}
		if ( *p == '/' )
		{
			++p;
			// Empty tag.
			if ( *p  != '>' )
			{
				if ( document ) document->SetError( TIXML_ERROR_PARSING_EMPTY, p, data, encoding );		
				return 0;
			}
			return (p+1);
		}
		else if ( *p == '>' )
		{
			// Done with attributes (if there were any.)
			// Read the value -- which can include other
			// elements -- read the end tag, and return.
			++p;
			p = ReadValue( p, data, encoding );		// Note this is an Element method, and will set the error if one happens.
			if ( !p || !*p ) {
				// We were looking for the end tag, but found nothing.
				// Fix for [ 1663758 ] Failure to report error on bad XML
				if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding );
				return 0;
			}

			// We should find the end tag now
			// note that:
			// </foo > and
			// </foo> 
			// are both valid end tags.
			if ( StringEqual( p, endTag.c_str(), false, encoding ) )
			{
				p += endTag.length();
				p = SkipWhiteSpace( p, encoding );
				if ( p && *p && *p == '>' ) {
					++p;
					return p;
				}
				if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding );
				return 0;
			}
			else
			{
				if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding );
				return 0;
			}
		}
		else
		{
			// Try to read an attribute:
			TiXmlAttribute* attrib = new TiXmlAttribute();
			if ( !attrib )
			{
				return 0;
			}

			attrib->SetDocument( document );
			pErr = p;
			p = attrib->Parse( p, data, encoding );

			if ( !p || !*p )
			{
				if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding );
				delete attrib;
				return 0;
			}

			// Handle the strange case of double attributes:
			#ifdef TIXML_USE_STL
			TiXmlAttribute* node = attributeSet.Find( attrib->NameTStr() );
			#else
			TiXmlAttribute* node = attributeSet.Find( attrib->Name() );
			#endif
			if ( node )
			{
				if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding );
				delete attrib;
				return 0;
			}

			attributeSet.Add( attrib );
		}
	}
	return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebx
movq %rdx, (%rsp)
movq %rdi, %r13
movq %rsi, %rdi
movl %ecx, %esi
callq 0x5fec
movq %rax, %r14
movq %r13, %rdi
callq 0x3c9a
movq %rax, %r15
testq %r14, %r14
je 0x6aed
movb (%r14), %al
testb %al, %al
je 0x6aed
movq (%rsp), %rcx
testq %rcx, %rcx
je 0x69de
movq (%rsp), %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x5e48
movq (%rsp), %rcx
movq (%rcx), %rax
movq %rax, 0x8(%r13)
movb (%r14), %al
cmpb $0x3c, %al
jne 0x6b09
incq %r14
movq %r14, %rdi
movl %ebx, %esi
callq 0x5fec
movq %rax, %rbp
leaq 0x38(%r13), %r14
movq %rax, %rdi
movq %r14, %rsi
callq 0x606a
testq %rax, %rax
je 0x6b19
movq %rax, %r12
cmpb $0x0, (%rax)
je 0x6b19
leaq 0x2afa(%rip), %rsi      # 0x951b
leaq 0x8(%rsp), %rbp
movq %rbp, %rdi
callq 0x59de
movq %rbp, %rdi
movq %r14, %rsi
callq 0x5a30
leaq 0x50(%r13), %rax
movq %rax, 0x10(%rsp)
cmpb $0x0, (%r12)
je 0x6c31
movq %r12, %rdi
movl %ebx, %esi
callq 0x5fec
testq %rax, %rax
je 0x6b48
movq %rax, %rbp
movzbl (%rax), %eax
cmpl $0x3e, %eax
je 0x6b8e
cmpl $0x2f, %eax
je 0x6bfc
testl %eax, %eax
je 0x6b48
pushq $0x40
popq %rdi
callq 0x3130
movq %rax, %r14
movq %rax, %rdi
callq 0x5b0c
movq %r15, 0x18(%r14)
movq (%r14), %rax
movq %r14, %rdi
movq %rbp, %rsi
movq (%rsp), %rdx
movl %ebx, %ecx
callq *0x18(%rax)
movq %rax, %r12
testq %rax, %rax
je 0x6b6b
cmpb $0x0, (%r12)
je 0x6b6b
movq 0x20(%r14), %rsi
addq $0x10, %rsi
movq 0x10(%rsp), %rdi
callq 0x3b2c
testq %rax, %rax
jne 0x6c0b
movq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x53fe
jmp 0x6a42
testq %r15, %r15
je 0x6b33
xorl %r12d, %r12d
pushq $0x3
popq %rsi
movq %r15, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
movl %ebx, %r8d
callq 0x6760
jmp 0x6b36
testq %r15, %r15
je 0x6b33
pushq $0x3
popq %rsi
movq %r15, %rdi
movq %r14, %rdx
jmp 0x6b2b
testq %r15, %r15
je 0x6b33
pushq $0x4
popq %rsi
movq %r15, %rdi
movq %rbp, %rdx
movq (%rsp), %rcx
movl %ebx, %r8d
callq 0x6760
xorl %r12d, %r12d
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r15, %r15
je 0x6c2e
pushq $0x6
popq %rsi
movq %r15, %rdi
movq %r12, %rdx
movq (%rsp), %rcx
movl %ebx, %r8d
callq 0x6760
jmp 0x6c2e
testq %r15, %r15
je 0x6c25
pushq $0x3
popq %rsi
movq %r15, %rdi
movq %rbp, %rdx
movq (%rsp), %rcx
movl %ebx, %r8d
callq 0x6760
jmp 0x6c25
incq %rbp
movq %r13, %rdi
movq %rbp, %rsi
movq (%rsp), %rdx
movl %ebx, %ecx
callq 0x6ca8
movq %rax, %r12
testq %rax, %rax
je 0x6c40
cmpb $0x0, (%r12)
je 0x6c40
movq 0x8(%rsp), %rsi
addq $0x10, %rsi
movq %r12, %rdi
xorl %edx, %edx
movl %ebx, %ecx
callq 0x632a
testb %al, %al
je 0x6c6f
movq 0x8(%rsp), %rax
movq (%rax), %rdi
addq %r12, %rdi
movl %ebx, %esi
callq 0x5fec
movq %rax, %r12
testq %rax, %rax
je 0x6c40
cmpb $0x3e, (%r12)
jne 0x6c40
incq %r12
jmp 0x6c31
cmpb $0x3e, 0x1(%rbp)
jne 0x6c5c
addq $0x2, %rbp
movq %rbp, %r12
jmp 0x6c31
testq %r15, %r15
je 0x6c25
pushq $0x3
popq %rsi
movq %r15, %rdi
movq %rbp, %rdx
movq (%rsp), %rcx
movl %ebx, %r8d
callq 0x6760
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
xorl %r12d, %r12d
leaq 0x8(%rsp), %rdi
callq 0x5cd8
jmp 0x6b36
testq %r15, %r15
je 0x6c2e
pushq $0x8
popq %rsi
movq %r15, %rdi
movq %r12, %rdx
movq (%rsp), %rcx
movl %ebx, %r8d
callq 0x6760
jmp 0x6c2e
testq %r15, %r15
je 0x6c2e
incq %rbp
pushq $0x7
popq %rsi
movq %rbp, %r12
jmp 0x6b54
testq %r15, %r15
je 0x6c2e
pushq $0x8
jmp 0x6b53
jmp 0x6c93
jmp 0x6c93
jmp 0x6c93
movq %rax, %rbx
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x3140
jmp 0x6c96
jmp 0x6c93
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x5cd8
movq %rbx, %rdi
callq 0x3280