// File: jliesch[P]ofxget/pugixml/pugixml.cpp
// Function: pugi::impl::(anonymous namespace)::xml_allocator::deallocate_memory(void*, unsigned long, pugi::impl::(anonymous namespace)::xml_memory_page*)
void deallocate_memory(void* ptr, size_t size, xml_memory_page* page)
		{
			if (page == _root) page->busy_size = _busy_size;

			assert(ptr >= reinterpret_cast<char*>(page) + sizeof(xml_memory_page) && ptr < reinterpret_cast<char*>(page) + sizeof(xml_memory_page) + page->busy_size);
			(void)!ptr;

			page->freed_size += size;
			assert(page->freed_size <= page->busy_size);

			if (page->freed_size == page->busy_size)
			{
				if (page->next == 0)
				{
					assert(_root == page);

					// top page freed, just reset sizes
					page->busy_size = 0;
					page->freed_size = 0;

				#ifdef PUGIXML_COMPACT
					// reset compact state to maximize efficiency
					page->compact_string_base = 0;
					page->compact_shared_parent = 0;
					page->compact_page_marker = 0;
				#endif

					_busy_size = 0;
				}
				else
				{
					assert(_root != page);
					assert(page->prev);

					// remove from the list
					page->prev->next = page->next;
					page->next->prev = page->prev;

					// deallocate
					deallocate_page(page);
				}
			}
		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rcx
movq %rcx, -0x28(%rbp)
movq -0x20(%rbp), %rax
cmpq (%rcx), %rax
jne 0x4fd29
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rdx
addq $0x28, %rdx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x29(%rbp)
jb 0x4fd5c
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
addq $0x28, %rcx
movq -0x20(%rbp), %rdx
addq 0x18(%rdx), %rcx
cmpq %rcx, %rax
setb %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
testb $0x1, %al
jne 0x4fd65
jmp 0x4fd67
jmp 0x4fd86
leaq 0x1c2eb(%rip), %rdi     # 0x6c059
leaq 0x1b5e0(%rip), %rsi     # 0x6b355
movl $0x255, %edx            # imm = 0x255
leaq 0x1c36a(%rip), %rcx     # 0x6c0eb
callq 0x7180
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
addq 0x20(%rax), %rcx
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x18(%rcx), %rax
ja 0x4fdaa
jmp 0x4fdc9
leaq 0x1c3a6(%rip), %rdi     # 0x6c157
leaq 0x1b59d(%rip), %rsi     # 0x6b355
movl $0x259, %edx            # imm = 0x259
leaq 0x1c327(%rip), %rcx     # 0x6c0eb
callq 0x7180
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jne 0x4fece
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x4fe41
movq -0x28(%rbp), %rax
movq (%rax), %rax
cmpq -0x20(%rbp), %rax
jne 0x4fdf9
jmp 0x4fe18
leaq 0x1c37b(%rip), %rdi     # 0x6c17b
leaq 0x1b54e(%rip), %rsi     # 0x6b355
movl $0x25f, %edx            # imm = 0x25F
leaq 0x1c2d8(%rip), %rcx     # 0x6c0eb
callq 0x7180
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movq $0x0, 0x18(%rcx)
movq -0x20(%rbp), %rcx
movq $0x0, 0x20(%rcx)
movq $0x0, 0x8(%rax)
jmp 0x4fecc
movq -0x28(%rbp), %rax
movq (%rax), %rax
cmpq -0x20(%rbp), %rax
je 0x4fe50
jmp 0x4fe6f
leaq 0x1c332(%rip), %rdi     # 0x6c189
leaq 0x1b4f7(%rip), %rsi     # 0x6b355
movl $0x270, %edx            # imm = 0x270
leaq 0x1c281(%rip), %rcx     # 0x6c0eb
callq 0x7180
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x4fe7c
jmp 0x4fe9b
leaq 0x1bca6(%rip), %rdi     # 0x6bb29
leaq 0x1b4cb(%rip), %rsi     # 0x6b355
movl $0x271, %edx            # imm = 0x271
leaq 0x1c255(%rip), %rcx     # 0x6c0eb
callq 0x7180
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rdi
callq 0x47f50
jmp 0x4fece
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)