// File: /workspace/github_cpp_makefile_star2_O2/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, %r15
movq %rdi, %r14
leaq -0x48(%rbp), %r13
testq %r15, %r15
je 0xbdb9
cmpb $0x0, (%r15)
je 0xbdb9
andq $0x0, -0x30(%rbp)
movq 0x8(%r14), %rdi
movq %r15, %rsi
leaq -0x30(%rbp), %rdx
callq 0xb5bc
testq %rax, %rax
je 0xbdb9
movq -0x30(%rbp), %rbx
testq %rbx, %rbx
je 0xbdb9
andl $0x0, -0x48(%rbp)
leaq -0x40(%rbp), %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
movq (%rbx), %rcx
movq %rbx, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq *0x78(%rcx)
movq %rax, %r15
testq %rax, %rax
je 0xbd90
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
testq %rax, %rax
je 0xbd78
movl 0x58(%rax), %ecx
cmpl $0x2, %ecx
je 0xbdce
movq -0x40(%rbp), %rax
cmpq -0x38(%rbp), %rax
je 0xbd74
testl %ecx, %ecx
jne 0xbd49
movq %r13, %rdi
callq 0xb0b2
movq %rax, %r12
leaq 0x18(%rbx), %rdi
callq 0xb0b2
movq %r12, %rdi
movq %rax, %rsi
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
callq 0xe378
testb %al, %al
jne 0xbd78
movq 0x8(%r14), %r15
leaq 0x18(%rbx), %rdi
callq 0xb0b2
movl $0x10, 0x5c(%r15)
movq %rax, 0x68(%r15)
andq $0x0, 0x70(%r15)
movq %rbx, %rdi
callq 0xb954
xorl %r15d, %r15d
jmp 0xbd83
testl %ecx, %ecx
je 0xbd49
movq %r14, %rdi
movq %rbx, %rsi
callq 0xb992
movq %r13, %rdi
callq 0xae7a
jmp 0xbc93
movq %rbx, %rdi
callq 0xb954
movq 0x8(%r14), %rax
cmpl $0x0, 0x5c(%rax)
jne 0xbdb0
movl $0x11, 0x5c(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x68(%rax)
leaq -0x48(%rbp), %rdi
callq 0xae7a
xorl %r15d, %r15d
movq %r15, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x50(%rbp), %rsi
testq %rsi, %rsi
je 0xbde3
addq $0x18, %rax
movq %rax, %rdi
callq 0xaea8
movq 0x50(%rbx), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
movq %rbx, %rdi
callq 0xb954
leaq -0x48(%rbp), %rdi
callq 0xae7a
jmp 0xbdbc
jmp 0xbe08
jmp 0xbe08
jmp 0xbe08
jmp 0xbe08
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0xae7a
movq %rbx, %rdi
callq 0x43d0