// File: conp-solutions[P]cnfmiter/Main.cc
// Function: generate_formula_miter(CNFMITER::Formula&, CNFMITER::Formula const&, CNFMITER::Formula const&)
void generate_formula_miter(Formula &formula, const Formula &input1, const Formula &input2)
{
    Lit e1, e2;
    generate_clause_sat(formula, input1, e1);
    std::cerr << "c after 1st equivalence formula, miter has " << formula.nVars() << " variables" << std::endl;
    generate_clause_sat(formula, input2, e2);
    std::cerr << "c after 2nd equivalence formula, miter has " << formula.nVars() << " variables" << std::endl;

    std::vector<Lit> clause;

    // !e1 -> e2
    clause.push_back(e1);
    clause.push_back(e2);
    formula.addClause_(clause);

    // e1 -> !e2
    clause[0] = ~e1;
    clause[1] = ~e2;
    formula.addClause_(clause);
    std::cerr << "c miter has " << formula.nVars() << " variables and " << formula.clauses.size() << " clauses" << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
movq %rdx, -0x60(%rbp)
callq 0x25a0
movq 0x982d(%rip), %rdi      # 0xbff0
movq %rdi, -0x88(%rbp)
leaq 0x5833(%rip), %rsi      # 0x8004
callq 0x2190
movq %rax, -0x90(%rbp)
movq -0x8(%rbp), %rdi
callq 0x4bb0
movq -0x90(%rbp), %rdi
movl %eax, %esi
callq 0x22a0
movq %rax, %rdi
leaq 0x5832(%rip), %rsi      # 0x8030
movq %rsi, -0x78(%rbp)
callq 0x2190
movq %rax, %rdi
movq 0x9787(%rip), %rsi      # 0xbf98
movq %rsi, -0x70(%rbp)
callq 0x21b0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x20(%rbp), %rdx
callq 0x25a0
movq -0x88(%rbp), %rdi
leaq 0x5802(%rip), %rsi      # 0x803b
callq 0x2190
movq %rax, -0x80(%rbp)
movq -0x8(%rbp), %rdi
callq 0x4bb0
movq -0x80(%rbp), %rdi
movl %eax, %esi
callq 0x22a0
movq -0x78(%rbp), %rsi
movq %rax, %rdi
callq 0x2190
movq -0x70(%rbp), %rsi
movq %rax, %rdi
callq 0x21b0
leaq -0x38(%rbp), %rdi
movq %rdi, -0x68(%rbp)
callq 0x4560
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x48d0
jmp 0x288a
leaq -0x38(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x48d0
jmp 0x2899
movq -0x8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x48a0
jmp 0x28a8
movl -0x1c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %edi
callq 0x4880
movl %eax, -0x94(%rbp)
jmp 0x28be
movl -0x94(%rbp), %eax
movl %eax, -0x48(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x4a00
movl -0x48(%rbp), %ecx
movl %ecx, (%rax)
movl -0x20(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %edi
callq 0x4880
movl %eax, -0x98(%rbp)
jmp 0x28ef
movl -0x98(%rbp), %eax
movl %eax, -0x50(%rbp)
leaq -0x38(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
movl $0x1, %esi
callq 0x4a00
movq -0xa0(%rbp), %rsi
movl -0x50(%rbp), %ecx
movl %ecx, (%rax)
movq -0x8(%rbp), %rdi
callq 0x48a0
jmp 0x2924
movq 0x96c5(%rip), %rdi      # 0xbff0
leaq 0x5735(%rip), %rsi      # 0x8067
callq 0x2190
movq %rax, -0xa8(%rbp)
jmp 0x2940
movq -0x8(%rbp), %rdi
callq 0x4bb0
movl %eax, -0xac(%rbp)
jmp 0x2951
movl -0xac(%rbp), %esi
movq -0xa8(%rbp), %rdi
callq 0x22a0
movq %rax, -0xb8(%rbp)
jmp 0x296c
movq -0xb8(%rbp), %rdi
leaq 0x56fa(%rip), %rsi      # 0x8074
callq 0x2190
movq %rax, -0xc0(%rbp)
jmp 0x2988
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
callq 0x4bc0
movq -0xc0(%rbp), %rdi
movq %rax, %rsi
callq 0x2070
movq %rax, -0xc8(%rbp)
jmp 0x29ad
movq -0xc8(%rbp), %rdi
leaq 0x56c9(%rip), %rsi      # 0x8084
callq 0x2190
movq %rax, -0xd0(%rbp)
jmp 0x29c9
movq -0xd0(%rbp), %rdi
movq 0x95c1(%rip), %rsi      # 0xbf98
callq 0x21b0
jmp 0x29de
leaq -0x38(%rbp), %rdi
callq 0x4580
addq $0xd0, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x4580
movq -0x40(%rbp), %rdi
callq 0x22b0
nop