// File: /workspace/github_cpp_makefile_star2_O3/jliesch[P]ofxget/pugixml/pugixml.cpp
// Function: pugi::impl::(anonymous namespace)::parse_declaration_encoding(unsigned char const*, unsigned long, unsigned char const*&, unsigned long&)
PUGI__FN bool parse_declaration_encoding(const uint8_t* data, size_t size, const uint8_t*& out_encoding, size_t& out_length)
	{
	#define PUGI__SCANCHAR(ch) { if (offset >= size || data[offset] != ch) return false; offset++; }
	#define PUGI__SCANCHARTYPE(ct) { while (offset < size && PUGI__IS_CHARTYPE(data[offset], ct)) offset++; }

		// check if we have a non-empty XML declaration
		if (size < 6 || !((data[0] == '<') & (data[1] == '?') & (data[2] == 'x') & (data[3] == 'm') & (data[4] == 'l') && PUGI__IS_CHARTYPE(data[5], ct_space)))
			return false;

		// scan XML declaration until the encoding field
		for (size_t i = 6; i + 1 < size; ++i)
		{
			// declaration can not contain ? in quoted values
			if (data[i] == '?')
				return false;

			if (data[i] == 'e' && data[i + 1] == 'n')
			{
				size_t offset = i;

				// encoding follows the version field which can't contain 'en' so this has to be the encoding if XML is well formed
				PUGI__SCANCHAR('e'); PUGI__SCANCHAR('n'); PUGI__SCANCHAR('c'); PUGI__SCANCHAR('o');
				PUGI__SCANCHAR('d'); PUGI__SCANCHAR('i'); PUGI__SCANCHAR('n'); PUGI__SCANCHAR('g');

				// S? = S?
				PUGI__SCANCHARTYPE(ct_space);
				PUGI__SCANCHAR('=');
				PUGI__SCANCHARTYPE(ct_space);

				// the only two valid delimiters are ' and "
				uint8_t delimiter = (offset < size && data[offset] == '"') ? '"' : '\'';

				PUGI__SCANCHAR(delimiter);

				size_t start = offset;

				out_encoding = data + offset;

				PUGI__SCANCHARTYPE(ct_symbol);

				out_length = offset - start;

				PUGI__SCANCHAR(delimiter);

				return true;
			}
		}

		return false;

	#undef PUGI__SCANCHAR
	#undef PUGI__SCANCHARTYPE
	}

// Assembly:
cmpq $0x6, %rsi
jae 0x28abe
xorl %eax, %eax
retq
xorl %eax, %eax
cmpl $0x6d783f3c, (%rdi)     # imm = 0x6D783F3C
jne 0x28abd
cmpb $0x6c, 0x4(%rdi)
jne 0x28abd
movzbl 0x5(%rdi), %eax
leaq 0x91d7(%rip), %r8       # 0x31cb0
testb $0x8, (%rax,%r8)
sete %al
cmpq $0x8, %rsi
setb %r9b
orb %al, %r9b
jne 0x28abb
movl $0x7, %eax
subq %rsi, %rax
movl $0xe, %r9d
movzbl -0x8(%rdi,%r9), %r10d
cmpl $0x65, %r10d
je 0x28b10
cmpl $0x3f, %r10d
jne 0x28b18
jmp 0x28abb
cmpb $0x6e, -0x7(%rdi,%r9)
je 0x28b2a
leaq (%rax,%r9), %r10
incq %r10
incq %r9
cmpq $0xe, %r10
jne 0x28afc
jmp 0x28abb
leaq -0x8(%r9), %rax
cmpq %rsi, %rax
jae 0x28abb
leaq -0x6(%r9), %rax
cmpq %rsi, %rax
jae 0x28abb
cmpb $0x63, -0x6(%rdi,%r9)
jne 0x28abb
leaq -0x5(%r9), %rax
cmpq %rsi, %rax
jae 0x28abb
cmpb $0x6f, -0x5(%rdi,%r9)
jne 0x28abb
leaq -0x4(%r9), %rax
cmpq %rsi, %rax
jae 0x28abb
cmpb $0x64, -0x4(%rdi,%r9)
jne 0x28abb
leaq -0x3(%r9), %rax
cmpq %rsi, %rax
jae 0x28abb
cmpb $0x69, -0x3(%rdi,%r9)
jne 0x28abb
leaq -0x2(%r9), %rax
cmpq %rsi, %rax
jae 0x28abb
cmpb $0x6e, -0x2(%rdi,%r9)
jne 0x28abb
leaq -0x1(%r9), %rax
cmpq %rsi, %rax
jae 0x28abb
cmpb $0x67, -0x1(%rdi,%r9)
sete %al
cmpq %rsi, %r9
setb %r10b
andb %al, %r10b
cmpb $0x1, %r10b
jne 0x28abb
movzbl (%rdi,%r9), %eax
testb $0x8, (%rax,%r8)
je 0x28bf5
incq %r9
xorl %eax, %eax
cmpq %rsi, %r9
jb 0x28bda
jmp 0x28abd
cmpb $0x3d, %al
jne 0x28abb
incq %r9
cmpq %rsi, %r9
jae 0x28abb
movzbl (%rdi,%r9), %r10d
incq %r9
testb $0x8, (%r10,%r8)
jne 0x28c00
xorl %eax, %eax
cmpl $0x22, %r10d
setne %al
leal (%rax,%rax,4), %eax
addl $0x22, %eax
cmpl %r10d, %eax
jne 0x28abb
leaq (%rdi,%r9), %r10
movq %r10, (%rdx)
cmpq %rsi, %r9
jae 0x28c5d
addq %r9, %rdi
xorl %edx, %edx
movq %r9, %r10
movzbl (%rdi), %r11d
testb $0x40, (%r11,%r8)
je 0x28c6f
incq %r10
incq %rdi
incq %rdx
cmpq %rsi, %r10
jb 0x28c44
xorl %eax, %eax
subq %r9, %rsi
movl $0x0, %edx
cmovaeq %rsi, %rdx
movq %rdx, (%rcx)
retq
movq %rdx, (%rcx)
movzbl (%rdi), %ecx
cmpl %ecx, %eax
sete %al
retq