// File: /workspace/github_cpp_makefile_star2_O3/miniplane[P]mintree/./BpTree.h
// Function: BpTree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, 2ul>::Node::remove_from_leaf(unsigned long, unsigned long)
void remove_from_leaf(size_t value_pos, size_t pos_in_parent) {

			shift(keys, value_pos, elements, -1); // moves element to left, removes key
			elements--;

			if (!parent)
				return;
			
			parent->set_key_in_node(pos_in_parent, keys[0]);

			if (elements >= k) // if Node at least half full, or root, return
				return;

			// tries to borrow value from sibling
			if (can_borrow_from(previous())) {
				push_left(previous()->pop_right());
				parent->set_key_in_node(pos_in_parent, keys[0]); // update next()'s key in parent
				return;
			}
			else if (can_borrow_from(next())) {
				push_right(next()->pop_left());
				parent->set_key_in_node(pos_in_parent+1, next()->keys[0]); // update next()'s key in parent
				return;
			}

			// if borrowing not possible -> merge
			if (previous() && (previous()->parent==parent)) {
				previous()->merge_leaf(pos_in_parent-1);
				delete this;
				return;
			}
			else if (next() && (next()->parent==parent)) {
				Node *n = next();
				merge_leaf(pos_in_parent);
				delete n;
				return;
			}
		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
callq 0x2150
movq 0xb8(%r14), %rax
leaq -0x1(%rax), %rcx
cmpq %r15, %rcx
jbe 0x40c7
movq %r15, %rcx
shlq $0x5, %rcx
leaq (%rcx,%r14), %r12
addq $0x58, %r12
notq %r15
addq %rax, %r15
leaq -0x20(%r12), %rdi
movq %r12, %rsi
callq 0x20f0
addq $0x20, %r12
decq %r15
jne 0x40a7
movq 0xb8(%r14), %rcx
decq %rcx
movq %rcx, 0xb8(%r14)
movq (%r14), %r15
testq %r15, %r15
je 0x439c
leaq -0xc0(%rbp), %r13
movq %r13, -0x10(%r13)
movq 0x38(%r14), %rsi
movq 0x40(%r14), %rdx
addq %rsi, %rdx
leaq -0xd0(%rbp), %r12
movq %r12, %rdi
callq 0x346e
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x4400
movq -0xd0(%rbp), %rdi
cmpq %r13, %rdi
je 0x4128
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x21d0
cmpq $0x1, 0xb8(%r14)
ja 0x439c
leaq 0x38(%r14), %rcx
movq 0x8(%r14), %rdi
testq %rdi, %rdi
je 0x4242
movq (%rdi), %rax
cmpq (%r14), %rax
jne 0x4242
movq 0xb8(%rdi), %rax
cmpq $0x3, %rax
jb 0x4242
movq %rcx, -0x30(%rbp)
decq %rax
movq %rax, 0xb8(%rdi)
shlq $0x5, %rax
leaq -0x60(%rbp), %r13
movq %r13, -0x10(%r13)
movq 0x38(%rdi,%rax), %rsi
movq 0x40(%rdi,%rax), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %rdi
callq 0x346e
movq 0xb8(%r14), %r15
leaq 0x1(%r15), %rax
movq %rax, 0xb8(%r14)
testq %r15, %r15
je 0x41ce
movq %r15, %rax
shlq $0x5, %rax
leaq (%rax,%r14), %r12
addq $0x38, %r12
movq %r12, %rdi
addq $-0x20, %r12
movq %r12, %rsi
callq 0x20f0
decq %r15
jne 0x41ba
leaq -0x70(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x20f0
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0x41f0
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x21d0
movq (%r14), %r15
leaq -0xa0(%rbp), %r13
movq %r13, -0x10(%r13)
movq 0x38(%r14), %rsi
movq 0x40(%r14), %rdx
addq %rsi, %rdx
leaq -0xb0(%rbp), %r14
movq %r14, %rdi
callq 0x346e
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x4400
movq -0xb0(%rbp), %rdi
cmpq %r13, %rdi
je 0x439c
movq -0xa0(%rbp), %rsi
jmp 0x433f
movq 0x28(%r14), %r12
testq %r12, %r12
je 0x4344
movq (%r12), %rax
cmpq (%r14), %rax
jne 0x4344
cmpq $0x3, 0xb8(%r12)
jb 0x4344
movq %rcx, -0x30(%rbp)
leaq -0x40(%rbp), %r13
movq %r13, -0x10(%r13)
movq 0x38(%r12), %rsi
movq 0x40(%r12), %rdx
addq %rsi, %rdx
leaq -0x50(%rbp), %rdi
callq 0x346e
movq 0xb8(%r12), %r15
decq %r15
movq %r15, 0xb8(%r12)
je 0x42ba
addq $0x38, %r12
movq %r12, %rdi
addq $0x20, %r12
movq %r12, %rsi
callq 0x20f0
decq %r15
jne 0x42a6
movq 0xb8(%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%r14)
shlq $0x5, %rax
movq -0x30(%rbp), %rdi
addq %rax, %rdi
leaq -0x50(%rbp), %rsi
callq 0x20f0
movq -0x50(%rbp), %rdi
cmpq %r13, %rdi
je 0x42f5
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x21d0
incq %rbx
movq (%r14), %r15
movq 0x28(%r14), %rax
leaq -0x80(%rbp), %r13
movq %r13, -0x10(%r13)
movq 0x38(%rax), %rsi
movq 0x40(%rax), %rdx
addq %rsi, %rdx
leaq -0x90(%rbp), %r14
movq %r14, %rdi
callq 0x346e
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x4400
movq -0x90(%rbp), %rdi
cmpq %r13, %rdi
je 0x439c
movq -0x80(%rbp), %rsi
incq %rsi
jmp 0x4397
testq %rdi, %rdi
je 0x4351
movq (%rdi), %rax
cmpq (%r14), %rax
je 0x437c
testq %r12, %r12
je 0x439c
movq (%r12), %rax
cmpq (%r14), %rax
jne 0x439c
movq %r14, %rdi
movq %rbx, %rsi
callq 0x44dc
movq %r12, %rdi
callq 0x39fc
movl $0xc8, %esi
movq %r12, %rdi
jmp 0x4397
decq %rbx
movq %rbx, %rsi
callq 0x44dc
movq %r14, %rdi
callq 0x39fc
movl $0xc8, %esi
movq %r14, %rdi
callq 0x21d0
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x90(%rbp), %rdi
jmp 0x43e6
jmp 0x43d6
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
jmp 0x43e6
jmp 0x43df
movq %rax, %rbx
movq -0xd0(%rbp), %rdi
jmp 0x43e6
movq %rax, %rbx
movq -0x50(%rbp), %rdi
jmp 0x43e6
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0x43f7
movq (%r13), %rsi
incq %rsi
callq 0x21d0
movq %rbx, %rdi
callq 0x22b0
nop