// File: /workspace/github_cpp_makefile_star2_O2/vsklad[P]cgen/./bal/cnf/io/cnfvig.hpp
// Function: void bal::CnfVigStreamWriter<true, false>::compute_edge<false>(unsigned int const*, unsigned int, std::map<unsigned long, bal::CnfVigStreamWriter<true, false>::__edge_data_t, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, bal::CnfVigStreamWriter<true, false>::__edge_data_t>>>&, unsigned int&)
void compute_edge(const uint32_t* const p_clause, const timestamp_t timestamp,
                          edges_data_t& edges, unsigned& next_edge_id) {
            // iterate literal pairs
            // it is guaranteed that the sequence is sorted and no duplicates exist
            // weight is calculated such that the sum of weights of edges generated from a clause is 1
            for (auto i = 0; i < _clause_size(p_clause); i++) {
                if (_clause_size(p_clause) > 1) {
                    // determine weight and cardinality contribution to each edge
                    for (auto j = i + 1; j < _clause_size(p_clause); j++) {
                        const variableid_t source = literal_t__variable_id(_clause_literal(p_clause, i));
                        const variableid_t target = literal_t__variable_id(_clause_literal(p_clause, j));
                        const uint64_t key = ((uint64_t)target << 32) | source;
                        
                        // check if the adge exists already; ignore if so, add otherwise
                        auto it = edges.find(key);
                        if (it == edges.end()) {
                            _assert_level_1(!REMOVE);
                            edge_data_t edge_data;
                            edge_data.id = next_edge_id++;
                            edge_data.update(*p_clause, eaInsert, timestamp);
                            edges.insert({key, edge_data});
                        } else {
                            it->second.update(*p_clause, (REMOVE ? eaRemove : eaUpdate), timestamp);
                        };
                    };
                };
            };
        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r8, -0x48(%rbp)
movq %rcx, %r14
movl %edx, -0x2c(%rbp)
movq %rsi, %r12
leaq 0x8(%rcx), %r13
movl (%rsi), %eax
pushq $0x1
popq %r15
xorl %ebx, %ebx
movl %eax, %ecx
andl $0x7fff, %ecx           # imm = 0x7FFF
cmpq %rcx, %rbx
jae 0x22d08
cmpl $0x2, %ecx
movq %r15, -0x40(%rbp)
jae 0x22ce8
jmp 0x22cf9
movl 0x4(%r12,%rbx,4), %eax
shrl %eax
decl %eax
movl 0x4(%r12,%r15,4), %ecx
shrl %ecx
decl %ecx
shlq $0x20, %rcx
orq %rcx, %rax
movq %rax, -0x38(%rbp)
movq %r14, %rdi
leaq -0x38(%rbp), %rsi
callq 0x22d18
cmpq %r13, %rax
je 0x22c91
addq $0x28, %rax
movl (%r12), %esi
movq %rax, %rdi
pushq $0x1
popq %rdx
movl -0x2c(%rbp), %ecx
callq 0x22d74
jmp 0x22ce1
andl $0x0, -0x60(%rbp)
andq $0x0, -0x58(%rbp)
movq -0x48(%rbp), %rdx
movl (%rdx), %eax
leal 0x1(%rax), %ecx
movl %ecx, (%rdx)
movl %eax, -0x50(%rbp)
movl (%r12), %esi
leaq -0x60(%rbp), %rdi
xorl %edx, %edx
movl -0x2c(%rbp), %ecx
callq 0x22d74
movq -0x38(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x50(%rbp), %rax
leaq -0x78(%rbp), %rcx
movq %rax, 0x10(%rcx)
movups -0x60(%rbp), %xmm0
movups %xmm0, (%rcx)
movq %r14, %rdi
leaq -0x80(%rbp), %rsi
callq 0x22e16
movl (%r12), %eax
incq %r15
movl %eax, %ecx
andl $0x7fff, %ecx           # imm = 0x7FFF
cmpq %rcx, %r15
jb 0x22c4b
incq %rbx
movq -0x40(%rbp), %r15
incq %r15
jmp 0x22c28
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop