// File: /workspace/github_cpp_makefile_star2_O2/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*)>::update(unsigned int, bal::avl_tree_insertion_point_t const&)
inline void update(const container_offset_t container_offset, const insertion_point_t& insertion_point) {
            const container_offset_t offset = contains_data_itself ? container_offset : _find_container_offset(container_offset);
            _assert_level_0(offset != CONTAINER_END);
            container_offset_t* const p_item = _bti_item(this->data_, offset);
            
            if (insertion_point.kind == btipkCurrent) {
                if (insertion_point.offset == _bti_item_left_offset(p_item)) {
                    _merge_or_swap_child<true, true>(offset);
                    return;
                };
                if (insertion_point.offset == _bti_item_right_offset(p_item)) {
                    _merge_or_swap_child<true, false>(offset);
                    return;
                };
            } else if (insertion_point.kind == btipkLeft) {
                if (insertion_point.offset == offset) {
                    // inserting a child of the item to be removed - simple replacement, nothing to do
                    _assert_level_1(_bti_item_left_offset(p_item) == CONTAINER_END);
                    return;
                };
                if (insertion_point.offset == _bti_item_left_offset(p_item)) {
                    _merge_or_swap_child<false, true, true>(offset);
                    return;
                };
                if (insertion_point.offset == _bti_item_right_offset(p_item)) {
                    _merge_or_swap_child<false, false, true>(offset);
                    return;
                };
            } else if (insertion_point.kind == btipkRight) {
                if (insertion_point.offset == offset) {
                    // inserting a child of the item to be removed - simple replacement, nothing to do
                    _assert_level_1(_bti_item_right_offset(p_item) == CONTAINER_END);
                    return;
                };
                if (insertion_point.offset == _bti_item_left_offset(p_item)) {
                    _merge_or_swap_child<false, true, false>(offset);
                    return;
                };
                if (insertion_point.offset == _bti_item_right_offset(p_item)) {
                    _merge_or_swap_child<false, false, false>(offset);
                    return;
                };
            };
                
            // check inserting instead of the item to be removed - no changes - should never happen
            _assert_level_2(insertion_point.kind != btipkCurrent || insertion_point.offset != offset);
            _assert_level_2(insertion_point.kind != btipkRoot ||
                            insertion_point.offset >= this->instances_.size_ ||
                            this->instances_.data_[insertion_point.offset] != offset);
            
            // cannot append to the deleted item
            _assert_level_0(insertion_point.kind == btipkRoot || insertion_point.offset != offset);
            _assert_level_0(insertion_point.kind != btipkRoot || insertion_point.offset != this->instances_.data_[insertion_point.offset]);
            
            _remove(offset);
            _update(offset, insertion_point);
        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpl $-0x1, %esi
je 0x137b6
movq %rdx, %r15
movl %esi, %ebx
movq %rdi, %r14
movq 0x8(%rdi), %rcx
movl %esi, %edx
movl 0x8(%r15), %esi
movl 0xc(%r15), %eax
cmpl $0x1, %esi
je 0x1368c
cmpl $0x2, %esi
je 0x13662
cmpl $0x3, %esi
jne 0x136fc
cmpl 0x8(%rcx,%rdx,4), %eax
jne 0x136e2
movq %r14, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x14c30
cmpl %ebx, %eax
jne 0x136a8
cmpl $-0x1, 0x4(%rcx,%rdx,4)
je 0x1369d
leaq 0x2222a(%rip), %rdi     # 0x3589e
leaq 0x200b2(%rip), %rsi     # 0x3372d
leaq 0x220c0(%rip), %rcx     # 0x35742
movl $0x16d, %edx            # imm = 0x16D
callq 0xc180
movl 0x8(%rcx,%rdx,4), %esi
cmpl %ebx, %eax
jne 0x136c6
cmpl $-0x1, %esi
jne 0x137f4
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpl 0x8(%rcx,%rdx,4), %eax
jne 0x1377e
movq %r14, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x14f8c
cmpl %esi, %eax
jne 0x13798
movq %r14, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x14dd4
cmpl 0x4(%rcx,%rdx,4), %eax
jne 0x136fc
movq %r14, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x14d02
movl %esi, %ecx
xorl $0x3, %ecx
movl %eax, %edx
xorl %ebx, %edx
orl %ecx, %edx
je 0x137d5
testl %esi, %esi
je 0x13734
cmpl %ebx, %eax
jne 0x1375d
leaq 0x22280(%rip), %rdi     # 0x3599c
leaq 0x2000a(%rip), %rsi     # 0x3372d
leaq 0x22018(%rip), %rcx     # 0x35742
movl $0x181, %edx            # imm = 0x181
callq 0xc180
cmpl 0x38(%r14), %eax
setb %dl
movq 0x30(%r14), %rcx
movl (%rcx,%rax,4), %ecx
cmpl %ebx, %ecx
sete %sil
andb %dl, %sil
cmpb $0x1, %sil
je 0x13813
cmpl %ecx, %eax
je 0x13832
movq %r14, %rdi
movl %ebx, %esi
callq 0x15144
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xfcf8
cmpl 0x4(%rcx,%rdx,4), %eax
jne 0x13711
movq %r14, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x15068
cmpl 0x4(%rcx,%rdx,4), %eax
jne 0x13711
movq %r14, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x14eb0
leaq 0x200d8(%rip), %rdi     # 0x33895
leaq 0x1ff69(%rip), %rsi     # 0x3372d
leaq 0x21f77(%rip), %rcx     # 0x35742
movl $0x150, %edx            # imm = 0x150
callq 0xc180
leaq 0x220e5(%rip), %rdi     # 0x358c1
leaq 0x1ff4a(%rip), %rsi     # 0x3372d
leaq 0x21f58(%rip), %rcx     # 0x35742
movl $0x17b, %edx            # imm = 0x17B
callq 0xc180
leaq 0x22080(%rip), %rdi     # 0x3587b
leaq 0x1ff2b(%rip), %rsi     # 0x3372d
leaq 0x21f39(%rip), %rcx     # 0x35742
movl $0x15f, %edx            # imm = 0x15F
callq 0xc180
leaq 0x220f0(%rip), %rdi     # 0x3590a
leaq 0x1ff0c(%rip), %rsi     # 0x3372d
leaq 0x21f1a(%rip), %rcx     # 0x35742
movl $0x17e, %edx            # imm = 0x17E
callq 0xc180
leaq 0x221a9(%rip), %rdi     # 0x359e2
leaq 0x1feed(%rip), %rsi     # 0x3372d
leaq 0x21efb(%rip), %rcx     # 0x35742
movl $0x182, %edx            # imm = 0x182
callq 0xc180
nop