// File: 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
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movl (%rax), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x19e6d
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rcx
movb $0x0, (%rcx)
movl (%rax), %ecx
xorl $0x100, %ecx            # imm = 0x100
movl %ecx, (%rax)
cmpl $0x0, (%rax)
je 0x19e48
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rcx
movq %rcx, -0x10(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
cmpq 0x10(%rcx), %rax
jae 0x19e41
movq -0x40(%rbp), %rax
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x19c70
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xd, %eax
jne 0x19c70
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0xa, %eax
jne 0x19c4d
movq -0x10(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x10(%rbp)
jmp 0x19c59
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movb $0xa, (%rax)
jmp 0x19e3c
movq -0x40(%rbp), %rax
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x19cc8
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x19cc8
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0xd, %eax
jne 0x19ca5
movq -0x10(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x10(%rbp)
jmp 0x19cb1
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movb $0xa, (%rax)
jmp 0x19e3a
movq -0x40(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x19e14
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x26, %eax
jne 0x19e14
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x23, %eax
jne 0x19d51
movl $0xa, -0x1c(%rbp)
leaq -0x26(%rbp), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x4170
movl $0x0, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x26(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x19e80
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x26(%rbp), %rsi
movslq -0x2c(%rbp), %rdx
callq 0x41f0
movl -0x2c(%rbp), %ecx
movq -0x18(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
jmp 0x19e12
movl $0x0, -0x30(%rbp)
cmpl $0x5, -0x30(%rbp)
jge 0x19df2
movslq -0x30(%rbp), %rcx
leaq 0x187e3(%rip), %rax     # 0x32550
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
addq $0x1, %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rsi
movq -0x38(%rbp), %rax
movslq 0x8(%rax), %rdx
callq 0x4150
cmpl $0x0, %eax
jne 0x19de2
movq -0x10(%rbp), %rax
movq -0x38(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movsbl 0x1(%rax,%rcx), %eax
cmpl $0x3b, %eax
jne 0x19de2
movq -0x38(%rbp), %rax
movb 0xc(%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, (%rax)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x38(%rbp), %rax
movl 0x8(%rax), %ecx
addl $0x2, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x19df2
jmp 0x19de4
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x19d58
cmpl $0x5, -0x30(%rbp)
jne 0x19e10
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x19e12
jmp 0x19e38
movq -0x10(%rbp), %rax
movb (%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, (%rax)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x19e3a
jmp 0x19e3c
jmp 0x19c06
movq -0x18(%rbp), %rax
movb $0x0, (%rax)
movq -0x40(%rbp), %rax
movl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x19e5f
movq -0x40(%rbp), %rdi
callq 0x19ad0
movq -0x40(%rbp), %rax
movl (%rax), %ecx
andl $0x200, %ecx            # imm = 0x200
movl %ecx, (%rax)
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)