// File: 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
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x8e00
movq -0x68(%rbp), %rdi
movq %rax, -0x18(%rbp)
callq 0x7920
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xa0df
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
jne 0xa10c
cmpq $0x0, -0x30(%rbp)
je 0xa0ff
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %r8d
movl $0x3, %esi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x9c50
movq $0x0, -0x8(%rbp)
jmp 0xa6e6
cmpq $0x0, -0x20(%rbp)
je 0xa13a
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x24(%rbp), %edx
callq 0x8a90
movq -0x20(%rbp), %rdi
callq 0xb950
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq (%rcx), %rcx
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3c, %eax
je 0xa174
cmpq $0x0, -0x30(%rbp)
je 0xa167
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
movl $0x3, %esi
callq 0x9c50
movq $0x0, -0x8(%rbp)
jmp 0xa6e6
movq -0x18(%rbp), %rdi
addq $0x1, %rdi
movl -0x24(%rbp), %esi
callq 0x8e00
movq -0x68(%rbp), %rsi
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
addq $0x38, %rsi
movl -0x24(%rbp), %edx
callq 0x8f80
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xa1b8
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
jne 0xa1e6
cmpq $0x0, -0x30(%rbp)
je 0xa1d9
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
movl $0x4, %esi
callq 0x9c50
movq $0x0, -0x8(%rbp)
jmp 0xa6e6
leaq 0x432e(%rip), %rsi      # 0xe51b
leaq -0x40(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x7b90
movq -0x68(%rbp), %rsi
movq -0x70(%rbp), %rdi
addq $0x38, %rsi
callq 0x7ce0
jmp 0xa20d
jmp 0xa20f
xorl %eax, %eax
cmpq $0x0, -0x18(%rbp)
movb %al, -0x71(%rbp)
je 0xa228
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
setne %al
movb %al, -0x71(%rbp)
movb -0x71(%rbp), %al
testb $0x1, %al
jne 0xa234
jmp 0xa6c1
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x8e00
movq %rax, -0x80(%rbp)
jmp 0xa24e
movq -0x80(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xa266
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
jne 0xa2b0
cmpq $0x0, -0x30(%rbp)
je 0xa29c
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
movl $0x6, %esi
callq 0x9c50
jmp 0xa289
jmp 0xa29c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xa6db
movq $0x0, -0x8(%rbp)
movl $0x1, -0x50(%rbp)
jmp 0xa6d0
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
jne 0xa325
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3e, %eax
je 0xa30d
cmpq $0x0, -0x30(%rbp)
je 0xa2f9
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
movl $0x7, %esi
callq 0x9c50
jmp 0xa2f7
jmp 0xa2f9
movq $0x0, -0x8(%rbp)
movl $0x1, -0x50(%rbp)
jmp 0xa6d0
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0x50(%rbp)
jmp 0xa6d0
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3e, %eax
jne 0xa4ef
movq -0x68(%rbp), %rdi
movq -0x18(%rbp), %rax
incq %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
callq 0xa700
movq %rax, -0x88(%rbp)
jmp 0xa35d
movq -0x88(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xa378
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
jne 0xa3b1
cmpq $0x0, -0x30(%rbp)
je 0xa39d
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
movl $0x8, %esi
callq 0x9c50
jmp 0xa39b
jmp 0xa39d
movq $0x0, -0x8(%rbp)
movl $0x1, -0x50(%rbp)
jmp 0xa6d0
movq -0x18(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x7810
movq %rax, -0x90(%rbp)
jmp 0xa3ce
movq -0x90(%rbp), %rsi
movq -0x98(%rbp), %rdi
movl -0x24(%rbp), %ecx
xorl %edx, %edx
callq 0x9540
movb %al, -0x99(%rbp)
jmp 0xa3ee
movb -0x99(%rbp), %al
testb $0x1, %al
jne 0xa3fd
jmp 0xa4b6
leaq -0x40(%rbp), %rdi
callq 0x7780
movq %rax, -0xa8(%rbp)
jmp 0xa40f
movq -0xa8(%rbp), %rcx
movq -0x18(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x8e00
movq %rax, -0xb0(%rbp)
jmp 0xa436
movq -0xb0(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xa47d
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
je 0xa47d
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3e, %eax
jne 0xa47d
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0x50(%rbp)
jmp 0xa6d0
cmpq $0x0, -0x30(%rbp)
je 0xa4a2
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
movl $0x8, %esi
callq 0x9c50
jmp 0xa4a0
jmp 0xa4a2
movq $0x0, -0x8(%rbp)
movl $0x1, -0x50(%rbp)
jmp 0xa6d0
cmpq $0x0, -0x30(%rbp)
je 0xa4db
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
movl $0x8, %esi
callq 0x9c50
jmp 0xa4d9
jmp 0xa4db
movq $0x0, -0x8(%rbp)
movl $0x1, -0x50(%rbp)
jmp 0xa6d0
movl $0x40, %edi
callq 0x3130
movq %rax, -0xb8(%rbp)
jmp 0xa502
movq -0xb8(%rbp), %rdi
callq 0x7f10
jmp 0xa510
movq -0xb8(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0xa558
movq $0x0, -0x8(%rbp)
movl $0x1, -0x50(%rbp)
jmp 0xa6d0
movq -0xb8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
movl $0x40, %esi
callq 0x3140
jmp 0xa6db
movq -0x58(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0xb9a0
jmp 0xa567
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x58(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movq %rax, -0xc0(%rbp)
jmp 0xa590
movq -0xc0(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xa5ab
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
jne 0xa602
cmpq $0x0, -0x30(%rbp)
je 0xa5d0
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
movl $0x3, %esi
callq 0x9c50
jmp 0xa5ce
jmp 0xa5d0
movq -0x58(%rbp), %rax
movq %rax, -0xc8(%rbp)
cmpq $0x0, %rax
je 0xa5ee
movq -0xc8(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, -0x8(%rbp)
movl $0x1, -0x50(%rbp)
jmp 0xa6d0
movq -0x68(%rbp), %rax
addq $0x50, %rax
movq %rax, -0xd8(%rbp)
movq -0x58(%rbp), %rdi
callq 0x7b00
movq %rax, -0xd0(%rbp)
jmp 0xa623
movq -0xd0(%rbp), %rsi
movq -0xd8(%rbp), %rdi
callq 0x42f0
movq %rax, -0xe0(%rbp)
jmp 0xa63f
movq -0xe0(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0xa6a5
cmpq $0x0, -0x30(%rbp)
je 0xa676
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
movl $0x3, %esi
callq 0x9c50
jmp 0xa674
jmp 0xa676
movq -0x58(%rbp), %rax
movq %rax, -0xe8(%rbp)
cmpq $0x0, %rax
je 0xa694
movq -0xe8(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, -0x8(%rbp)
movl $0x1, -0x50(%rbp)
jmp 0xa6d0
movq -0x68(%rbp), %rdi
addq $0x50, %rdi
movq -0x58(%rbp), %rsi
callq 0x6d30
jmp 0xa6b8
jmp 0xa6ba
jmp 0xa6bc
jmp 0xa20f
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0x50(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x78c0
jmp 0xa6e6
leaq -0x40(%rbp), %rdi
callq 0x78c0
jmp 0xa6f3
movq -0x8(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x3270
nopl (%rax)