// File: /workspace/github_cpp_makefile_star2_O1/vsklad[P]cgen/./bal/bal/binarytreeindex.hpp
// Function: bal::AvlTreesIndex<unsigned int, true, &int bal::compare_clauses<false>(unsigned int const*, unsigned int const*), &unsigned int bal::clause_index_variable_id<false>(unsigned int const*)>::_remove(unsigned int)
inline void _remove(const container_offset_t offset) {
            _assert_level_0(offset < this->size_);
            const container_offset_t* const p_item = _bti_item(this->data_, offset);
            container_offset_t new_offset = CONTAINER_END;
            // check right then left then parent
            if (_bti_item_right_offset(p_item) != CONTAINER_END) {
                new_offset = _bti_item_right_offset(p_item);
                if (_bti_item_left_offset(p_item) != CONTAINER_END) {
                    // append left child as the leftmost leaf node of the right tree
                    container_offset_t leaf_offset = new_offset;
                    while (_bti_left_offset(this->data_, leaf_offset) != CONTAINER_END) {
                        leaf_offset = _bti_left_offset(this->data_, leaf_offset);
                    };
                    _bti_left_offset(this->data_, leaf_offset) = _bti_item_left_offset(p_item);
                    _bti_parent_offset(this->data_, _bti_item_left_offset(p_item)) = leaf_offset;
                };
            } else if (_bti_item_left_offset(p_item) != CONTAINER_END) {
                // right_offset is necessarily CONTAINER_END in this case
                new_offset = _bti_item_left_offset(p_item);
            };
            
            _update_parent(offset, new_offset);
        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl %esi, 0x10(%rdi)
jbe 0x18914
movq 0x8(%rdi), %rax
movl %esi, %ecx
leaq (%rax,%rcx,4), %r8
movl 0x4(%r8), %ecx
movl 0x8(%r8), %edx
cmpl $-0x1, %ecx
je 0x188a8
cmpl $-0x1, %edx
je 0x188aa
movl %ecx, %r11d
movl %r11d, %r9d
movl %r11d, %r10d
movl 0x8(%rax,%r10,4), %r11d
cmpl $-0x1, %r11d
jne 0x18888
movl %edx, 0x8(%rax,%r10,4)
movl 0x8(%r8), %edx
movl %r9d, (%rax,%rdx,4)
jmp 0x188aa
movl %edx, %ecx
movl (%r8), %edx
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
cmpq %r9, %rdx
je 0x188c8
cmpl %esi, 0x4(%rax,%rdx,4)
jne 0x188f9
leaq (%rax,%rdx,4), %rdi
addq $0x4, %rdi
jmp 0x18906
movl $0x7fff, %r9d           # imm = 0x7FFF
andl 0xc(%r8), %r9d
decl %r9d
movl 0x10(%r8,%r9,4), %r8d
shrl %r8d
decl %r8d
cmpl 0x38(%rdi), %r8d
jae 0x18933
movq 0x30(%rdi), %rdi
movl %r8d, %r8d
cmpl %esi, (%rdi,%r8,4)
jne 0x18952
leaq (%rdi,%r8,4), %rdi
jmp 0x18906
leaq (%rax,%rdx,4), %rdi
cmpl %esi, 0x8(%rdi)
jne 0x18971
addq $0x8, %rdi
movl %ecx, (%rdi)
cmpl $-0x1, %ecx
je 0x18912
movl %ecx, %ecx
movl %edx, (%rax,%rcx,4)
popq %rbp
retq
leaq 0x2b031(%rip), %rdi     # 0x4394c
leaq 0x2ae1b(%rip), %rsi     # 0x4373d
leaq 0x2da8c(%rip), %rcx     # 0x463b5
movl $0xb6, %edx
callq 0xc180
leaq 0x2b3f7(%rip), %rdi     # 0x43d31
leaq 0x2adfc(%rip), %rsi     # 0x4373d
leaq 0x2b2a9(%rip), %rcx     # 0x43bf1
movl $0xab, %edx
callq 0xc180
leaq 0x2b401(%rip), %rdi     # 0x43d5a
leaq 0x2addd(%rip), %rsi     # 0x4373d
leaq 0x2b28a(%rip), %rcx     # 0x43bf1
movl $0xac, %edx
callq 0xc180
leaq 0x2b25b(%rip), %rdi     # 0x43bd3
leaq 0x2adbe(%rip), %rsi     # 0x4373d
leaq 0x2b26b(%rip), %rcx     # 0x43bf1
movl $0xa6, %edx
callq 0xc180