// File: halsafar[P]libtmx-parser/./libs/tinyxml2/tinyxml2.cpp
// Function: tinyxml2::XMLDocument::Identify(char*, tinyxml2::XMLNode**)
char* XMLDocument::Identify( char* p, XMLNode** node )
{
    char* const start = p;
    p = XMLUtil::SkipWhiteSpace( p );
    if( !p || !*p ) {
        return p;
    }

    // What is this thing?
	// These strings define the matching patters:
    static const char* xmlHeader		= { "<?" };
    static const char* commentHeader	= { "<!--" };
    static const char* dtdHeader		= { "<!" };
    static const char* cdataHeader		= { "<![CDATA[" };
    static const char* elementHeader	= { "<" };	// and a header for everything else; check last.

    static const int xmlHeaderLen		= 2;
    static const int commentHeaderLen	= 4;
    static const int dtdHeaderLen		= 2;
    static const int cdataHeaderLen		= 9;
    static const int elementHeaderLen	= 1;

#if defined(_MSC_VER)
#pragma warning ( push )
#pragma warning ( disable : 4127 )
#endif
    TIXMLASSERT( sizeof( XMLComment ) == sizeof( XMLUnknown ) );		// use same memory pool
    TIXMLASSERT( sizeof( XMLComment ) == sizeof( XMLDeclaration ) );	// use same memory pool
#if defined(_MSC_VER)
#pragma warning (pop)
#endif
    XMLNode* returnNode = 0;
    if ( XMLUtil::StringEqual( p, xmlHeader, xmlHeaderLen ) ) {
        returnNode = new (_commentPool.Alloc()) XMLDeclaration( this );
        returnNode->_memPool = &_commentPool;
        p += xmlHeaderLen;
    }
    else if ( XMLUtil::StringEqual( p, commentHeader, commentHeaderLen ) ) {
        returnNode = new (_commentPool.Alloc()) XMLComment( this );
        returnNode->_memPool = &_commentPool;
        p += commentHeaderLen;
    }
    else if ( XMLUtil::StringEqual( p, cdataHeader, cdataHeaderLen ) ) {
        XMLText* text = new (_textPool.Alloc()) XMLText( this );
        returnNode = text;
        returnNode->_memPool = &_textPool;
        p += cdataHeaderLen;
        text->SetCData( true );
    }
    else if ( XMLUtil::StringEqual( p, dtdHeader, dtdHeaderLen ) ) {
        returnNode = new (_commentPool.Alloc()) XMLUnknown( this );
        returnNode->_memPool = &_commentPool;
        p += dtdHeaderLen;
    }
    else if ( XMLUtil::StringEqual( p, elementHeader, elementHeaderLen ) ) {
        returnNode = new (_elementPool.Alloc()) XMLElement( this );
        returnNode->_memPool = &_elementPool;
        p += elementHeaderLen;
    }
    else {
        returnNode = new (_textPool.Alloc()) XMLText( this );
        returnNode->_memPool = &_textPool;
        p = start;	// Back it up, all the text counts.
    }

    *node = returnNode;
    return p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1eeb0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x1a6b1
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x1a6be
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1a93a
movq $0x0, -0x30(%rbp)
movq -0x18(%rbp), %rdi
movq 0x18bcf(%rip), %rsi     # 0x332a0
movl $0x2, %edx
callq 0x1ef10
testb $0x1, %al
jne 0x1a6e1
jmp 0x1a72d
movq -0x40(%rbp), %rdi
addq $0x200, %rdi            # imm = 0x200
callq 0x1efe0
movq -0x40(%rbp), %rsi
movq %rax, %rdi
movq %rdi, -0x48(%rbp)
callq 0x1bae0
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rax, -0x30(%rbp)
addq $0x200, %rcx            # imm = 0x200
movq -0x30(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x18(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x18(%rbp)
jmp 0x1a927
movq -0x18(%rbp), %rdi
movq 0x18b70(%rip), %rsi     # 0x332a8
movl $0x4, %edx
callq 0x1ef10
testb $0x1, %al
jne 0x1a748
jmp 0x1a794
movq -0x40(%rbp), %rdi
addq $0x200, %rdi            # imm = 0x200
callq 0x1efe0
movq -0x40(%rbp), %rsi
movq %rax, %rdi
movq %rdi, -0x50(%rbp)
callq 0x1b870
movq -0x50(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rax, -0x30(%rbp)
addq $0x200, %rcx            # imm = 0x200
movq -0x30(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x18(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
jmp 0x1a925
movq -0x18(%rbp), %rdi
movq 0x18b19(%rip), %rsi     # 0x332b8
movl $0x9, %edx
callq 0x1ef10
testb $0x1, %al
jne 0x1a7af
jmp 0x1a811
movq -0x40(%rbp), %rdi
addq $0x180, %rdi            # imm = 0x180
callq 0x1f0e0
movq -0x40(%rbp), %rsi
movq %rax, %rdi
movq %rdi, -0x58(%rbp)
callq 0x1f1e0
movq -0x58(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
addq $0x180, %rcx            # imm = 0x180
movq -0x30(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x18(%rbp), %rax
addq $0x9, %rax
movq %rax, -0x18(%rbp)
movq -0x38(%rbp), %rdi
movl $0x1, %esi
callq 0x1f220
jmp 0x1a923
movq -0x18(%rbp), %rdi
movq 0x18a94(%rip), %rsi     # 0x332b0
movl $0x2, %edx
callq 0x1ef10
testb $0x1, %al
jne 0x1a82c
jmp 0x1a878
movq -0x40(%rbp), %rdi
addq $0x200, %rdi            # imm = 0x200
callq 0x1efe0
movq -0x40(%rbp), %rsi
movq %rax, %rdi
movq %rdi, -0x60(%rbp)
callq 0x1bd70
movq -0x60(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rax, -0x30(%rbp)
addq $0x200, %rcx            # imm = 0x200
movq -0x30(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x18(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x18(%rbp)
jmp 0x1a921
movq -0x18(%rbp), %rdi
movq 0x18a3d(%rip), %rsi     # 0x332c0
movl $0x1, %edx
callq 0x1ef10
testb $0x1, %al
jne 0x1a893
jmp 0x1a8dc
movq -0x40(%rbp), %rdi
addq $0x80, %rdi
callq 0x1f240
movq -0x40(%rbp), %rsi
movq %rax, %rdi
movq %rdi, -0x68(%rbp)
callq 0x1c500
movq -0x68(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rax, -0x30(%rbp)
addq $0x80, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x1a91f
movq -0x40(%rbp), %rdi
addq $0x180, %rdi            # imm = 0x180
callq 0x1f0e0
movq -0x40(%rbp), %rsi
movq %rax, %rdi
movq %rdi, -0x70(%rbp)
callq 0x1f1e0
movq -0x70(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rax, -0x30(%rbp)
addq $0x180, %rcx            # imm = 0x180
movq -0x30(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x1a921
jmp 0x1a923
jmp 0x1a925
jmp 0x1a927
movq -0x30(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)