// File: vsklad[P]cgen/./bal/cnf/cnf/cnfclausescontainer.hpp
// Function: void bal::CnfClausesIndexedContainer<false>::append<false>(unsigned int const*, bal::avl_tree_insertion_point_t&)
inline void append(const uint32_t* const p_clause, insertion_point_t& insertion_point) {
            __append_clause_++;
            
            _assert_level_0(_clause_is_included(p_clause));
            
            const clause_size_t clause_size = _clause_size(p_clause);
            _assert_level_0(clause_size != 0 && clause_size <= CLAUSE_SIZE_MAX);
            
            // should be sorted at this stage
            // check is sorted; remove later for performance reasons
            for (auto i = 1; i < clause_size; i++) {
                _assert_level_1(_clause_literal(p_clause, i - 1) <= _clause_literal(p_clause, i));
            };
            
            // validity of literals and flags
            if (_clause_size_is_aggregated(clause_size)) {
                _assert_level_1(_clause_flags(p_clause) != 0);
                _assert_level_1(clause_size < 1 || !literal_t__is_negation(_clause_literal(p_clause, 0)));
                _assert_level_1(clause_size < 2 || !literal_t__is_negation(_clause_literal(p_clause, 1)));
                _assert_level_1(clause_size < 3 || !literal_t__is_negation(_clause_literal(p_clause, 2)));
                _assert_level_1(clause_size < 4 || !literal_t__is_negation(_clause_literal(p_clause, 3)));
                _assert_level_1(clause_size != 1 || (_clause_flags(p_clause) & 0xFFFC) == 0);
                _assert_level_1(clause_size != 2 || (_clause_flags(p_clause) & 0xFFF0) == 0);
                _assert_level_1(clause_size != 3 || (_clause_flags(p_clause) & 0xFF00) == 0);
            } else {
                _assert_level_1(_clause_flags(p_clause) == 0);
            };
            
            // check if the clause exists by looking up the first literal index
            // find insertion pont at the same time
            // if avoid_merging is true, this is only used for verification
            if (!this->insertion_point_is_valid(insertion_point)) {
                _assert_level_1(!avoid_merging);
                find(p_clause, insertion_point);
            };
            
            // if a match for an aggregated clause is found, check if should
            // merge existing header from an immutable clause then still insert it
            // immediately in front of the existing clause
            // avoid_merging would ignore duplicate for any clause
            const container_offset_t existing_offset = insertion_point.container_offset;
            
            if (avoid_merging || existing_offset == CONTAINER_END || this->transaction_offset_is_immutable(existing_offset)) {
                // move the clause if necessary
                if (p_clause != _clauses_offset_clause(this->data_, this->size_)) {
                    this->reserve(_clauses_offset_size_memory_size(clause_size));
                    _clause_copy_size(p_clause, _clauses_offset_clause(this->data_, this->size_), clause_size);
                };
                // merge the existing clause into the new one if appropriate
                if (existing_offset != CONTAINER_END && _clause_size_is_aggregated(clause_size)) {
                    if (avoid_merging) {
                        // the existing clause should always be merged into the new one
                        _assert_level_1((_clauses_offset_flags(this->data_, existing_offset) & ~_clause_flags(p_clause)) == 0);
                    } else {
                        _clauses_offset_flags_include(this->data_, this->size_, _clauses_offset_flags(this->data_, existing_offset));
                    };
                };
                // clause not added yet but clauses_size_ is its valid offset
                base_t::_update(this->size_, insertion_point);
                insertion_point.kind = btipkCurrent;
                insertion_point.container_offset = this->size_;
                _clauses_offset_size_next(this->size_, clause_size); // "commits" the clause
            } else if (_clause_size_is_aggregated(clause_size)) {
                // a matching aggregated clause is found; it is enough to merge headers
                _assert_level_1(existing_offset != CONTAINER_END);
                _clauses_offset_flags_include(this->data_, existing_offset, _clause_flags(p_clause));
                // insertion point contains offset of the clause
            } else {
                // a duplicate for an existing non-aggregated clause - ignore
                // insertion point contains offset of the clause
            };
        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
leaq 0x6f3c5(%rip), %rax     # 0x83378
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x6f3b9(%rip), %rax     # 0x83378
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
jne 0x13fd3
jmp 0x13ff2
leaq 0x493cb(%rip), %rdi     # 0x5d3a5
leaq 0x492bc(%rip), %rsi     # 0x5d29d
movl $0x9e, %edx
leaq 0x493dc(%rip), %rcx     # 0x5d3c9
callq 0xd1c0
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x7fff, %eax           # imm = 0x7FFF
movw %ax, -0x1a(%rbp)
movzwl -0x1a(%rbp), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x31(%rbp)
je 0x1401e
movzwl -0x1a(%rbp), %eax
cmpl $0x7fff, %eax           # imm = 0x7FFF
setle %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x14027
jmp 0x14029
jmp 0x14048
leaq 0x4942d(%rip), %rdi     # 0x5d45d
leaq 0x49266(%rip), %rsi     # 0x5d29d
movl $0xa1, %edx
leaq 0x49386(%rip), %rcx     # 0x5d3c9
callq 0xd1c0
movl $0x1, -0x20(%rbp)
movl -0x20(%rbp), %eax
movzwl -0x1a(%rbp), %ecx
cmpl %ecx, %eax
jge 0x140a7
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl 0x4(%rax,%rcx,4), %eax
movq -0x10(%rbp), %rcx
movslq -0x20(%rbp), %rdx
cmpl 0x4(%rcx,%rdx,4), %eax
ja 0x1407b
jmp 0x1409a
leaq 0x4940e(%rip), %rdi     # 0x5d490
leaq 0x49214(%rip), %rsi     # 0x5d29d
movl $0xa6, %edx
leaq 0x49334(%rip), %rcx     # 0x5d3c9
callq 0xd1c0
jmp 0x1409c
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1404f
movzwl -0x1a(%rbp), %eax
cmpl $0x4, %eax
jg 0x14312
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x10, %eax
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x140c7
jmp 0x140e6
leaq 0x493f5(%rip), %rdi     # 0x5d4c3
leaq 0x491c8(%rip), %rsi     # 0x5d29d
movl $0xab, %edx
leaq 0x492e8(%rip), %rcx     # 0x5d3c9
callq 0xd1c0
movzwl -0x1a(%rbp), %ecx
movb $0x1, %al
cmpl $0x1, %ecx
movb %al, -0x32(%rbp)
jl 0x14109
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
sete %al
xorb $-0x1, %al
movb %al, -0x32(%rbp)
movb -0x32(%rbp), %al
testb $0x1, %al
jne 0x14112
jmp 0x14114
jmp 0x14133
leaq 0x493d5(%rip), %rdi     # 0x5d4f0
leaq 0x4917b(%rip), %rsi     # 0x5d29d
movl $0xac, %edx
leaq 0x4929b(%rip), %rcx     # 0x5d3c9
callq 0xd1c0
movzwl -0x1a(%rbp), %ecx
movb $0x1, %al
cmpl $0x2, %ecx
movb %al, -0x33(%rbp)
jl 0x14156
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
sete %al
xorb $-0x1, %al
movb %al, -0x33(%rbp)
movb -0x33(%rbp), %al
testb $0x1, %al
jne 0x1415f
jmp 0x14161
jmp 0x14180
leaq 0x493c7(%rip), %rdi     # 0x5d52f
leaq 0x4912e(%rip), %rsi     # 0x5d29d
movl $0xad, %edx
leaq 0x4924e(%rip), %rcx     # 0x5d3c9
callq 0xd1c0
movzwl -0x1a(%rbp), %ecx
movb $0x1, %al
cmpl $0x3, %ecx
movb %al, -0x34(%rbp)
jl 0x141a3
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
sete %al
xorb $-0x1, %al
movb %al, -0x34(%rbp)
movb -0x34(%rbp), %al
testb $0x1, %al
jne 0x141ac
jmp 0x141ae
jmp 0x141cd
leaq 0x493b9(%rip), %rdi     # 0x5d56e
leaq 0x490e1(%rip), %rsi     # 0x5d29d
movl $0xae, %edx
leaq 0x49201(%rip), %rcx     # 0x5d3c9
callq 0xd1c0
movzwl -0x1a(%rbp), %ecx
movb $0x1, %al
cmpl $0x4, %ecx
movb %al, -0x35(%rbp)
jl 0x141f0
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
sete %al
xorb $-0x1, %al
movb %al, -0x35(%rbp)
movb -0x35(%rbp), %al
testb $0x1, %al
jne 0x141f9
jmp 0x141fb
jmp 0x1421a
leaq 0x493ab(%rip), %rdi     # 0x5d5ad
leaq 0x49094(%rip), %rsi     # 0x5d29d
movl $0xaf, %edx
leaq 0x491b4(%rip), %rcx     # 0x5d3c9
callq 0xd1c0
movzwl -0x1a(%rbp), %ecx
movb $0x1, %al
cmpl $0x1, %ecx
movb %al, -0x36(%rbp)
jne 0x14242
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x10, %eax
movzwl %ax, %eax
andl $0xfffc, %eax           # imm = 0xFFFC
cmpl $0x0, %eax
sete %al
movb %al, -0x36(%rbp)
movb -0x36(%rbp), %al
testb $0x1, %al
jne 0x1424b
jmp 0x1424d
jmp 0x1426c
leaq 0x49398(%rip), %rdi     # 0x5d5ec
leaq 0x49042(%rip), %rsi     # 0x5d29d
movl $0xb0, %edx
leaq 0x49162(%rip), %rcx     # 0x5d3c9
callq 0xd1c0
movzwl -0x1a(%rbp), %ecx
movb $0x1, %al
cmpl $0x2, %ecx
movb %al, -0x37(%rbp)
jne 0x14294
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x10, %eax
movzwl %ax, %eax
andl $0xfff0, %eax           # imm = 0xFFF0
cmpl $0x0, %eax
sete %al
movb %al, -0x37(%rbp)
movb -0x37(%rbp), %al
testb $0x1, %al
jne 0x1429d
jmp 0x1429f
jmp 0x142be
leaq 0x49392(%rip), %rdi     # 0x5d638
leaq 0x48ff0(%rip), %rsi     # 0x5d29d
movl $0xb1, %edx
leaq 0x49110(%rip), %rcx     # 0x5d3c9
callq 0xd1c0
movzwl -0x1a(%rbp), %ecx
movb $0x1, %al
cmpl $0x3, %ecx
movb %al, -0x38(%rbp)
jne 0x142e6
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x10, %eax
movzwl %ax, %eax
andl $0xff00, %eax           # imm = 0xFF00
cmpl $0x0, %eax
sete %al
movb %al, -0x38(%rbp)
movb -0x38(%rbp), %al
testb $0x1, %al
jne 0x142ef
jmp 0x142f1
jmp 0x14310
leaq 0x4938c(%rip), %rdi     # 0x5d684
leaq 0x48f9e(%rip), %rsi     # 0x5d29d
movl $0xb2, %edx
leaq 0x490be(%rip), %rcx     # 0x5d3c9
callq 0xd1c0
jmp 0x14346
movq -0x10(%rbp), %rax
movl (%rax), %eax
shrl $0x10, %eax
movzwl %ax, %eax
cmpl $0x0, %eax
jne 0x14325
jmp 0x14344
leaq 0x493a4(%rip), %rdi     # 0x5d6d0
leaq 0x48f6a(%rip), %rsi     # 0x5d29d
movl $0xb4, %edx
leaq 0x4908a(%rip), %rcx     # 0x5d3c9
callq 0xd1c0
jmp 0x14346
movq -0x30(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq (%rdi), %rax
callq *0x8(%rax)
testb $0x1, %al
jne 0x14369
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x15190
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x24(%rbp)
cmpl $-0x1, -0x24(%rbp)
je 0x1438d
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x151f0
testb $0x1, %al
jne 0x1438d
jmp 0x1446a
movq -0x30(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x8(%rdx), %rcx
movl 0x10(%rdx), %edx
shlq $0x2, %rdx
addq %rdx, %rcx
addq $0xc, %rcx
cmpq %rcx, %rax
je 0x143f7
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
movzwl -0x1a(%rbp), %esi
addl $0x1, %esi
addl $0x3, %esi
callq 0x13d70
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
movzwl -0x1a(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rsi
movq 0x8(%rax), %rdx
movl 0x10(%rax), %eax
shlq $0x2, %rax
addq %rax, %rdx
addq $0xc, %rdx
callq 0x13db0
cmpl $-0x1, -0x24(%rbp)
je 0x14430
movzwl -0x1a(%rbp), %eax
cmpl $0x4, %eax
jg 0x14430
movq -0x30(%rbp), %rcx
movq 0x8(%rcx), %rax
movl -0x24(%rbp), %edx
movl 0xc(%rax,%rdx,4), %eax
shrl $0x10, %eax
movzwl %ax, %edx
shll $0x10, %edx
orl $0x0, %edx
movq 0x8(%rcx), %rax
movl 0x10(%rcx), %ecx
orl 0xc(%rax,%rcx,4), %edx
movl %edx, 0xc(%rax,%rcx,4)
movq -0x30(%rbp), %rdi
movl 0x10(%rdi), %esi
movq -0x18(%rbp), %rdx
callq 0x15230
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
movl $0x3, 0x8(%rcx)
movl 0x10(%rax), %edx
movq -0x18(%rbp), %rcx
movl %edx, (%rcx)
movzwl -0x1a(%rbp), %ecx
addl $0x1, %ecx
addl $0x3, %ecx
addl 0x10(%rax), %ecx
movl %ecx, 0x10(%rax)
jmp 0x144c5
movzwl -0x1a(%rbp), %eax
cmpl $0x4, %eax
jg 0x144c1
cmpl $-0x1, -0x24(%rbp)
je 0x1447b
jmp 0x1449a
leaq 0x4927b(%rip), %rdi     # 0x5d6fd
leaq 0x48e14(%rip), %rsi     # 0x5d29d
movl $0xdb, %edx
leaq 0x48f34(%rip), %rcx     # 0x5d3c9
callq 0xd1c0
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
movl (%rcx), %ecx
shrl $0x10, %ecx
movzwl %cx, %edx
shll $0x10, %edx
orl $0x0, %edx
movq 0x8(%rax), %rax
movl -0x24(%rbp), %ecx
orl 0xc(%rax,%rcx,4), %edx
movl %edx, 0xc(%rax,%rcx,4)
jmp 0x144c3
jmp 0x144c3
jmp 0x144c5
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)