// File: /workspace/github_cpp_makefile_star2_O1/adamiaonr[P]rid-analytics/src/pugixml.cpp
// Function: pugi::impl::(anonymous namespace)::xpath_allocator::reallocate(void*, unsigned long, unsigned long)
void* reallocate(void* ptr, size_t old_size, size_t new_size)
		{
			// round size up to block alignment boundary
			old_size = (old_size + xpath_memory_block_alignment - 1) & ~(xpath_memory_block_alignment - 1);
			new_size = (new_size + xpath_memory_block_alignment - 1) & ~(xpath_memory_block_alignment - 1);

			// we can only reallocate the last object
			assert(ptr == 0 || static_cast<char*>(ptr) + old_size == &_root->data[0] + _root_size);

			// adjust root size so that we have not allocated the object at all
			bool only_object = (_root_size == old_size);

			if (ptr) _root_size -= old_size;

			// allocate a new version (this will obviously reuse the memory if possible)
			void* result = allocate(new_size);
			assert(result);

			// we have a new block
			if (result != ptr && ptr)
			{
				// copy old data
				assert(new_size >= old_size);
				memcpy(result, ptr, old_size);

				// free the previous page if it had no other objects
				if (only_object)
				{
					assert(_root->data == result);
					assert(_root->next);

					xpath_memory_block* next = _root->next->next;

					if (next)
					{
						// deallocate the whole page, unless it was the first one
						xml_memory::deallocate(_root->next);
						_root->next = next;
					}
				}
			}

			return result;
		}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r12
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
addq $0x7, %r14
andq $-0x8, %r14
testq %rsi, %rsi
je 0x1698b
leaq (%r15,%r14), %rax
movq (%rbx), %rcx
movq 0x8(%rbx), %rdx
addq %rdx, %rcx
addq $0x10, %rcx
cmpq %rcx, %rax
jne 0x16a21
addq $0x7, %r12
andq $-0x8, %r12
movq 0x8(%rbx), %rcx
testq %r15, %r15
je 0x169a6
movq %rcx, %rax
subq %r14, %rax
movq %rax, 0x8(%rbx)
movq %rcx, (%rsp)
testq %r15, %r15
sete %bpl
movq %rbx, %rdi
movq %r12, %rsi
callq 0x16a9e
movq %rax, %r13
cmpq %r15, %rax
sete %al
orb %bpl, %al
jne 0x16a0f
cmpq %r14, %r12
jb 0x16a40
movq %r13, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x4320
cmpq %r14, (%rsp)
jne 0x16a0f
movq (%rbx), %rax
leaq 0x10(%rax), %rcx
cmpq %r13, %rcx
jne 0x16a5f
movq (%rax), %rdi
testq %rdi, %rdi
je 0x16a7e
movq (%rdi), %r14
testq %r14, %r14
je 0x16a0f
callq *0x299d7(%rip)          # 0x403e0
movq (%rbx), %rax
movq %r14, (%rax)
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x191fa(%rip), %rdi     # 0x2fc22
leaq 0x16d96(%rip), %rsi     # 0x2d7c5
leaq 0x1923b(%rip), %rcx     # 0x2fc71
movl $0x1d2d, %edx           # imm = 0x1D2D
callq 0x4270
leaq 0x19287(%rip), %rdi     # 0x2fcce
leaq 0x16d77(%rip), %rsi     # 0x2d7c5
leaq 0x1921c(%rip), %rcx     # 0x2fc71
movl $0x1d3c, %edx           # imm = 0x1D3C
callq 0x4270
leaq 0x1927d(%rip), %rdi     # 0x2fce3
leaq 0x16d58(%rip), %rsi     # 0x2d7c5
leaq 0x191fd(%rip), %rcx     # 0x2fc71
movl $0x1d42, %edx           # imm = 0x1D42
callq 0x4270
leaq 0x19274(%rip), %rdi     # 0x2fcf9
leaq 0x16d39(%rip), %rsi     # 0x2d7c5
leaq 0x191de(%rip), %rcx     # 0x2fc71
movl $0x1d43, %edx           # imm = 0x1D43
callq 0x4270
nop