// File: Matlock42[P]Jeopardy/./RapidXml/rapidxml.hpp
// Function: void rapidxml::xml_document<char>::insert_coded_character<0>(char*&, unsigned long)
static void insert_coded_character(Ch *&text, unsigned long code)
        {
            if (Flags & parse_no_utf8)
            {
                // Insert 8-bit ASCII character
                // Todo: possibly verify that code is less than 256 and use replacement char otherwise?
                text[0] = static_cast<unsigned char>(code);
                text += 1;
            }
            else
            {
                // Insert UTF8 sequence
                if (code < 0x80)    // 1 byte sequence
                {
	                text[0] = static_cast<unsigned char>(code);
                    text += 1;
                }
                else if (code < 0x800)  // 2 byte sequence
                {
	                text[1] = static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6;
	                text[0] = static_cast<unsigned char>(code | 0xC0);
                    text += 2;
                }
	            else if (code < 0x10000)    // 3 byte sequence
                {
	                text[2] = static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6;
	                text[1] = static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6;
	                text[0] = static_cast<unsigned char>(code | 0xE0);
                    text += 3;
                }
	            else if (code < 0x110000)   // 4 byte sequence
                {
	                text[3] = static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6;
	                text[2] = static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6;
	                text[1] = static_cast<unsigned char>((code | 0x80) & 0xBF); code >>= 6;
	                text[0] = static_cast<unsigned char>(code | 0xF0);
                    text += 4;
                }
                else    // Invalid, only codes up to 0x10FFFF are allowed in Unicode
                {
                    RAPIDXML_PARSE_ERROR("invalid numeric character entity", text);
                }
            }
        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x80, -0x10(%rbp)
jae 0x9e7c
movq -0x10(%rbp), %rax
movb %al, %cl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movb %cl, (%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0xa060
cmpq $0x800, -0x10(%rbp)     # imm = 0x800
jae 0x9ed6
movq -0x10(%rbp), %rax
orq $0x80, %rax
andq $0xbf, %rax
movb %al, %cl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movb %cl, 0x1(%rax)
movq -0x10(%rbp), %rax
shrq $0x6, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
orq $0xc0, %rax
movb %al, %cl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movb %cl, (%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x2, %rcx
movq %rcx, (%rax)
jmp 0xa05e
cmpq $0x10000, -0x10(%rbp)   # imm = 0x10000
jae 0x9f58
movq -0x10(%rbp), %rax
orq $0x80, %rax
andq $0xbf, %rax
movb %al, %cl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movb %cl, 0x2(%rax)
movq -0x10(%rbp), %rax
shrq $0x6, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
orq $0x80, %rax
andq $0xbf, %rax
movb %al, %cl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movb %cl, 0x1(%rax)
movq -0x10(%rbp), %rax
shrq $0x6, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
orq $0xe0, %rax
movb %al, %cl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movb %cl, (%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x3, %rcx
movq %rcx, (%rax)
jmp 0xa05c
cmpq $0x110000, -0x10(%rbp)  # imm = 0x110000
jae 0xa003
movq -0x10(%rbp), %rax
orq $0x80, %rax
andq $0xbf, %rax
movb %al, %cl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movb %cl, 0x3(%rax)
movq -0x10(%rbp), %rax
shrq $0x6, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
orq $0x80, %rax
andq $0xbf, %rax
movb %al, %cl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movb %cl, 0x2(%rax)
movq -0x10(%rbp), %rax
shrq $0x6, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
orq $0x80, %rax
andq $0xbf, %rax
movb %al, %cl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movb %cl, 0x1(%rax)
movq -0x10(%rbp), %rax
shrq $0x6, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
orq $0xf0, %rax
movb %al, %cl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movb %cl, (%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x4, %rcx
movq %rcx, (%rax)
jmp 0xa05a
movl $0x18, %edi
callq 0x3120
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdx
leaq 0x24b2(%rip), %rsi      # 0xc4d7
callq 0x81b0
jmp 0xa02c
movq -0x28(%rbp), %rdi
leaq 0x7d21(%rip), %rsi      # 0x11d58
leaq -0x1e3e(%rip), %rdx     # 0x8200
callq 0x3470
movq -0x28(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
callq 0x31e0
jmp 0xa066
jmp 0xa05c
jmp 0xa05e
jmp 0xa060
addq $0x30, %rsp
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0x34a0
nop