// File: /workspace/github_cpp_makefile_star2_O1/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), %rax
testq %rax, %rax
je 0x1f8d1
movq %rcx, %r15
movl (%rax), %ecx
andl $0xf, %ecx
decl %ecx
cmpl $0x2, %ecx
jae 0x1f8d1
testq %rax, %rax
je 0x1f930
movl %r9d, %r11d
movl %r8d, %ebp
movq %rdx, %r12
movq %rsi, %r13
movq (%rax), %rcx
shrq $0x8, %rcx
negq %rcx
movq (%rax,%rcx), %r14
orq $0x40, -0x40(%r14)
movq $0x0, 0x8(%rsp)
movq 0x8(%r14), %rax
leaq 0x18(%rax), %rcx
cmpq $0x7fd9, %rcx           # imm = 0x7FD9
jae 0x1f90f
movq (%r14), %rdx
addq %rdx, %rax
addq $0x28, %rax
movq %rcx, 0x8(%r14)
movq %rdx, 0x8(%rsp)
testq %rax, %rax
je 0x1f8f8
leaq -0x40(%r14), %rsi
xorl %r10d, %r10d
movq %r10, (%rax)
movq 0x18(%r14), %rcx
movq %rcx, 0x8(%rax)
movq %rax, 0x18(%r14)
movq (%r13), %r14
movq 0x8(%r14), %r13
movq %r10, 0x8(%r14)
movq %rbx, %rdi
movq %r14, %rdx
movq %r12, %rcx
movq %r15, %r8
movl %ebp, %r9d
pushq %rax
pushq %r10
pushq %r10
pushq %r11
callq 0x1f95b
addq $0x20, %rsp
movq %r13, 0x8(%r14)
jmp 0x1f8e6
movq $0x0, 0x8(%rbx)
movl $0x0, 0x10(%rbx)
movl $0xf, (%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $0x0, 0x8(%rbx)
movl $0x0, 0x10(%rbx)
movl $0x3, (%rbx)
jmp 0x1f8e6
leaq 0x8(%rsp), %rdx
movl $0x18, %esi
movq %r14, %rdi
movq %r11, 0x10(%rsp)
callq 0x28a84
movq 0x10(%rsp), %r11
jmp 0x1f885
leaq 0x140bf(%rip), %rdi     # 0x339f6
leaq 0x135b7(%rip), %rsi     # 0x32ef5
leaq 0x16c67(%rip), %rcx     # 0x365ac
movl $0x48d, %edx            # imm = 0x48D
callq 0x6120
movq %r13, 0x8(%r14)
movq %rax, %rdi
callq 0x6430