// File: jliesch[P]ofxget/pugixml/pugixml.cpp
// Function: pugi::impl::(anonymous namespace)::load_buffer_impl(pugi::impl::(anonymous namespace)::xml_document_struct*, pugi::xml_node_struct*, void*, unsigned long, unsigned int, pugi::xml_encoding, bool, bool, char**)
PUGI__FN xml_parse_result load_buffer_impl(xml_document_struct* doc, xml_node_struct* root, void* contents, size_t size, unsigned int options, xml_encoding encoding, bool is_mutable, bool own, char_t** out_buffer)
	{
		// check input buffer
		if (!contents && size) return make_parse_result(status_io_error);

		// get actual encoding
		xml_encoding buffer_encoding = impl::get_buffer_encoding(encoding, contents, size);

		// get private buffer
		char_t* buffer = 0;
		size_t length = 0;

		if (!impl::convert_buffer(buffer, length, buffer_encoding, contents, size, is_mutable)) return impl::make_parse_result(status_out_of_memory);

		// delete original buffer if we performed a conversion
		if (own && buffer != contents && contents) impl::xml_memory::deallocate(contents);

		// grab onto buffer if it's our buffer, user is responsible for deallocating contents himself
		if (own || buffer != contents) *out_buffer = buffer;

		// store buffer for offset_debug
		doc->buffer = buffer;

		// parse
		xml_parse_result res = impl::xml_parser::parse(buffer, length, doc, root, options);

		// remember encoding
		res.encoding = buffer_encoding;

		return res;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rcx, -0x68(%rbp)
movq %rdx, %rax
movq -0x68(%rbp), %rdx
movq %rax, -0x60(%rbp)
movq %rsi, %rax
movq -0x60(%rbp), %rsi
movq %rax, -0x58(%rbp)
movq %rdi, %rax
movq -0x58(%rbp), %rdi
movq %rax, -0x50(%rbp)
movq %rax, -0x48(%rbp)
movq 0x28(%rbp), %rax
movb 0x20(%rbp), %al
movb 0x18(%rbp), %cl
movl 0x10(%rbp), %r10d
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
andb $0x1, %cl
movb %cl, -0x25(%rbp)
andb $0x1, %al
movb %al, -0x26(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x44f83
cmpq $0x0, -0x20(%rbp)
je 0x44f83
movq -0x50(%rbp), %rdi
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x44e10
jmp 0x45051
movl 0x10(%rbp), %edi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x500c0
movl %eax, -0x2c(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movl -0x2c(%rbp), %edx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
movb -0x25(%rbp), %al
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
andb $0x1, %al
movzbl %al, %r9d
callq 0x50160
testb $0x1, %al
jne 0x44fdf
movq -0x50(%rbp), %rdi
movl $0x3, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x44e10
jmp 0x45051
testb $0x1, -0x26(%rbp)
je 0x45003
movq -0x38(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x45003
cmpq $0x0, -0x18(%rbp)
je 0x45003
movq 0x509e3(%rip), %rax     # 0x959e0
movq -0x18(%rbp), %rdi
callq *%rax
testb $0x1, -0x26(%rbp)
jne 0x45013
movq -0x38(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x4501e
movq -0x38(%rbp), %rcx
movq 0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x50(%rbp), %rdi
movq -0x38(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x8(%rbp), %rcx
movq -0x10(%rbp), %r8
movl -0x24(%rbp), %r9d
callq 0x502e0
movq -0x50(%rbp), %rax
movl -0x2c(%rbp), %ecx
movl %ecx, 0x10(%rax)
movq -0x48(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)