// File: halsafar[P]libtmx-parser/./libs/tinyxml2/tinyxml2.cpp
// Function: tinyxml2::XMLPrinter::PrintString(char const*, bool)
void XMLPrinter::PrintString( const char* p, bool restricted )
{
    // Look for runs of bytes between entities to print.
    const char* q = p;
    const bool* flag = restricted ? _restrictedEntityFlag : _entityFlag;

    if ( _processEntities ) {
        while ( *q ) {
            // Remember, char is sometimes signed. (How many times has that bitten me?)
            if ( *q > 0 && *q < ENTITY_RANGE ) {
                // Check for entities. If one is found, flush
                // the stream up until the entity, write the
                // entity, and keep looking.
                if ( flag[(unsigned)(*q)] ) {
                    while ( p < q ) {
                        Print( "%c", *p );
                        ++p;
                    }
                    for( int i=0; i<NUM_ENTITIES; ++i ) {
                        if ( entities[i].value == *q ) {
                            Print( "&%s;", entities[i].pattern );
                            break;
                        }
                    }
                    ++p;
                }
            }
            ++q;
        }
    }
    // Flush the remaining string. This will be the entire
    // string if an entity wasn't found.
    if ( !_processEntities || (q-p > 0) ) {
        Print( "%s", p );
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
testb $0x1, -0x11(%rbp)
je 0x1e15d
movq -0x38(%rbp), %rax
addq $0xca, %rax
movq %rax, -0x40(%rbp)
jmp 0x1e16b
movq -0x38(%rbp), %rax
addq $0x8a, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, -0x28(%rbp)
testb $0x1, 0x88(%rax)
je 0x1e282
jmp 0x1e186
movq -0x20(%rbp), %rax
cmpb $0x0, (%rax)
je 0x1e280
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jle 0x1e26f
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x40, %eax
jge 0x1e26f
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movsbl (%rcx), %ecx
movl %ecx, %ecx
testb $0x1, (%rax,%rcx)
je 0x1e26d
jmp 0x1e1cc
movq -0x10(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x1e1fd
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rax
movsbl (%rax), %edx
leaq 0x4acc(%rip), %rsi      # 0x22cb4
movb $0x0, %al
callq 0x1dfa0
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x1e1cc
movl $0x0, -0x2c(%rbp)
cmpl $0x5, -0x2c(%rbp)
jge 0x1e261
movslq -0x2c(%rbp), %rcx
leaq 0x1433b(%rip), %rax     # 0x32550
shlq $0x4, %rcx
addq %rcx, %rax
movsbl 0xc(%rax), %eax
movq -0x20(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x1e254
movq -0x38(%rbp), %rdi
movslq -0x2c(%rbp), %rcx
leaq 0x14316(%rip), %rax     # 0x32550
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdx
leaq 0x4a6c(%rip), %rsi      # 0x22cb7
movb $0x0, %al
callq 0x1dfa0
jmp 0x1e261
jmp 0x1e256
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x1e204
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x1e26f
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1e186
jmp 0x1e282
movq -0x38(%rbp), %rax
testb $0x1, 0x88(%rax)
je 0x1e2a0
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
cmpq $0x0, %rax
jle 0x1e2b6
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rdx
leaq 0x4a20(%rip), %rsi      # 0x22ccf
movb $0x0, %al
callq 0x1dfa0
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)