// File: /workspace/github_cpp_makefile_star2_O3/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, %r13
movq %rdi, %rbx
addq $0x7, %r13
andq $-0x8, %r13
testq %rsi, %rsi
je 0x165f2
movq %rdx, %r14
movq %rsi, %r12
addq $0x7, %r14
andq $-0x8, %r14
leaq (%rsi,%r14), %rax
movq (%rbx), %rcx
movq 0x8(%rbx), %rbp
addq %rbp, %rcx
addq $0x10, %rcx
cmpq %rcx, %rax
jne 0x16608
movq %rbp, %rax
subq %r14, %rax
movq %rax, 0x8(%rbx)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x16684
movq %rax, %r15
cmpq %r12, %rax
je 0x165e0
cmpq %r14, %r13
jb 0x16627
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x4320
cmpq %r14, %rbp
jne 0x165e0
movq (%rbx), %rax
leaq 0x10(%rax), %rcx
cmpq %r15, %rcx
jne 0x16646
movq (%rax), %rdi
testq %rdi, %rdi
je 0x16665
movq (%rdi), %r14
testq %r14, %r14
je 0x165e0
callq *0x28e06(%rip)          # 0x3f3e0
movq (%rbx), %rax
movq %r14, (%rax)
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movq %r13, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x16684
leaq 0x18469(%rip), %rdi     # 0x2ea78
leaq 0x161df(%rip), %rsi     # 0x2c7f5
leaq 0x184aa(%rip), %rcx     # 0x2eac7
movl $0x1d2d, %edx           # imm = 0x1D2D
callq 0x4270
leaq 0x184f6(%rip), %rdi     # 0x2eb24
leaq 0x161c0(%rip), %rsi     # 0x2c7f5
leaq 0x1848b(%rip), %rcx     # 0x2eac7
movl $0x1d3c, %edx           # imm = 0x1D3C
callq 0x4270
leaq 0x184ec(%rip), %rdi     # 0x2eb39
leaq 0x161a1(%rip), %rsi     # 0x2c7f5
leaq 0x1846c(%rip), %rcx     # 0x2eac7
movl $0x1d42, %edx           # imm = 0x1D42
callq 0x4270
leaq 0x184e3(%rip), %rdi     # 0x2eb4f
leaq 0x16182(%rip), %rsi     # 0x2c7f5
leaq 0x1844d(%rip), %rcx     # 0x2eac7
movl $0x1d43, %edx           # imm = 0x1D43
callq 0x4270