// File: /workspace/github_cpp_makefile_star2_O3/halsafar[P]libtmx-parser/./libs/tinyxml2/tinyxml2.cpp
// Function: tinyxml2::XMLNode::ParseDeep(char*, tinyxml2::StrPair*)
char* XMLNode::ParseDeep( char* p, StrPair* parentEnd )
{
    // This is a recursive method, but thinking about it "at the current level"
    // it is a pretty simple flat list:
    //		<foo/>
    //		<!-- comment -->
    //
    // With a special case:
    //		<foo>
    //		</foo>
    //		<!-- comment -->
    //
    // Where the closing element (/foo) *must* be the next thing after the opening
    // element, and the names must match. BUT the tricky bit is that the closing
    // element will be read by the child.
    //
    // 'endTag' is the end tag for this node, it is returned by a call to a child.
    // 'parentEnd' is the end tag for the parent, which is filled in and returned.

    while( p && *p ) {
        XMLNode* node = 0;

        p = _document->Identify( p, &node );
        if ( p == 0 || node == 0 ) {
            break;
        }

        StrPair endTag;
        p = node->ParseDeep( p, &endTag );
        if ( !p ) {
            DeleteNode( node );
            node = 0;
            if ( !_document->Error() ) {
                _document->SetError( XML_ERROR_PARSING, 0, 0 );
            }
            break;
        }

        XMLElement* ele = node->ToElement();
        // We read the end tag. Return it to the parent.
        if ( ele && ele->ClosingType() == XMLElement::CLOSING ) {
            if ( parentEnd ) {
                ele->_value.TransferTo( parentEnd );
            }
			node->_memPool->SetTracked();	// created and then immediately deleted.
            DeleteNode( node );
            return p;
        }

        // Handle an end tag returned to this level.
        // And handle a bunch of annoying errors.
        if ( ele ) {
            bool mismatch = false;
            if ( endTag.Empty() && ele->ClosingType() == XMLElement::OPEN ) {
                mismatch = true;
            }
            else if ( !endTag.Empty() && ele->ClosingType() != XMLElement::OPEN ) {
                mismatch = true;
            }
            else if ( !endTag.Empty() ) {
                if ( !XMLUtil::StringEqual( endTag.GetStr(), node->Value() )) {
                    mismatch = true;
                }
            }
            if ( mismatch ) {
                _document->SetError( XML_ERROR_MISMATCHED_ELEMENT, node->Value(), 0 );
                p = 0;
            }
        }
        if ( p == 0 ) {
            DeleteNode( node );
            node = 0;
        }
        if ( node ) {
            this->InsertEndChild( node );
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, -0x50(%rbp)
movq %rsi, %r13
movq %rdi, %r14
testq %r13, %r13
je 0xda6c
cmpb $0x0, (%r13)
je 0xda6c
movq $0x0, -0x30(%rbp)
movq 0x8(%r14), %rdi
movq %r13, %rsi
leaq -0x30(%rbp), %rdx
callq 0xcf46
testq %rax, %rax
je 0xda6c
movq -0x30(%rbp), %r15
testq %r15, %r15
je 0xda6c
movl $0x0, -0x48(%rbp)
leaq -0x40(%rbp), %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
movq (%r15), %rcx
movq %r15, %rdi
movq %rax, %rsi
leaq -0x48(%rbp), %rdx
callq *0x78(%rcx)
movq %rax, %r13
testq %rax, %rax
je 0xd928
movq (%r15), %rax
movq %r15, %rdi
callq *(%rax)
testq %rax, %rax
je 0xda2b
movl 0x58(%rax), %ecx
cmpl $0x2, %ecx
jne 0xd96b
movq -0x50(%rbp), %rsi
testq %rsi, %rsi
je 0xd8f4
addq $0x18, %rax
movq %rax, %rdi
callq 0xc68c
movq 0x50(%r15), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
movq (%r15), %rax
movq 0x50(%r15), %rbx
movq %r15, %rdi
callq *0x80(%rax)
movq (%rbx), %rax
movl $0x1, %r12d
movq %rbx, %rdi
movq %r15, %rsi
callq *0x20(%rax)
movq %r13, %rbx
jmp 0xda39
movq (%r15), %rax
movq 0x50(%r15), %r12
movq %r15, %rdi
callq *0x80(%rax)
movq (%r12), %rax
movq %r12, %rdi
movq %r15, %rsi
callq *0x20(%rax)
movq 0x8(%r14), %rax
movl $0x3, %r12d
cmpl $0x0, 0x5c(%rax)
jne 0xd963
movl $0x11, 0x5c(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x68(%rax)
xorl %r13d, %r13d
jmp 0xda39
movq -0x40(%rbp), %rax
cmpq -0x38(%rbp), %rax
je 0xda27
testl %ecx, %ecx
jne 0xd9d6
leaq -0x48(%rbp), %rdi
callq 0xc97e
movq %rax, %r12
leaq 0x18(%r15), %rdi
callq 0xc97e
cmpq %rax, %r12
je 0xda2b
movb (%r12), %dl
testb %dl, %dl
je 0xd9d1
xorl %ecx, %ecx
cmpb (%rax,%rcx), %dl
jne 0xda58
cmpl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
je 0xda58
movb 0x1(%r12,%rcx), %dl
incq %rcx
testb %dl, %dl
jne 0xd9a5
cmpl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
je 0xda2b
addq %rcx, %rax
cmpb $0x0, (%rax)
je 0xda2b
movq 0x8(%r14), %r12
leaq 0x18(%r15), %rdi
callq 0xc97e
movl $0x10, 0x5c(%r12)
movq %rax, 0x68(%r12)
movq $0x0, 0x70(%r12)
movq (%r15), %rax
movq 0x50(%r15), %r12
movq %r15, %rdi
callq *0x80(%rax)
movq (%r12), %rax
movq %r12, %rdi
movq %r15, %rsi
callq *0x20(%rax)
movq $0x0, -0x30(%rbp)
xorl %r13d, %r13d
xorl %r12d, %r12d
jmp 0xda39
testl %ecx, %ecx
je 0xd9d6
xorl %r12d, %r12d
movq %r14, %rdi
movq %r15, %rsi
callq 0xd49e
testb $0x2, -0x47(%rbp)
je 0xda4d
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0xda4d
callq 0x4280
testl %r12d, %r12d
je 0xd857
jmp 0xda66
cmpl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
jne 0xd9d6
jmp 0xda2b
cmpl $0x1, %r12d
je 0xda6e
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xda82
movq %rax, %rbx
testb $0x2, -0x47(%rbp)
je 0xda99
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0xda99
callq 0x4280
movq %rbx, %rdi
callq 0x43d0
nop