// File: /workspace/github_cpp_makefile_star2_O1/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 $0x38, %rsp
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r14
movq %rdx, -0x30(%rbp)
testq %r13, %r13
je 0xdc79
cmpb $0x0, (%r13)
je 0xdc79
movq $0x0, -0x38(%rbp)
movq 0x8(%r14), %rdi
movq %r13, %rsi
leaq -0x38(%rbp), %rdx
callq 0xcfa6
movq %rax, %r13
testq %rax, %rax
sete %al
movq -0x38(%rbp), %r12
testq %r12, %r12
sete %cl
orb %al, %cl
movl $0x3, %r15d
jne 0xdc5c
movl $0x0, -0x50(%rbp)
leaq -0x48(%rbp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq (%r12), %rax
movq %r12, %rdi
movq %r13, %rsi
leaq -0x50(%rbp), %rdx
callq *0x78(%rax)
movq %rax, %r13
testq %rax, %rax
je 0xdae9
movq (%r12), %rax
movq %r12, %rdi
callq *(%rax)
testq %rax, %rax
je 0xdbf4
movl 0x58(%rax), %ecx
cmpl $0x2, %ecx
jne 0xdb33
testq %rbx, %rbx
je 0xdaad
addq $0x18, %rax
movq %rax, %rdi
movq %rbx, %rsi
callq 0xc694
movq 0x50(%r12), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
movq (%r12), %rax
movq 0x50(%r12), %rbx
movq %r12, %rdi
callq *0x80(%rax)
movq (%rbx), %rax
movl $0x1, %r15d
movq %rbx, %rdi
movq -0x30(%rbp), %rbx
movq %r12, %rsi
callq *0x20(%rax)
movq %r13, -0x58(%rbp)
jmp 0xdc37
movq (%r12), %rax
movq 0x50(%r12), %rbx
movq %r12, %rdi
callq *0x80(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq -0x30(%rbp), %rbx
movq %r12, %rsi
callq *0x20(%rax)
movq $0x0, -0x38(%rbp)
movq 0x8(%r14), %rax
cmpl $0x0, 0x5c(%rax)
jne 0xdb2b
movl $0x11, 0x5c(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x68(%rax)
xorl %r13d, %r13d
jmp 0xdc37
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rdx
cmpq %rdx, %rax
sete %sil
testl %ecx, %ecx
sete %cl
cmpb %sil, %cl
je 0xdbca
cmpq %rdx, %rax
je 0xdbf4
leaq -0x50(%rbp), %rdi
callq 0xc988
movq %rax, %rbx
leaq 0x18(%r12), %rdi
callq 0xc988
cmpq %rax, %rbx
je 0xdc67
movb (%rbx), %dl
testb %dl, %dl
sete %cl
je 0xdbb6
cmpb (%rax), %dl
jne 0xdbb6
movl $0x1, %esi
movq %rsi, %rdx
movb (%rbx,%rsi), %sil
testb %sil, %sil
sete %cl
je 0xdba7
cmpb (%rax,%rdx), %sil
jne 0xdba7
leaq 0x1(%rdx), %rsi
cmpl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
jne 0xdb86
cmpl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
sete %sil
addq %rdx, %rax
jmp 0xdbb8
xorl %esi, %esi
testb %sil, %sil
movq -0x30(%rbp), %rbx
jne 0xdbf4
testb %cl, %cl
je 0xdbca
cmpb $0x0, (%rax)
je 0xdbf4
movq 0x8(%r14), %rbx
movq %r12, %rdi
addq $0x18, %rdi
callq 0xc988
movl $0x10, 0x5c(%rbx)
movq %rax, 0x68(%rbx)
movq $0x0, 0x70(%rbx)
movq -0x30(%rbp), %rbx
xorl %r13d, %r13d
testq %r13, %r13
jne 0xdc23
movq (%r12), %rax
movq 0x50(%r12), %rbx
movq %r12, %rdi
callq *0x80(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
movq -0x30(%rbp), %rbx
movq %r12, %rsi
callq *0x20(%rax)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rsi
xorl %r15d, %r15d
testq %rsi, %rsi
je 0xdc37
movq %r14, %rdi
callq 0xd538
testb $0x2, -0x4f(%rbp)
je 0xdc4b
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0xdc4b
callq 0x4280
movl $0x0, -0x50(%rbp)
leaq -0x48(%rbp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
testl %r15d, %r15d
je 0xda04
jmp 0xdc6d
movq -0x30(%rbp), %rbx
jmp 0xdbf4
cmpl $0x1, %r15d
jne 0xdc79
movq -0x58(%rbp), %rax
jmp 0xdc7b
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xdc8c
movq %rax, %rbx
testb $0x2, -0x4f(%rbp)
je 0xdca3
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0xdca3
callq 0x4280
movl $0x0, -0x50(%rbp)
xorps %xmm0, %xmm0
leaq -0x48(%rbp), %rax
movups %xmm0, (%rax)
movq %rbx, %rdi
callq 0x43d0