// File: ehw-fit[P]py-paretoarchive/src/paretoarchive/paretoarchive.h
// Function: BspTreeArchive<1>::process(ObjVec<1> const&)
bool process(ObjVec<OBJ> const& y)
	{
		// check for dominance and remove all dominated points
		if (checkDominance(m_root, y, 0, 0) == -1) return false;
		if (m_root->m_size == 0) clear();

		// insert the new point
		InteriorNode* interior = insert(m_root, y);

		// check tree balance
		if (balance_tree && interior)
		{
			// obtain "large" and "small" branch of the tree
			Node* large = (interior->m_left->m_size > interior->m_right->m_size) ? interior->m_left : interior->m_right;
			Node* small = (interior->m_left->m_size < interior->m_right->m_size) ? interior->m_left : interior->m_right;
			if (large->leaf()) return true;   // don't balance leaves

			// replace interior with large
			large->m_parent = interior->m_parent;
			if (interior->m_parent)
			{
				if (interior->m_parent->m_left == interior) interior->m_parent->m_left = large;
				else interior->m_parent->m_right = large;
			}
			else m_root = large;
			interior->m_left = nullptr;
			interior->m_right = nullptr;
			delete interior;

			// move points from small into large subtree
			vector<const ObjVec<OBJ>*> list(small->m_size);
			unsigned int index = 0;
			small->extract(list, index);
			for (unsigned int i=0; i<list.size(); i++) insert(large, *list[i]);
			delete small;
		}

		return true;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %fs:0x28, %rax
movq %rax, -0x8(%rbp)
movq %rdi, -0x40(%rbp)
movq %rsi, -0x48(%rbp)
movq -0x40(%rbp), %rdi
movq %rdi, -0x70(%rbp)
movq (%rdi), %rsi
movq -0x48(%rbp), %rdx
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rcx
callq 0x686a0
cmpl $-0x1, %eax
jne 0x683ca
movb $0x0, -0x31(%rbp)
jmp 0x6863a
movq -0x70(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0x10(%rax)
jne 0x683e0
movq -0x70(%rbp), %rdi
callq 0x68ad0
movq -0x70(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %rsi, %rdi
callq 0x68b50
movq %rax, -0x50(%rbp)
movq 0x3ea3d(%rip), %rax     # 0xa6e38
testb $0x1, (%rax)
je 0x68636
cmpq $0x0, -0x50(%rbp)
je 0x68636
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x10(%rax), %eax
movq -0x50(%rbp), %rcx
movq 0x20(%rcx), %rcx
cmpl 0x10(%rcx), %eax
jbe 0x68435
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0x68441
movq -0x50(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x10(%rax), %eax
movq -0x50(%rbp), %rcx
movq 0x20(%rcx), %rcx
cmpl 0x10(%rcx), %eax
jae 0x6846f
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x80(%rbp)
jmp 0x6847b
movq -0x50(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
callq 0x69540
testb $0x1, %al
jne 0x68492
jmp 0x6849b
movb $0x1, -0x31(%rbp)
jmp 0x6863a
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x50(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x684ec
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
cmpq -0x50(%rbp), %rax
jne 0x684da
movq -0x10(%rbp), %rcx
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x18(%rax)
jmp 0x684ea
movq -0x10(%rbp), %rcx
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rax
movq %rcx, 0x20(%rax)
jmp 0x684f7
movq -0x70(%rbp), %rax
movq -0x10(%rbp), %rcx
movq %rcx, (%rax)
movq -0x50(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x50(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x50(%rbp), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, %rax
je 0x6852d
movq -0x88(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq -0x58(%rbp), %rax
movl 0x10(%rax), %eax
movq %rax, -0x98(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x69560
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
leaq -0x28(%rbp), %rdi
callq 0x69580
jmp 0x68564
leaq -0x29(%rbp), %rdi
callq 0x695f0
movl $0x0, -0x30(%rbp)
movq -0x58(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
leaq -0x28(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq *%rax
jmp 0x6858b
movl $0x0, -0x68(%rbp)
movl -0x68(%rbp), %eax
movq %rax, -0xa0(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x69610
movq %rax, %rcx
movq -0xa0(%rbp), %rax
cmpq %rcx, %rax
jae 0x6860f
movl -0x68(%rbp), %eax
movl %eax, %esi
leaq -0x28(%rbp), %rdi
callq 0x69630
movq -0x70(%rbp), %rdi
movq (%rax), %rdx
leaq -0x10(%rbp), %rsi
callq 0x68b50
jmp 0x685d4
jmp 0x685d6
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x68592
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x29(%rbp), %rdi
callq 0x695f0
jmp 0x68666
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x69650
jmp 0x68666
movq -0x58(%rbp), %rax
movq %rax, -0xa8(%rbp)
cmpq $0x0, %rax
je 0x6862d
movq -0xa8(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
leaq -0x28(%rbp), %rdi
callq 0x69650
movb $0x1, -0x31(%rbp)
movb -0x31(%rbp), %al
movb %al, -0xa9(%rbp)
movq %fs:0x28, %rax
movq -0x8(%rbp), %rcx
cmpq %rcx, %rax
jne 0x6868f
movb -0xa9(%rbp), %al
andb $0x1, %al
addq $0xc0, %rsp
popq %rbp
retq
movq -0x60(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq %fs:0x28, %rax
movq -0x8(%rbp), %rcx
cmpq %rcx, %rax
jne 0x6868f
movq -0xb8(%rbp), %rdi
callq 0x29660
callq 0x29420
nopw %cs:(%rax,%rax)
nop