// File: adamiaonr[P]rid-analytics/src/pugixml.cpp
// Function: void pugi::impl::(anonymous namespace)::partition<pugi::xpath_node*, pugi::impl::(anonymous namespace)::document_order_comparator>(pugi::xpath_node*, pugi::xpath_node*, pugi::xpath_node*, pugi::impl::(anonymous namespace)::document_order_comparator const&, pugi::xpath_node**, pugi::xpath_node**)
void partition(I begin, I middle, I end, const Pred& pred, I* out_eqbeg, I* out_eqend)
	{
		I eqbeg = middle, eqend = middle + 1;

		// expand equal range
		while (eqbeg != begin && *(eqbeg - 1) == *eqbeg) --eqbeg;
		while (eqend != end && *eqend == *eqbeg) ++eqend;

		// process outer elements
		I ltend = eqbeg, gtbeg = eqend;

		for (;;)
		{
			// find the element from the right side that belongs to the left one
			for (; gtbeg != end; ++gtbeg)
				if (!pred(*eqbeg, *gtbeg))
				{
					if (*gtbeg == *eqbeg) swap(*gtbeg, *eqend++);
					else break;
				}

			// find the element from the left side that belongs to the right one
			for (; ltend != begin; --ltend)
				if (!pred(*(ltend - 1), *eqbeg))
				{
					if (*eqbeg == *(ltend - 1)) swap(*(ltend - 1), *--eqbeg);
					else break;
				}

			// scanned all elements
			if (gtbeg == end && ltend == begin)
			{
				*out_eqbeg = eqbeg;
				*out_eqend = eqend;
				return;
			}

			// make room for elements by moving equal area
			if (gtbeg == end)
			{
				if (--ltend != --eqbeg) swap(*ltend, *eqbeg);
				swap(*eqbeg, *--eqend);
			}
			else if (ltend == begin)
			{
				if (eqend != gtbeg) swap(*eqbeg, *eqend);
				++eqend;
				swap(*gtbeg++, *eqbeg++);
			}
			else swap(*gtbeg++, *--ltend);
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rcx
xorl %eax, %eax
cmpq -0x8(%rbp), %rcx
movb %al, -0x51(%rbp)
je 0x1dc67
movq -0x38(%rbp), %rdi
addq $-0x10, %rdi
movq -0x38(%rbp), %rsi
callq 0xebd0
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0x1dc70
jmp 0x1dc7e
movq -0x38(%rbp), %rax
addq $-0x10, %rax
movq %rax, -0x38(%rbp)
jmp 0x1dc44
jmp 0x1dc80
movq -0x40(%rbp), %rcx
xorl %eax, %eax
cmpq -0x18(%rbp), %rcx
movb %al, -0x52(%rbp)
je 0x1dc9f
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xebd0
movb %al, -0x52(%rbp)
movb -0x52(%rbp), %al
testb $0x1, %al
jne 0x1dca8
jmp 0x1dcb6
movq -0x40(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x40(%rbp)
jmp 0x1dc80
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x1dcc8
movq -0x50(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x1dd28
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x50(%rbp), %rdx
callq 0x1d3c0
testb $0x1, %al
jne 0x1dd18
movq -0x50(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xebd0
testb $0x1, %al
jne 0x1dcfa
jmp 0x1dd14
movq -0x50(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq %rsi, %rax
addq $0x10, %rax
movq %rax, -0x40(%rbp)
callq 0x1e050
jmp 0x1dd16
jmp 0x1dd28
jmp 0x1dd18
jmp 0x1dd1a
movq -0x50(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x50(%rbp)
jmp 0x1dcc8
jmp 0x1dd2a
movq -0x48(%rbp), %rax
cmpq -0x8(%rbp), %rax
je 0x1dd93
movq -0x20(%rbp), %rdi
movq -0x48(%rbp), %rsi
addq $-0x10, %rsi
movq -0x38(%rbp), %rdx
callq 0x1d3c0
testb $0x1, %al
jne 0x1dd83
movq -0x38(%rbp), %rdi
movq -0x48(%rbp), %rsi
addq $-0x10, %rsi
callq 0xebd0
testb $0x1, %al
jne 0x1dd64
jmp 0x1dd7f
movq -0x48(%rbp), %rdi
addq $-0x10, %rdi
movq -0x38(%rbp), %rsi
addq $-0x10, %rsi
movq %rsi, -0x38(%rbp)
callq 0x1e050
jmp 0x1dd81
jmp 0x1dd93
jmp 0x1dd83
jmp 0x1dd85
movq -0x48(%rbp), %rax
addq $-0x10, %rax
movq %rax, -0x48(%rbp)
jmp 0x1dd2a
movq -0x50(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0x1ddc3
movq -0x48(%rbp), %rax
cmpq -0x8(%rbp), %rax
jne 0x1ddc3
movq -0x38(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
addq $0x60, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0x1de0e
movq -0x48(%rbp), %rax
addq $-0x10, %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rcx
addq $-0x10, %rcx
movq %rcx, -0x38(%rbp)
cmpq %rcx, %rax
je 0x1ddf7
movq -0x48(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x1e050
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq $-0x10, %rsi
movq %rsi, -0x40(%rbp)
callq 0x1e050
jmp 0x1de82
movq -0x48(%rbp), %rax
cmpq -0x8(%rbp), %rax
jne 0x1de60
movq -0x40(%rbp), %rax
cmpq -0x50(%rbp), %rax
je 0x1de2f
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x1e050
movq -0x40(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x40(%rbp)
movq -0x50(%rbp), %rdi
movq %rdi, %rax
addq $0x10, %rax
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rsi
movq %rsi, %rax
addq $0x10, %rax
movq %rax, -0x38(%rbp)
callq 0x1e050
jmp 0x1de80
movq -0x50(%rbp), %rdi
movq %rdi, %rax
addq $0x10, %rax
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rsi
addq $-0x10, %rsi
movq %rsi, -0x48(%rbp)
callq 0x1e050
jmp 0x1de82
jmp 0x1dcc6
nopw (%rax,%rax)