// File: /workspace/github_cpp_makefile_star2_O2/halsafar[P]libtmx-parser/./libs/tinyxml2/tinyxml2.cpp
// Function: tinyxml2::XMLElement::ParseAttributes(char*)
char* XMLElement::ParseAttributes( char* p )
{
    const char* start = p;
    XMLAttribute* prevAttribute = 0;

    // Read the attributes.
    while( p ) {
        p = XMLUtil::SkipWhiteSpace( p );
        if ( !p || !(*p) ) {
            _document->SetError( XML_ERROR_PARSING_ELEMENT, start, Name() );
            return 0;
        }

        // attribute.
        if (XMLUtil::IsNameStartChar( *p ) ) {
            XMLAttribute* attrib = new (_document->_attributePool.Alloc() ) XMLAttribute();
            attrib->_memPool = &_document->_attributePool;
			attrib->_memPool->SetTracked();

            p = attrib->ParseDeep( p, _document->ProcessEntities() );
            if ( !p || Attribute( attrib->Name() ) ) {
                DeleteAttribute( attrib );
                _document->SetError( XML_ERROR_PARSING_ATTRIBUTE, start, p );
                return 0;
            }
            // There is a minor bug here: if the attribute in the source xml
            // document is duplicated, it will not be detected and the
            // attribute will be doubly added. However, tracking the 'prevAttribute'
            // avoids re-scanning the attribute list. Preferring performance for
            // now, may reconsider in the future.
            if ( prevAttribute ) {
                prevAttribute->_next = attrib;
            }
            else {
                _rootAttribute = attrib;
            }
            prevAttribute = attrib;
        }
        // end of the tag
        else if ( *p == '/' && *(p+1) == '>' ) {
            _closingType = CLOSED;
            return p+2;	// done; sealed element.
        }
        // end of the tag
        else if ( *p == '>' ) {
            ++p;
            break;
        }
        else {
            _document->SetError( XML_ERROR_PARSING_ELEMENT, start, p );
            return 0;
        }
    }
    return p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r12
movq %rdi, %r14
leaq 0x60(%rdi), %rax
movq %rax, -0x38(%rbp)
movq %rsi, -0x30(%rbp)
xorl %r15d, %r15d
movl $0x100, %ebx            # imm = 0x100
testq %r12, %r12
je 0xcf24
movq %r12, %rdi
callq 0xe6ba
testq %rax, %rax
je 0xceae
movq %rax, %r12
movb (%rax), %al
testb %al, %al
je 0xceae
movzbl %al, %edi
callq 0xe2f6
testb %al, %al
je 0xcee8
movq 0x8(%r14), %rdi
addq %rbx, %rdi
callq 0xe54a
movq %rax, %r13
leaq 0xbdc8(%rip), %rax      # 0x18bf0
movq %rax, (%r13)
andl $0x0, 0x8(%r13)
andl $0x0, 0x20(%r13)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r13)
movups %xmm0, 0x28(%r13)
movups %xmm0, 0x38(%r13)
movq 0x8(%r14), %rax
leaq (%rax,%rbx), %rdi
movq %rdi, 0x40(%r13)
movq 0x100(%rax), %rax
callq *0x28(%rax)
movq 0x8(%r14), %rax
movzbl 0x59(%rax), %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0xc488
movq %rax, %r12
testq %rax, %rax
je 0xced3
movq %r13, %rdi
addq $0x8, %rdi
callq 0xb0b2
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xc8a0
testq %rax, %rax
jne 0xced3
leaq 0x38(%r15), %rax
testq %r15, %r15
cmoveq -0x38(%rbp), %rax
movq %r13, (%rax)
movq %r13, %r15
jmp 0xcddb
movq 0x8(%r14), %rbx
addq $0x18, %r14
movq %r14, %rdi
callq 0xb0b2
movl $0x7, 0x5c(%rbx)
movq -0x30(%rbp), %rcx
movq %rcx, 0x68(%rbx)
movq %rax, 0x70(%rbx)
jmp 0xcf24
movq %r13, %rdi
callq 0xc7d0
movq 0x8(%r14), %rax
movl $0x8, 0x5c(%rax)
jmp 0xcf18
movzbl (%r12), %eax
cmpl $0x3e, %eax
je 0xcf35
cmpl $0x2f, %eax
jne 0xcf0d
cmpb $0x3e, 0x1(%r12)
jne 0xcf0d
movl $0x1, 0x58(%r14)
addq $0x2, %r12
jmp 0xcf38
movq 0x8(%r14), %rax
movl $0x7, 0x5c(%rax)
movq -0x30(%rbp), %rcx
movq %rcx, 0x68(%rax)
movq %r12, 0x70(%rax)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
incq %r12
movq %r12, %rax
jmp 0xcf26
nop