// File: /workspace/github_cpp_makefile_star2_O3/jliesch[P]ofxget/pugixml/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) + sizeof(void*), page));
		(void)page;

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

	#ifdef PUGIXML_COMPACT
		// align the memory block to a pointer boundary; this is required for compact mode where memory allocations are only 4b aligned
		// note that this requires up to sizeof(void*)-1 additional memory, which the allocation above takes into account
		extra = reinterpret_cast<impl::xml_extra_buffer*>((reinterpret_cast<uintptr_t>(extra) + (sizeof(void*) - 1)) & ~(sizeof(void*) - 1));
	#endif

		// 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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq (%rsi), %r15
testq %r15, %r15
je 0x1f6aa
movq %rcx, %r12
movq (%r15), %rax
movl %eax, %ecx
andl $0xf, %ecx
addl $-0x3, %ecx
cmpl $-0x3, %ecx
ja 0x1f6c1
movl $0x0, 0x10(%rbx)
movl $0xf, (%rbx)
movq $0x0, 0x8(%rbx)
jmp 0x1f73a
movl %r9d, %r11d
movl %r8d, %r9d
movq %rdx, %r13
shrq $0x8, %rax
movq %r15, %rcx
subq %rax, %rcx
movq (%rcx), %rbp
orq $0x40, -0x40(%rbp)
movq 0x8(%rbp), %rax
leaq 0x18(%rax), %rcx
cmpq $0x7fd8, %rcx           # imm = 0x7FD8
ja 0x1f74c
movq (%rbp), %rdx
addq %rdx, %rax
addq $0x28, %rax
movq %rcx, 0x8(%rbp)
leaq -0x40(%rbp), %rsi
xorl %r10d, %r10d
movq %r10, (%rax)
movq 0x18(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq %rax, 0x18(%rbp)
movq 0x8(%r15), %r14
movq %r10, 0x8(%r15)
movq %rbx, %rdi
movq %r15, %rdx
movq %r13, %rcx
movq %r12, %r8
pushq %rax
pushq %r10
pushq %r10
pushq %r11
callq 0x1f7a0
addq $0x20, %rsp
movq %r14, 0x8(%r15)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %r14
movl %r9d, 0x4(%rsp)
movq %r11, 0x8(%rsp)
leaq 0x10(%rsp), %rdx
movl $0x18, %esi
movq %rbp, %rdi
callq 0x28796
testq %rax, %rax
je 0x1f782
movq (%r14), %r15
movq 0x8(%rsp), %r11
movl 0x4(%rsp), %r9d
jmp 0x1f6fc
movl $0x0, 0x10(%rbx)
movl $0x3, (%rbx)
jmp 0x1f6b7
movq %r14, 0x8(%r15)
movq %rax, %rdi
callq 0x6430