// File: adamiaonr[P]rid-analytics/src/pugixml.cpp
// Function: pugi::xml_node::append_buffer(void const*, unsigned long, unsigned int, pugi::xml_encoding)
PUGI__FN xml_parse_result xml_node::append_buffer(const void* contents, size_t size, unsigned int options, xml_encoding encoding)
	{
		// append_buffer is only valid for elements/documents
		if (!impl::allow_insert_child(type(), node_element)) return impl::make_parse_result(status_append_invalid_root);

		// get document node
		impl::xml_document_struct* doc = &impl::get_document(_root);

		// disable document_buffer_order optimization since in a document with multiple buffers comparing buffer pointers does not make sense
		doc->header |= impl::xml_memory_page_contents_shared_mask;

		// get extra buffer element (we'll store the document fragment buffer there so that we can deallocate it later)
		impl::xml_memory_page* page = 0;
		impl::xml_extra_buffer* extra = static_cast<impl::xml_extra_buffer*>(doc->allocate_memory(sizeof(impl::xml_extra_buffer), page));
		(void)page;

		if (!extra) return impl::make_parse_result(status_out_of_memory);

		// add extra buffer to the list
		extra->buffer = 0;
		extra->next = doc->extra_buffers;
		doc->extra_buffers = extra;

		// name of the root has to be NULL before parsing - otherwise closing node mismatches will not be detected at the top level
		impl::name_null_sentry sentry(_root);

		return impl::load_buffer_impl(doc, _root, const_cast<void*>(contents), size, options, encoding, false, false, &extra->buffer);
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x70(%rbp)
movq %rdi, -0x68(%rbp)
movq %rsi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl %r9d, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x60(%rbp)
callq 0x78e0
movl %eax, %edi
movl $0x2, %esi
callq 0x8f70
testb $0x1, %al
jne 0xa47b
movq -0x70(%rbp), %rdi
movl $0xf, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0xa590
jmp 0xa574
movq -0x60(%rbp), %rax
movq (%rax), %rdi
callq 0x7f00
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rcx
orq $0x40, %rcx
movq %rcx, (%rax)
movq $0x0, -0x30(%rbp)
movq -0x28(%rbp), %rdi
addq $0x40, %rdi
movl $0x10, %esi
leaq -0x30(%rbp), %rdx
callq 0xa5d0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0xa4d9
movq -0x70(%rbp), %rdi
movl $0x3, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0xa590
jmp 0xa574
movq -0x60(%rbp), %rax
movq -0x38(%rbp), %rcx
movq $0x0, (%rcx)
movq -0x28(%rbp), %rcx
movq 0x58(%rcx), %rdx
movq -0x38(%rbp), %rcx
movq %rdx, 0x8(%rcx)
movq -0x38(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq %rdx, 0x58(%rcx)
movq (%rax), %rsi
leaq -0x48(%rbp), %rdi
callq 0xa650
movq -0x60(%rbp), %rax
movq -0x70(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq (%rax), %rdx
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %r8
movl -0x1c(%rbp), %r9d
movl -0x20(%rbp), %r10d
movq -0x38(%rbp), %r11
movq %rsp, %rax
movq %r11, 0x18(%rax)
movl %r10d, (%rax)
movl $0x0, 0x10(%rax)
movl $0x0, 0x8(%rax)
callq 0xa680
jmp 0xa552
leaq -0x48(%rbp), %rdi
callq 0xa7e0
jmp 0xa574
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0xa7e0
jmp 0xa581
movq -0x68(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x5920
nopw (%rax,%rax)