// File: /workspace/github_cpp_makefile_star2_O1/vsklad[P]cgen/./bal/encoding/literal.hpp
// Function: unsigned int bal::eor<bal::Anf>(bal::Anf*, unsigned int*, unsigned long, unsigned int)
literalid_t eor(FORMULA_T* const formula, literalid_t args[], const std::size_t args_size, const literalid_t constant) {
        _assert_level_0(literal_t__is_constant(constant));
        if (args_size == 0) {
            return constant;
        } else {
            literalid_t result = LITERALID_UNASSIGNED;
            _assert_level_0(formula != nullptr);
            
            // split a single xor into smaller ones if requested
            const std::size_t batch_size = formula->get_xor_max_args();
            std::size_t vargs_start_idx = 0;
            
            while (true) {
                const std::size_t vargs_size = batch_size > args_size - vargs_start_idx ? args_size - vargs_start_idx : batch_size;
                
                if (vargs_size > 1) {
                    _assert_level_0(formula != nullptr);
                    result = formula->new_variable_literal();
                    eor(formula, result, args + vargs_start_idx, vargs_size);
                } else if (vargs_size == 1) {
                    result = args[vargs_start_idx];
                };
                
                vargs_start_idx += vargs_size;
                if (vargs_start_idx < args_size) {
                    vargs_start_idx--;
                    args[vargs_start_idx] = result;
                } else {
                    break;
                };
            };
            
            // invert the result if the sum of the constants is 1, i.e. xor(x, 1) <-> not(x)
            return literal_t__negated_onlyif(result, literal_t__is_constant_1(constant));;
        };
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, -0x30(%rbp)
cmpl $0x2, %ecx
jae 0x30d39
movq %rdx, %rbx
testq %rdx, %rdx
je 0x30d28
movq %rdi, %r14
testq %rdi, %rdi
je 0x30d58
movl %ecx, -0x34(%rbp)
movl 0x74(%r14), %eax
testl %eax, %eax
jne 0x30ca1
movq (%r14), %rax
movq %r14, %rdi
callq *0x30(%rax)
movq %r14, -0x40(%rbp)
movl %eax, %r15d
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
xorl %r12d, %r12d
movq %rbx, %r14
subq %r12, %r14
cmpq %r15, %r14
cmovaeq %r15, %r14
cmpq $0x2, %r14
jb 0x30cee
movq -0x40(%rbp), %r13
movq (%r13), %rax
movq %r13, %rdi
callq *0x8(%rax)
movl %eax, %ecx
movq -0x30(%rbp), %rax
leaq (%rax,%r12,4), %rdx
movq %r13, %rdi
movl %ecx, %r13d
movl %ecx, %esi
movq %r14, %rcx
callq 0xfd50
jmp 0x30cfc
cmpq $0x1, %r14
jne 0x30cfc
movq -0x30(%rbp), %rax
movl (%rax,%r12,4), %r13d
addq %r12, %r14
movq %r14, %r12
cmpq %rbx, %r14
jae 0x30d14
leaq -0x1(%r14), %r12
movq -0x30(%rbp), %rax
movl %r13d, -0x4(%rax,%r14,4)
cmpq %rbx, %r14
jb 0x30cb1
xorl %eax, %eax
cmpl $0x1, -0x34(%rbp)
sete %al
xorl %eax, %r13d
movl %r13d, %ecx
movl %ecx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1a6d7(%rip), %rdi     # 0x4b417
leaq 0x190c0(%rip), %rsi     # 0x49e07
leaq 0x1a6f4(%rip), %rcx     # 0x4b442
movl $0xbe, %edx
callq 0xc180
leaq 0x1baa1(%rip), %rdi     # 0x4c800
leaq 0x190a1(%rip), %rsi     # 0x49e07
leaq 0x1a6d5(%rip), %rcx     # 0x4b442
movl $0xc3, %edx
callq 0xc180