// File: 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
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x1c(%rbp)
cmpl $-0x1, -0x1c(%rbp)
je 0x1c1a9
jmp 0x1c1c8
leaq 0x41706(%rip), %rdi     # 0x5d8b6
leaq 0x41597(%rip), %rsi     # 0x5d74e
movl $0x150, %edx            # imm = 0x150
leaq 0x4368b(%rip), %rcx     # 0x5f84e
callq 0xd1c0
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x1c(%rbp), %ecx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x3, 0x8(%rax)
jne 0x1c22f
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x1c209
movq -0x30(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x1e870
jmp 0x1c4c1
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jne 0x1c22a
movq -0x30(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x1ea20
jmp 0x1c4c1
jmp 0x1c352
movq -0x18(%rbp), %rax
cmpl $0x1, 0x8(%rax)
jne 0x1c2c0
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
cmpl -0x1c(%rbp), %eax
jne 0x1c279
movq -0x28(%rbp), %rax
cmpl $-0x1, 0x8(%rax)
jne 0x1c255
jmp 0x1c274
leaq 0x4372b(%rip), %rdi     # 0x5f987
leaq 0x414eb(%rip), %rsi     # 0x5d74e
movl $0x15f, %edx            # imm = 0x15F
leaq 0x435df(%rip), %rcx     # 0x5f84e
callq 0xd1c0
jmp 0x1c4c1
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x1c29a
movq -0x30(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x1ebd0
jmp 0x1c4c1
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jne 0x1c2bb
movq -0x30(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x1ed10
jmp 0x1c4c1
jmp 0x1c350
movq -0x18(%rbp), %rax
cmpl $0x2, 0x8(%rax)
jne 0x1c34e
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
cmpl -0x1c(%rbp), %eax
jne 0x1c30a
movq -0x28(%rbp), %rax
cmpl $-0x1, 0x4(%rax)
jne 0x1c2e6
jmp 0x1c305
leaq 0x436bd(%rip), %rdi     # 0x5f9aa
leaq 0x4145a(%rip), %rsi     # 0x5d74e
movl $0x16d, %edx            # imm = 0x16D
leaq 0x4354e(%rip), %rcx     # 0x5f84e
callq 0xd1c0
jmp 0x1c4c1
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x1c32b
movq -0x30(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x1ee50
jmp 0x1c4c1
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x28(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jne 0x1c34c
movq -0x30(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x1efa0
jmp 0x1c4c1
jmp 0x1c34e
jmp 0x1c350
jmp 0x1c352
movq -0x18(%rbp), %rcx
movb $0x1, %al
cmpl $0x3, 0x8(%rcx)
movb %al, -0x31(%rbp)
jne 0x1c371
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
cmpl -0x1c(%rbp), %eax
setne %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x1c37a
jmp 0x1c37c
jmp 0x1c39b
leaq 0x4364a(%rip), %rdi     # 0x5f9cd
leaq 0x413c4(%rip), %rsi     # 0x5d74e
movl $0x17b, %edx            # imm = 0x17B
leaq 0x434b8(%rip), %rcx     # 0x5f84e
callq 0xd1c0
movq -0x18(%rbp), %rcx
movb $0x1, %al
cmpl $0x0, 0x8(%rcx)
movb %al, -0x32(%rbp)
jne 0x1c3da
movq -0x30(%rbp), %rdx
movq -0x18(%rbp), %rax
movl 0xc(%rax), %ecx
movb $0x1, %al
cmpl 0x38(%rdx), %ecx
movb %al, -0x32(%rbp)
jae 0x1c3da
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x18(%rbp), %rcx
movl 0xc(%rcx), %ecx
movl (%rax,%rcx,4), %eax
cmpl -0x1c(%rbp), %eax
setne %al
movb %al, -0x32(%rbp)
movb -0x32(%rbp), %al
testb $0x1, %al
jne 0x1c3e3
jmp 0x1c3e5
jmp 0x1c404
leaq 0x4362a(%rip), %rdi     # 0x5fa16
leaq 0x4135b(%rip), %rsi     # 0x5d74e
movl $0x17e, %edx            # imm = 0x17E
leaq 0x4344f(%rip), %rcx     # 0x5f84e
callq 0xd1c0
movq -0x18(%rbp), %rcx
movb $0x1, %al
cmpl $0x0, 0x8(%rcx)
movb %al, -0x33(%rbp)
je 0x1c423
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
cmpl -0x1c(%rbp), %eax
setne %al
movb %al, -0x33(%rbp)
movb -0x33(%rbp), %al
testb $0x1, %al
jne 0x1c42c
jmp 0x1c42e
jmp 0x1c44d
leaq 0x43673(%rip), %rdi     # 0x5faa8
leaq 0x41312(%rip), %rsi     # 0x5d74e
movl $0x181, %edx            # imm = 0x181
leaq 0x43406(%rip), %rcx     # 0x5f84e
callq 0xd1c0
movq -0x18(%rbp), %rcx
movb $0x1, %al
cmpl $0x0, 0x8(%rcx)
movb %al, -0x34(%rbp)
jne 0x1c47b
movq -0x30(%rbp), %rcx
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
movq 0x30(%rcx), %rcx
movq -0x18(%rbp), %rdx
movl 0xc(%rdx), %edx
cmpl (%rcx,%rdx,4), %eax
setne %al
movb %al, -0x34(%rbp)
movb -0x34(%rbp), %al
testb $0x1, %al
jne 0x1c484
jmp 0x1c486
jmp 0x1c4a5
leaq 0x43661(%rip), %rdi     # 0x5faee
leaq 0x412ba(%rip), %rsi     # 0x5d74e
movl $0x182, %edx            # imm = 0x182
leaq 0x433ae(%rip), %rcx     # 0x5f84e
callq 0xd1c0
movq -0x30(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x1f0f0
movq -0x30(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x18(%rbp), %rdx
callq 0x15230
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)