// File: /workspace/github_cpp_makefile_star2_O3/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
testq %rsi, %rsi
je 0xf085
movq %rdi, %r14
leaq 0x60(%rdi), %rax
movq %rax, -0x38(%rbp)
xorl %ebx, %ebx
movq %rsi, -0x30(%rbp)
movq %rsi, %r15
movb (%r15), %al
testb %al, %al
js 0xeeff
incq %r15
movq %r15, %r12
movzbl %al, %r13d
movl %r13d, %edi
callq 0x4060
testl %eax, %eax
je 0xeeca
movb (%r12), %al
incq %r12
testb %al, %al
jns 0xeea7
decq %r12
movq %r12, %r15
jmp 0xeeff
testl %r13d, %r13d
je 0xf024
leaq -0x1(%r12), %r15
movl %r13d, %edi
callq 0x4370
testl %eax, %eax
jne 0xeeff
cmpl $0x3d, %r13d
jg 0xeef5
cmpl $0x3a, %r13d
je 0xeeff
jmp 0xf051
cmpl $0x5f, %r13d
jne 0xf049
movq 0x8(%r14), %rdi
movl $0x100, %r13d           # imm = 0x100
addq %r13, %rdi
callq 0x1088e
movq %rax, %r12
leaq 0xacc5(%rip), %rax      # 0x19be0
movq %rax, (%r12)
xorl %eax, %eax
movl %eax, 0x8(%r12)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r12)
movl %eax, 0x20(%r12)
movups %xmm0, 0x28(%r12)
movups %xmm0, 0x38(%r12)
movq 0x8(%r14), %rax
leaq (%rax,%r13), %rdi
movq %rdi, 0x40(%r12)
movq 0x100(%rax), %rax
callq *0x28(%rax)
movq 0x8(%r14), %rax
movzbl 0x59(%rax), %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0xe2c6
testq %rax, %rax
je 0xefb6
movq %rax, %r15
movq %r12, %rdi
addq $0x8, %rdi
callq 0xc97e
movq %r14, %rdi
movq %rax, %rsi
callq 0xe794
testq %rax, %rax
je 0xef9f
addq $0x20, %rax
movq %rax, %rdi
callq 0xc97e
testq %rax, %rax
jne 0xeff0
leaq 0x38(%rbx), %rax
testq %rbx, %rbx
cmoveq -0x38(%rbp), %rax
movq %r12, (%rax)
movq %r12, %rbx
jmp 0xee9a
movq (%r12), %rax
movq 0x40(%r12), %r15
movq %r12, %rdi
callq *(%rax)
movq (%r15), %rax
movq %r15, %rdi
movq %r12, %rsi
callq *0x20(%rax)
movq 0x8(%r14), %rax
movl $0x8, 0x5c(%rax)
movq -0x30(%rbp), %rcx
movq %rcx, 0x68(%rax)
movq $0x0, 0x70(%rax)
jmp 0xf085
movq (%r12), %rax
movq 0x40(%r12), %r13
movq %r12, %rdi
callq *(%rax)
movq (%r13), %rax
movq %r13, %rdi
movq %r12, %rsi
callq *0x20(%rax)
movq 0x8(%r14), %rax
movl $0x8, 0x5c(%rax)
movq -0x30(%rbp), %rcx
movq %rcx, 0x68(%rax)
movq %r15, 0x70(%rax)
jmp 0xf085
movq 0x8(%r14), %rbx
addq $0x18, %r14
movq %r14, %rdi
callq 0xc97e
movl $0x7, 0x5c(%rbx)
movq -0x30(%rbp), %rcx
movq %rcx, 0x68(%rbx)
movq %rax, 0x70(%rbx)
jmp 0xf085
cmpl $0x3e, %r13d
je 0xf088
jmp 0xf06b
cmpl $0x2f, %r13d
jne 0xf06b
cmpb $0x3e, (%r12)
jne 0xf06b
movl $0x1, 0x58(%r14)
incq %r12
jmp 0xf088
movq 0x8(%r14), %rax
movl $0x7, 0x5c(%rax)
movq -0x30(%rbp), %rcx
movq %rcx, 0x68(%rax)
decq %r12
movq %r12, 0x70(%rax)
xorl %r12d, %r12d
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq