// File: /workspace/github_cpp_makefile_star2_O3/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 0x173ac
movq 0x8(%rdi), %rax
movl %esi, %ecx
leaq (%rax,%rcx,4), %r8
movl 0x4(%r8), %ecx
movl 0x8(%r8), %edx
cmpl $-0x1, %ecx
je 0x17340
cmpl $-0x1, %edx
je 0x17342
movl %ecx, %r11d
movl %r11d, %r9d
movl %r11d, %r10d
movl 0x8(%rax,%r10,4), %r11d
cmpl $-0x1, %r11d
jne 0x17320
movl %edx, 0x8(%rax,%r10,4)
movl 0x8(%r8), %edx
movl %r9d, (%rax,%rdx,4)
jmp 0x17342
movl %edx, %ecx
movl (%r8), %edx
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
cmpq %r9, %rdx
je 0x17360
cmpl %esi, 0x4(%rax,%rdx,4)
jne 0x17391
leaq (%rax,%rdx,4), %rdi
addq $0x4, %rdi
jmp 0x1739e
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 0x173cb
movq 0x30(%rdi), %rdi
movl %r8d, %r8d
cmpl %esi, (%rdi,%r8,4)
jne 0x173ea
leaq (%rdi,%r8,4), %rdi
jmp 0x1739e
leaq (%rax,%rdx,4), %rdi
cmpl %esi, 0x8(%rdi)
jne 0x17409
addq $0x8, %rdi
movl %ecx, (%rdi)
cmpl $-0x1, %ecx
je 0x173aa
movl %ecx, %ecx
movl %edx, (%rax,%rcx,4)
popq %rbp
retq
leaq 0x2a589(%rip), %rdi     # 0x4193c
leaq 0x2a373(%rip), %rsi     # 0x4172d
leaq 0x2d004(%rip), %rcx     # 0x443c5
movl $0xb6, %edx
callq 0xb180
leaq 0x2a94f(%rip), %rdi     # 0x41d21
leaq 0x2a354(%rip), %rsi     # 0x4172d
leaq 0x2a801(%rip), %rcx     # 0x41be1
movl $0xab, %edx
callq 0xb180
leaq 0x2a959(%rip), %rdi     # 0x41d4a
leaq 0x2a335(%rip), %rsi     # 0x4172d
leaq 0x2a7e2(%rip), %rcx     # 0x41be1
movl $0xac, %edx
callq 0xb180
leaq 0x2a7b3(%rip), %rdi     # 0x41bc3
leaq 0x2a316(%rip), %rsi     # 0x4172d
leaq 0x2a7c3(%rip), %rcx     # 0x41be1
movl $0xa6, %edx
callq 0xb180