// File: jliesch[P]ofxget/pugixml/pugixml.cpp
// Function: pugi::impl::(anonymous namespace)::utf8_counter::value_type pugi::impl::(anonymous namespace)::utf16_decoder<pugi::impl::(anonymous namespace)::opt_false>::process<pugi::impl::(anonymous namespace)::utf8_counter>(unsigned short const*, unsigned long, pugi::impl::(anonymous namespace)::utf8_counter::value_type, pugi::impl::(anonymous namespace)::utf8_counter)
static inline typename Traits::value_type process(const uint16_t* data, size_t size, typename Traits::value_type result, Traits)
		{
			while (size)
			{
				uint16_t lead = opt_swap::value ? endian_swap(*data) : *data;

				// U+0000..U+D7FF
				if (lead < 0xD800)
				{
					result = Traits::low(result, lead);
					data += 1;
					size -= 1;
				}
				// U+E000..U+FFFF
				else if (static_cast<unsigned int>(lead - 0xE000) < 0x2000)
				{
					result = Traits::low(result, lead);
					data += 1;
					size -= 1;
				}
				// surrogate pair lead
				else if (static_cast<unsigned int>(lead - 0xD800) < 0x400 && size >= 2)
				{
					uint16_t next = opt_swap::value ? endian_swap(data[1]) : data[1];

					if (static_cast<unsigned int>(next - 0xDC00) < 0x400)
					{
						result = Traits::high(result, 0x10000 + ((lead & 0x3ff) << 10) + (next & 0x3ff));
						data += 2;
						size -= 2;
					}
					else
					{
						data += 1;
						size -= 1;
					}
				}
				else
				{
					data += 1;
					size -= 1;
				}
			}

			return result;
		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x515d8
movq -0x10(%rbp), %rax
movw (%rax), %ax
movw %ax, -0x22(%rbp)
movzwl -0x22(%rbp), %eax
cmpl $0xd800, %eax           # imm = 0xD800
jge 0x514e3
movq -0x20(%rbp), %rdi
movzwl -0x22(%rbp), %esi
callq 0x51760
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x515d3
movzwl -0x22(%rbp), %eax
subl $0xe000, %eax           # imm = 0xE000
cmpl $0x2000, %eax           # imm = 0x2000
jae 0x51521
movq -0x20(%rbp), %rdi
movzwl -0x22(%rbp), %esi
callq 0x51760
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x515d1
movzwl -0x22(%rbp), %eax
subl $0xd800, %eax           # imm = 0xD800
cmpl $0x400, %eax            # imm = 0x400
jae 0x515b7
cmpq $0x2, -0x18(%rbp)
jb 0x515b7
movq -0x10(%rbp), %rax
movw 0x2(%rax), %ax
movw %ax, -0x24(%rbp)
movzwl -0x24(%rbp), %eax
subl $0xdc00, %eax           # imm = 0xDC00
cmpl $0x400, %eax            # imm = 0x400
jae 0x5159d
movq -0x20(%rbp), %rdi
movzwl -0x22(%rbp), %esi
andl $0x3ff, %esi            # imm = 0x3FF
shll $0xa, %esi
addl $0x10000, %esi          # imm = 0x10000
movzwl -0x24(%rbp), %eax
andl $0x3ff, %eax            # imm = 0x3FF
addl %eax, %esi
callq 0x517b0
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
subq $0x2, %rax
movq %rax, -0x18(%rbp)
jmp 0x515b5
movq -0x10(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x515cf
movq -0x10(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x515d1
jmp 0x515d3
jmp 0x51494
movq -0x20(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)