// File: smallmuou[P]tinyhtml/tinyxmlparser.cpp
// Function: TiXmlNode::Identify(char const*, TiXmlEncoding)
TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding )
{
	TiXmlNode* returnNode = 0;

	p = SkipWhiteSpace( p, encoding );
	if( !p || !*p || *p != '<' )
	{
		return 0;
	}

	p = SkipWhiteSpace( p, encoding );

	if ( !p || !*p )
	{
		return 0;
	}

	// What is this thing? 
	// - Elements start with a letter or underscore, but xml is reserved.
	// - Comments: <!--
	// - Decleration: <?xml
	// - Everthing else is unknown to tinyxml.
	//

	const char* xmlHeader = { "<?xml" };
	const char* commentHeader = { "<!--" };
	const char* dtdHeader = { "<!" };
	const char* cdataHeader = { "<![CDATA[" };

	if ( StringEqual( p, xmlHeader, true, encoding ) )
	{
		#ifdef DEBUG_PARSER
			TIXML_LOG( "XML parsing Declaration\n" );
		#endif
		returnNode = new TiXmlDeclaration();
	}
	else if ( StringEqual( p, commentHeader, false, encoding ) )
	{
		#ifdef DEBUG_PARSER
			TIXML_LOG( "XML parsing Comment\n" );
		#endif
		returnNode = new TiXmlComment();
	}
	else if ( StringEqual( p, cdataHeader, false, encoding ) )
	{
		#ifdef DEBUG_PARSER
			TIXML_LOG( "XML parsing CDATA\n" );
		#endif
		TiXmlText* text = new TiXmlText( "" );
		text->SetCDATA( true );
		returnNode = text;
	}
	else if ( StringEqual( p, dtdHeader, false, encoding ) )
	{
		#ifdef DEBUG_PARSER
			TIXML_LOG( "XML parsing Unknown(1)\n" );
		#endif
		returnNode = new TiXmlUnknown();
	}
	else if (    IsAlpha( *(p+1), encoding )
			  || *(p+1) == '_' )
	{
		#ifdef DEBUG_PARSER
			TIXML_LOG( "XML parsing Element\n" );
		#endif
		returnNode = new TiXmlElement( "" );
	}
	else
	{
		#ifdef DEBUG_PARSER
			TIXML_LOG( "XML parsing Unknown(2)\n" );
		#endif
		returnNode = new TiXmlUnknown();
	}

	if ( returnNode )
	{
		// Set the parent, so it can report errors
		returnNode->parent = this;
	}
	return returnNode;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x8e00
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x9d82
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
je 0x9d82
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3c, %eax
je 0x9d8f
movq $0x0, -0x8(%rbp)
jmp 0xa06f
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x8e00
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x9daf
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x9dbc
movq $0x0, -0x8(%rbp)
jmp 0xa06f
leaq 0x4f18(%rip), %rax      # 0xecdb
movq %rax, -0x30(%rbp)
leaq 0x475e(%rip), %rax      # 0xe52c
movq %rax, -0x38(%rbp)
leaq 0x4f08(%rip), %rax      # 0xece1
movq %rax, -0x40(%rbp)
leaq 0x473a(%rip), %rax      # 0xe51e
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl -0x1c(%rbp), %ecx
movl $0x1, %edx
callq 0x9540
testb $0x1, %al
jne 0x9e03
jmp 0x9e4a
movl $0x68, %edi
callq 0x3130
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x70(%rbp)
callq 0x7e20
jmp 0x9e1e
movq -0x70(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0xa054
movq -0x70(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
movl $0x68, %esi
callq 0x3140
jmp 0xa07c
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl -0x1c(%rbp), %ecx
xorl %edx, %edx
callq 0x9540
testb $0x1, %al
jne 0x9e62
jmp 0x9ea9
movl $0x50, %edi
callq 0x3130
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x78(%rbp)
callq 0x7d70
jmp 0x9e7d
movq -0x78(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0xa052
movq -0x78(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
movl $0x50, %esi
callq 0x3140
jmp 0xa07c
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl -0x1c(%rbp), %ecx
xorl %edx, %edx
callq 0x9540
testb $0x1, %al
jne 0x9ec1
jmp 0x9f25
movl $0x58, %edi
callq 0x3130
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x80(%rbp)
leaq 0x4509(%rip), %rsi      # 0xe3e5
callq 0x7db0
jmp 0x9ee3
movq -0x80(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movl $0x1, %esi
callq 0xb980
movq -0x60(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0xa050
movq -0x80(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
movl $0x58, %esi
callq 0x3140
jmp 0xa07c
movq -0x18(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl -0x1c(%rbp), %ecx
xorl %edx, %edx
callq 0x9540
testb $0x1, %al
jne 0x9f3d
jmp 0x9f8d
movl $0x50, %edi
callq 0x3130
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x88(%rbp)
callq 0x7ed0
jmp 0x9f5b
movq -0x88(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0xa04e
movq -0x88(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
movl $0x50, %esi
callq 0x3140
jmp 0xa07c
movq -0x18(%rbp), %rax
movb 0x1(%rax), %al
movl -0x1c(%rbp), %esi
movzbl %al, %edi
callq 0x8a10
cmpl $0x0, %eax
jne 0x9fb1
movq -0x18(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x5f, %eax
jne 0xa002
movl $0x90, %edi
callq 0x3130
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x90(%rbp)
leaq 0x4416(%rip), %rsi      # 0xe3e5
callq 0x4640
jmp 0x9fd6
movq -0x90(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0xa04c
movq -0x90(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
movl $0x90, %esi
callq 0x3140
jmp 0xa07c
movl $0x50, %edi
callq 0x3130
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x98(%rbp)
callq 0x7ed0
jmp 0xa020
movq -0x98(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0xa04c
movq -0x98(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
movl $0x50, %esi
callq 0x3140
jmp 0xa07c
jmp 0xa04e
jmp 0xa050
jmp 0xa052
jmp 0xa054
cmpq $0x0, -0x28(%rbp)
je 0xa067
movq -0x68(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x3270
nopw %cs:(%rax,%rax)