// File: /workspace/github_cpp_makefile_star2_O3/halsafar[P]libtmx-parser/./libs/tinyxml2/tinyxml2.cpp
// Function: tinyxml2::StrPair::GetStr()
const char* StrPair::GetStr()
{
    if ( _flags & NEEDS_FLUSH ) {
        *_end = 0;
        _flags ^= NEEDS_FLUSH;

        if ( _flags ) {
            char* p = _start;	// the read pointer
            char* q = _start;	// the write pointer

            while( p < _end ) {
                if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == CR ) {
                    // CR-LF pair becomes LF
                    // CR alone becomes LF
                    // LF-CR becomes LF
                    if ( *(p+1) == LF ) {
                        p += 2;
                    }
                    else {
                        ++p;
                    }
                    *q++ = LF;
                }
                else if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == LF ) {
                    if ( *(p+1) == CR ) {
                        p += 2;
                    }
                    else {
                        ++p;
                    }
                    *q++ = LF;
                }
                else if ( (_flags & NEEDS_ENTITY_PROCESSING) && *p == '&' ) {
                    // Entities handled by tinyXML2:
                    // - special entities in the entity table [in/out]
                    // - numeric character reference [in]
                    //   &#20013; or &#x4e2d;

                    if ( *(p+1) == '#' ) {
                        const int buflen = 10;
                        char buf[buflen] = { 0 };
                        int len = 0;
                        p = const_cast<char*>( XMLUtil::GetCharacterRef( p, buf, &len ) );
                        TIXMLASSERT( 0 <= len && len <= buflen );
                        TIXMLASSERT( q + len <= p );
                        memcpy( q, buf, len );
                        q += len;
                    }
                    else {
                        int i=0;
                        for(; i<NUM_ENTITIES; ++i ) {
                            const Entity& entity = entities[i];
                            if ( strncmp( p + 1, entity.pattern, entity.length ) == 0
                                    && *( p + entity.length + 1 ) == ';' ) {
                                // Found an entity - convert.
                                *q = entity.value;
                                ++q;
                                p += entity.length + 2;
                                break;
                            }
                        }
                        if ( i == NUM_ENTITIES ) {
                            // fixme: treat as error?
                            ++p;
                            ++q;
                        }
                    }
                }
                else {
                    *q = *p;
                    ++p;
                    ++q;
                }
            }
            *q = 0;
        }
        // The loop below has plenty going on, and this
        // is a less useful mode. Break it out.
        if ( _flags & COLLAPSE_WHITESPACE ) {
            CollapseWhitespace();
        }
        _flags = (_flags & NEEDS_DELETE);
    }
    return _start;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
testb $0x1, 0x1(%rdi)
je 0xcb09
movq 0x10(%r14), %rax
movb $0x0, (%rax)
movl (%r14), %ecx
movl $0x100, %edx            # imm = 0x100
movl %ecx, %eax
xorl %edx, %eax
movl %eax, (%r14)
xorl %eax, %eax
cmpl %edx, %ecx
je 0xcb01
movq 0x8(%r14), %r13
cmpq 0x10(%r14), %r13
jae 0xcae7
leaq 0xcc0f(%rip), %rbx      # 0x195e0
movq %r13, %r12
movq %r14, -0x50(%rbp)
movl (%r14), %ecx
movb (%r13), %al
testb $0x2, %cl
je 0xc9f8
movzbl %al, %edx
cmpl $0xa, %edx
je 0xca54
cmpl $0xd, %edx
jne 0xc9f8
cmpb $0xa, 0x1(%r13)
jmp 0xca59
testb $0x1, %cl
je 0xca4b
cmpb $0x26, %al
jne 0xca4b
cmpb $0x23, 0x1(%r13)
jne 0xca79
movw $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movl $0x0, -0x2c(%rbp)
movq %r13, %rdi
leaq -0x48(%rbp), %r15
movq %r15, %rsi
leaq -0x2c(%rbp), %rdx
callq 0xcb1c
movq %rax, %r13
movslq -0x2c(%rbp), %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x4190
movslq -0x2c(%rbp), %rax
addq %rax, %r12
jmp 0xca6d
movb %al, (%r12)
incq %r13
jmp 0xca6a
cmpb $0xd, 0x1(%r13)
leaq 0x2(%r13), %rax
leaq 0x1(%r13), %r13
cmoveq %rax, %r13
movb $0xa, (%r12)
incq %r12
cmpq 0x10(%r14), %r13
jb 0xc9d8
jmp 0xcaea
movq %r12, -0x38(%rbp)
leaq 0x1(%r13), %r12
movl $0xc, %r14d
movq -0xc(%r14,%rbx), %rsi
movslq -0x4(%r14,%rbx), %r15
movq %r12, %rdi
movq %r15, %rdx
callq 0x4110
testl %eax, %eax
jne 0xcaa7
cmpb $0x3b, (%r12,%r15)
je 0xcabc
addq $0x10, %r14
cmpq $0x5c, %r14
jne 0xca87
movl $0x1, %eax
movq -0x38(%rbp), %r12
jmp 0xcadb
movb (%r14,%rbx), %al
movq -0x38(%rbp), %r12
movb %al, (%r12)
incq %r12
addq %r15, %r13
addq $0x2, %r13
xorl %eax, %eax
cmpq $0x5c, %r14
sete %al
addq %rax, %r12
addq %rax, %r13
movq -0x50(%rbp), %r14
jmp 0xca6d
movq %r13, %r12
movb $0x0, (%r12)
movl (%r14), %eax
testb $0x4, %al
je 0xcb01
movq %r14, %rdi
callq 0xc8e4
movl (%r14), %eax
andl $0x200, %eax            # imm = 0x200
movl %eax, (%r14)
movq 0x8(%r14), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq