// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r15
movb (%rsi), %r13b
movq %rsi, %r14
testb %r13b, %r13b
js 0xcf87
movzbl %r13b, %edi
callq 0x4060
testl %eax, %eax
je 0xcf7e
movb 0x1(%r14), %r13b
incq %r14
jmp 0xcf63
testb %r13b, %r13b
je 0xd1fb
leaq 0x5a05(%rip), %rax      # 0x12993
cmpq %rax, %r14
je 0xd10c
xorl %ecx, %ecx
movl %r13d, %edx
cmpb (%rcx,%rax), %dl
jne 0xd103
cmpl $0x1, %ecx
ja 0xd103
movb 0x1(%r14,%rcx), %dl
incq %rcx
testb %dl, %dl
jne 0xcf9c
cmpl $0x2, %ecx
je 0xd10c
cmpb $0x0, (%rcx,%rax)
je 0xd10c
leaq 0x59c2(%rip), %rax      # 0x12996
cmpq %rax, %r14
je 0xd15d
xorl %ecx, %ecx
movl %r13d, %edx
cmpb (%rcx,%rax), %dl
jne 0xd154
cmpl $0x3, %ecx
ja 0xd154
movb 0x1(%r14,%rcx), %dl
incq %rcx
testb %dl, %dl
jne 0xcfe2
cmpl $0x4, %ecx
je 0xd15d
cmpb $0x0, (%rcx,%rax)
je 0xd15d
leaq 0x5984(%rip), %rax      # 0x1299e
cmpq %rax, %r14
je 0xd1ab
xorl %ecx, %ecx
movl %r13d, %edx
cmpb (%rcx,%rax), %dl
jne 0xd1a2
cmpl $0x8, %ecx
ja 0xd1a2
movb 0x1(%r14,%rcx), %dl
incq %rcx
testb %dl, %dl
jne 0xd028
cmpl $0x9, %ecx
je 0xd1ab
cmpb $0x0, (%rcx,%rax)
je 0xd1ab
leaq 0x593b(%rip), %rax      # 0x1299b
cmpq %rax, %r14
je 0xd216
xorl %ecx, %ecx
movl %r13d, %edx
cmpb (%rcx,%rax), %dl
jne 0xd20d
cmpl $0x1, %ecx
ja 0xd20d
movb 0x1(%r14,%rcx), %dl
incq %rcx
testb %dl, %dl
jne 0xd06e
cmpl $0x2, %ecx
je 0xd216
cmpb $0x0, (%rcx,%rax)
je 0xd216
leaq 0x5902(%rip), %rax      # 0x129a8
cmpq %rax, %r14
setne %al
cmpb $0x3c, %r13b
setne %cl
testb %cl, %al
jne 0xd253
leaq 0x80(%r15), %r12
movq %r12, %rdi
callq 0x107f0
movq %r15, 0x8(%rax)
xorl %ecx, %ecx
movq %rcx, 0x10(%rax)
movl %ecx, 0x18(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
leaq 0xc7d3(%rip), %rdx      # 0x198c0
movq %rdx, (%rax)
movl %ecx, 0x58(%rax)
movq %rcx, 0x60(%rax)
movq %r12, 0x50(%rax)
incq %r14
jmp 0xd1f2
cmpl $0x2, %ecx
jne 0xcfcd
leaq 0x200(%r15), %r12
movq %r12, %rdi
callq 0x106b4
movq %r15, 0x8(%rax)
movq $0x0, 0x10(%rax)
movl $0x0, 0x18(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
leaq 0xc63c(%rip), %rcx      # 0x19780
movq %rcx, (%rax)
movq %r12, 0x50(%rax)
addq $0x2, %r14
jmp 0xd1f2
cmpl $0x4, %ecx
jne 0xd013
leaq 0x200(%r15), %r12
movq %r12, %rdi
callq 0x106b4
movq %r15, 0x8(%rax)
movq $0x0, 0x10(%rax)
movl $0x0, 0x18(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
leaq 0xc54b(%rip), %rcx      # 0x196e0
movq %rcx, (%rax)
movq %r12, 0x50(%rax)
addq $0x4, %r14
jmp 0xd1f2
cmpl $0x9, %ecx
jne 0xd059
leaq 0x180(%r15), %r12
movq %r12, %rdi
callq 0x10752
movq %r15, 0x8(%rax)
movq $0x0, 0x10(%rax)
movl $0x0, 0x18(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
leaq 0xc895(%rip), %rcx      # 0x19a78
movq %rcx, (%rax)
movq %r12, 0x50(%rax)
addq $0x9, %r14
movb $0x1, 0x58(%rax)
movq %r14, %r12
movq %rax, (%rbx)
movq %r12, %r14
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x2, %ecx
jne 0xd09f
leaq 0x200(%r15), %r12
movq %r12, %rdi
callq 0x106b4
movq %r15, 0x8(%rax)
movq $0x0, 0x10(%rax)
movl $0x0, 0x18(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
leaq 0xc5d2(%rip), %rcx      # 0x19820
jmp 0xd144
leaq 0x180(%r15), %r14
movq %r14, %rdi
callq 0x10752
movq %r15, 0x8(%rax)
movq $0x0, 0x10(%rax)
movl $0x0, 0x18(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
leaq 0xc7ed(%rip), %rcx      # 0x19a78
movq %rcx, (%rax)
movb $0x0, 0x58(%rax)
movq %r14, 0x50(%rax)
jmp 0xd1f5
nop