// File: jliesch[P]ofxget/pugixml/pugixml.cpp
// Function: pugi::impl::(anonymous namespace)::strconv_escape(char*, pugi::impl::(anonymous namespace)::gap&)
PUGI__FN char_t* strconv_escape(char_t* s, gap& g)
	{
		char_t* stre = s + 1;

		switch (*stre)
		{
			case '#':	// &#...
			{
				unsigned int ucsc = 0;

				if (stre[1] == 'x') // &#x... (hex code)
				{
					stre += 2;

					char_t ch = *stre;

					if (ch == ';') return stre;

					for (;;)
					{
						if (static_cast<unsigned int>(ch - '0') <= 9)
							ucsc = 16 * ucsc + (ch - '0');
						else if (static_cast<unsigned int>((ch | ' ') - 'a') <= 5)
							ucsc = 16 * ucsc + ((ch | ' ') - 'a' + 10);
						else if (ch == ';')
							break;
						else // cancel
							return stre;

						ch = *++stre;
					}

					++stre;
				}
				else	// &#... (dec code)
				{
					char_t ch = *++stre;

					if (ch == ';') return stre;

					for (;;)
					{
						if (static_cast<unsigned int>(ch - '0') <= 9)
							ucsc = 10 * ucsc + (ch - '0');
						else if (ch == ';')
							break;
						else // cancel
							return stre;

						ch = *++stre;
					}

					++stre;
				}

			#ifdef PUGIXML_WCHAR_MODE
				s = reinterpret_cast<char_t*>(wchar_writer::any(reinterpret_cast<wchar_writer::value_type>(s), ucsc));
			#else
				s = reinterpret_cast<char_t*>(utf8_writer::any(reinterpret_cast<uint8_t*>(s), ucsc));
			#endif

				g.push(s, stre - s);
				return stre;
			}

			case 'a':	// &a
			{
				++stre;

				if (*stre == 'm') // &am
				{
					if (*++stre == 'p' && *++stre == ';') // &amp;
					{
						*s++ = '&';
						++stre;

						g.push(s, stre - s);
						return stre;
					}
				}
				else if (*stre == 'p') // &ap
				{
					if (*++stre == 'o' && *++stre == 's' && *++stre == ';') // &apos;
					{
						*s++ = '\'';
						++stre;

						g.push(s, stre - s);
						return stre;
					}
				}
				break;
			}

			case 'g': // &g
			{
				if (*++stre == 't' && *++stre == ';') // &gt;
				{
					*s++ = '>';
					++stre;

					g.push(s, stre - s);
					return stre;
				}
				break;
			}

			case 'l': // &l
			{
				if (*++stre == 't' && *++stre == ';') // &lt;
				{
					*s++ = '<';
					++stre;

					g.push(s, stre - s);
					return stre;
				}
				break;
			}

			case 'q': // &q
			{
				if (*++stre == 'u' && *++stre == 'o' && *++stre == 't' && *++stre == ';') // &quot;
				{
					*s++ = '"';
					++stre;

					g.push(s, stre - s);
					return stre;
				}
				break;
			}

			default:
				break;
		}

		return stre;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
incq %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x2c(%rbp)
subl $0x23, %eax
je 0x54dc7
jmp 0x54d8c
movl -0x2c(%rbp), %eax
subl $0x61, %eax
je 0x54f52
jmp 0x54d9a
movl -0x2c(%rbp), %eax
subl $0x67, %eax
je 0x55086
jmp 0x54da8
movl -0x2c(%rbp), %eax
subl $0x6c, %eax
je 0x550fe
jmp 0x54db6
movl -0x2c(%rbp), %eax
subl $0x71, %eax
je 0x55176
jmp 0x5521c
movl $0x0, -0x24(%rbp)
movq -0x20(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x78, %eax
jne 0x54e97
movq -0x20(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movb (%rax), %al
movb %al, -0x25(%rbp)
movsbl -0x25(%rbp), %eax
cmpl $0x3b, %eax
jne 0x54e0a
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x55226
jmp 0x54e0c
movsbl -0x25(%rbp), %eax
subl $0x30, %eax
cmpl $0x9, %eax
ja 0x54e2c
movl -0x24(%rbp), %eax
shll $0x4, %eax
movsbl -0x25(%rbp), %ecx
subl $0x30, %ecx
addl %ecx, %eax
movl %eax, -0x24(%rbp)
jmp 0x54e6f
movsbl -0x25(%rbp), %eax
orl $0x20, %eax
subl $0x61, %eax
cmpl $0x5, %eax
ja 0x54e55
movl -0x24(%rbp), %eax
shll $0x4, %eax
movsbl -0x25(%rbp), %ecx
orl $0x20, %ecx
subl $0x61, %ecx
addl $0xa, %ecx
addl %ecx, %eax
movl %eax, -0x24(%rbp)
jmp 0x54e6d
movsbl -0x25(%rbp), %eax
cmpl $0x3b, %eax
jne 0x54e60
jmp 0x54e86
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x55226
jmp 0x54e6f
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movb 0x1(%rax), %al
movb %al, -0x25(%rbp)
jmp 0x54e0c
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x54f1d
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movb 0x1(%rax), %al
movb %al, -0x26(%rbp)
movsbl -0x26(%rbp), %eax
cmpl $0x3b, %eax
jne 0x54ec2
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x55226
jmp 0x54ec4
movsbl -0x26(%rbp), %eax
subl $0x30, %eax
cmpl $0x9, %eax
ja 0x54ee2
imull $0xa, -0x24(%rbp), %eax
movsbl -0x26(%rbp), %ecx
subl $0x30, %ecx
addl %ecx, %eax
movl %eax, -0x24(%rbp)
jmp 0x54efa
movsbl -0x26(%rbp), %eax
cmpl $0x3b, %eax
jne 0x54eed
jmp 0x54f11
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x55226
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movb 0x1(%rax), %al
movb %al, -0x26(%rbp)
jmp 0x54ec4
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x55230
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rax
subq %rax, %rdx
leaq -0x10(%rbp), %rsi
callq 0x55280
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x55226
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x6d, %eax
jne 0x54fe2
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x70, %eax
jne 0x54fdd
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x3b, %eax
jne 0x54fdd
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb $0x26, (%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rax
subq %rax, %rdx
leaq -0x10(%rbp), %rsi
callq 0x55280
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x55226
jmp 0x55081
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x70, %eax
jne 0x5507f
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x6f, %eax
jne 0x5507d
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x73, %eax
jne 0x5507d
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x3b, %eax
jne 0x5507d
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb $0x27, (%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rax
subq %rax, %rdx
leaq -0x10(%rbp), %rsi
callq 0x55280
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x55226
jmp 0x5507f
jmp 0x55081
jmp 0x5521e
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x74, %eax
jne 0x550f9
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x3b, %eax
jne 0x550f9
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb $0x3e, (%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rax
subq %rax, %rdx
leaq -0x10(%rbp), %rsi
callq 0x55280
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x55226
jmp 0x5521e
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x74, %eax
jne 0x55171
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x3b, %eax
jne 0x55171
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb $0x3c, (%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rax
subq %rax, %rdx
leaq -0x10(%rbp), %rsi
callq 0x55280
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x55226
jmp 0x5521e
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x75, %eax
jne 0x5521a
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x6f, %eax
jne 0x5521a
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x74, %eax
jne 0x5521a
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x3b, %eax
jne 0x5521a
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb $0x22, (%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rax
subq %rax, %rdx
leaq -0x10(%rbp), %rsi
callq 0x55280
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x55226
jmp 0x5521e
jmp 0x5521e
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq