// File: /workspace/github_cpp_makefile_star2_O1/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 $0x18, %rsp
movq %rdi, %rbx
testb $0x1, 0x1(%rdi)
je 0xcb10
movq 0x10(%rbx), %rax
movb $0x0, (%rax)
movl (%rbx), %eax
movl $0x100, %ecx            # imm = 0x100
movl %eax, %edx
xorl %ecx, %edx
movl %edx, (%rbx)
cmpl %ecx, %eax
je 0xcafd
movq 0x8(%rbx), %r13
cmpq 0x10(%rbx), %r13
jae 0xcaf6
movq %r13, %r15
movq %rbx, -0x40(%rbp)
movl (%rbx), %eax
testb $0x2, %al
jne 0xca42
testb $0x1, %al
je 0xca36
cmpb $0x26, (%r13)
jne 0xca36
cmpb $0x23, 0x1(%r13)
jne 0xca8a
movw $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movl $0x0, -0x2c(%rbp)
movq %r13, %rdi
leaq -0x38(%rbp), %r14
movq %r14, %rsi
leaq -0x2c(%rbp), %rdx
callq 0xcb24
movq %rax, %r13
movslq -0x2c(%rbp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x4190
movslq -0x2c(%rbp), %rax
addq %rax, %r15
jmp 0xca61
movb (%r13), %al
movb %al, (%r15)
incq %r13
jmp 0xca5e
cmpb $0xd, (%r13)
jne 0xca70
cmpb $0xa, 0x1(%r13)
leaq 0x2(%r13), %rax
leaq 0x1(%r13), %r13
cmoveq %rax, %r13
movb $0xa, (%r15)
incq %r15
cmpq 0x10(%rbx), %r13
jb 0xc9d7
jmp 0xcaf9
testb $0x2, %al
je 0xc9dd
cmpb $0xa, (%r13)
jne 0xc9dd
cmpb $0xd, 0x1(%r13)
jmp 0xca4e
leaq 0xcb5b(%rip), %rbx      # 0x195ec
xorl %r14d, %r14d
leaq 0x1(%r13), %rdi
movq -0xc(%rbx), %rsi
movslq -0x4(%rbx), %r12
movq %r12, %rdx
callq 0x4110
movb $0x1, %cl
testl %eax, %eax
jne 0xcac7
cmpb $0x3b, 0x1(%r13,%r12)
jne 0xcac7
movb (%rbx), %al
movb %al, (%r15)
incq %r15
addq %r12, %r13
addq $0x2, %r13
xorl %ecx, %ecx
testb %cl, %cl
je 0xcade
incq %r14
addq $0x10, %rbx
cmpq $0x5, %r14
jne 0xca94
movl $0x5, %r14d
xorl %eax, %eax
cmpl $0x5, %r14d
sete %al
addq %rax, %r15
addq %rax, %r13
movq -0x40(%rbp), %rbx
jmp 0xca61
movq %r13, %r15
movb $0x0, (%r15)
testb $0x4, (%rbx)
je 0xcb0a
movq %rbx, %rdi
callq 0xc8ea
andl $0x200, (%rbx)          # imm = 0x200
movq 0x8(%rbx), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop