// File: conp-solutions[P]cnfmiter/AtLeastTwoSolutions.cc
// Function: print_maxsat_formula(CNFMITER::Formula&, std::vector<CNFMITER::Lit, std::allocator<CNFMITER::Lit>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, bool)
void print_maxsat_formula(Formula &hardclauses, std::vector <Lit> penalty_literals, std::string s, bool pre2021format = true)
{
    std::cout << "c AtLeastTwoSolutions, Norbert Manthey, 2021" << std::endl;
    if (!s.empty()) std::cout << "c " << s << std::endl;
    std::cout << "c print in pre2021 MaxSat format: " << pre2021format << std::endl;
    std::cout << "c " << std::endl;
    if(pre2021format)
    {
        size_t top = penalty_literals.size() + 1;
        std::cout << "p wcnf " << hardclauses.nVars() << " " << hardclauses.clauses.size() + penalty_literals.size() << " " << top << std::endl;
        /* print the soft unit clauses */
        for (const auto &unit : penalty_literals) {
            std::stringstream s;
            s << 1 << " " << unit;
            printf("%s 0\n", s.str().c_str());
        }
        /* print the hard clauses */
        for (const auto &c : hardclauses.clauses) {
            std::stringstream s;
            s << top << " " << c;
            printf("%s 0\n", s.str().c_str());
        }
    } else {
        /* print the soft unit clauses */
        for (const auto &unit : penalty_literals) {
            std::stringstream s;
            s << 1 << " " << unit;
            printf("%s 0\n", s.str().c_str());
        }
        /* print the hard clauses */
        for (const auto &c : hardclauses.clauses) {
            std::stringstream s;
            s << "h " << c;
            printf("%s 0\n", s.str().c_str());
        }
    }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x7c0, %rsp            # imm = 0x7C0
movq %rdx, -0x760(%rbp)
movq %rsi, -0x768(%rbp)
movb %cl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
andb $0x1, %al
movb %al, -0x19(%rbp)
movq 0x8705(%rip), %rdi      # 0xafb8
leaq 0x474a(%rip), %rsi      # 0x7004
callq 0x2150
movq %rax, %rdi
movq 0x86cf(%rip), %rsi      # 0xaf98
callq 0x2170
movq -0x760(%rbp), %rdi
callq 0x2230
testb $0x1, %al
jne 0x290f
movq 0x86d3(%rip), %rdi      # 0xafb8
leaq 0x4745(%rip), %rsi      # 0x7031
callq 0x2150
movq -0x760(%rbp), %rsi
movq %rax, %rdi
callq 0x2120
movq %rax, %rdi
movq 0x868e(%rip), %rsi      # 0xaf98
callq 0x2170
movq 0x86a2(%rip), %rdi      # 0xafb8
leaq 0x4724(%rip), %rsi      # 0x7041
callq 0x2150
movq %rax, %rdi
movb -0x19(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x2280
movq %rax, %rdi
movq 0x865c(%rip), %rsi      # 0xaf98
callq 0x2170
movq 0x8670(%rip), %rdi      # 0xafb8
leaq 0x46e2(%rip), %rsi      # 0x7031
callq 0x2150
movq %rax, %rdi
movq 0x863a(%rip), %rsi      # 0xaf98
callq 0x2170
testb $0x1, -0x19(%rbp)
je 0x2cc0
movq -0x768(%rbp), %rdi
callq 0x43f0
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq 0x8630(%rip), %rdi      # 0xafb8
leaq 0x46d5(%rip), %rsi      # 0x7064
callq 0x2150
movq %rax, -0x780(%rbp)
movq -0x8(%rbp), %rdi
callq 0x4250
movq -0x780(%rbp), %rdi
movl %eax, %esi
callq 0x2250
movq %rax, %rdi
leaq 0x46a6(%rip), %rsi      # 0x7062
callq 0x2150
movq %rax, -0x770(%rbp)
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
callq 0x4260
movq -0x768(%rbp), %rdi
movq %rax, -0x778(%rbp)
callq 0x43f0
movq -0x778(%rbp), %rsi
movq -0x770(%rbp), %rdi
addq %rax, %rsi
callq 0x2050
movq %rax, %rdi
leaq 0x465a(%rip), %rsi      # 0x7062
callq 0x2150
movq %rax, %rdi
movq -0x28(%rbp), %rsi
callq 0x2050
movq %rax, %rdi
movq 0x8575(%rip), %rsi      # 0xaf98
callq 0x2170
movq -0x768(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x4410
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0x4440
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x4470
testb $0x1, %al
jne 0x2a63
jmp 0x2b61
leaq -0x38(%rbp), %rdi
callq 0x44b0
movq %rax, -0x48(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x20e0
leaq -0x1c0(%rbp), %rdi
movl $0x1, %esi
callq 0x2250
movq %rax, -0x788(%rbp)
jmp 0x2a96
movq -0x788(%rbp), %rdi
leaq 0x45be(%rip), %rsi      # 0x7062
callq 0x2150
movq %rax, -0x790(%rbp)
jmp 0x2ab2
movq -0x790(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x44d0
jmp 0x2ac4
leaq -0x200(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x2140
jmp 0x2ad9
leaq -0x200(%rbp), %rdi
callq 0x2090
movq %rax, %rsi
leaq 0x454c(%rip), %rdi      # 0x703b
xorl %eax, %eax
callq 0x2030
jmp 0x2af8
leaq -0x200(%rbp), %rdi
callq 0x20b0
leaq -0x1d0(%rbp), %rdi
callq 0x20f0
leaq -0x38(%rbp), %rdi
callq 0x4560
jmp 0x2a4d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x2b50
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x20b0
leaq -0x1d0(%rbp), %rdi
callq 0x20f0
jmp 0x2f63
movq -0x8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x208(%rbp)
movq -0x208(%rbp), %rdi
callq 0x4290
movq %rax, -0x210(%rbp)
movq -0x208(%rbp), %rdi
callq 0x42c0
movq %rax, -0x218(%rbp)
leaq -0x210(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x42f0
testb $0x1, %al
jne 0x2bb2
jmp 0x2cbb
leaq -0x210(%rbp), %rdi
callq 0x4330
movq %rax, -0x220(%rbp)
leaq -0x3a8(%rbp), %rdi
callq 0x20e0
leaq -0x398(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x2050
movq %rax, -0x798(%rbp)
jmp 0x2bea
movq -0x798(%rbp), %rdi
leaq 0x446a(%rip), %rsi      # 0x7062
callq 0x2150
movq %rax, -0x7a0(%rbp)
jmp 0x2c06
movq -0x7a0(%rbp), %rdi
movq -0x220(%rbp), %rsi
callq 0x4350
jmp 0x2c1b
leaq -0x3c8(%rbp), %rdi
leaq -0x3a8(%rbp), %rsi
callq 0x2140
jmp 0x2c30
leaq -0x3c8(%rbp), %rdi
callq 0x2090
movq %rax, %rsi
leaq 0x43f5(%rip), %rdi      # 0x703b
xorl %eax, %eax
callq 0x2030
jmp 0x2c4f
leaq -0x3c8(%rbp), %rdi
callq 0x20b0
leaq -0x3a8(%rbp), %rdi
callq 0x20f0
leaq -0x210(%rbp), %rdi
callq 0x43d0
jmp 0x2b96
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x2caa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
leaq -0x3c8(%rbp), %rdi
callq 0x20b0
leaq -0x3a8(%rbp), %rdi
callq 0x20f0
jmp 0x2f63
jmp 0x2f5a
movq -0x768(%rbp), %rax
movq %rax, -0x3d0(%rbp)
movq -0x3d0(%rbp), %rdi
callq 0x4410
movq %rax, -0x3d8(%rbp)
movq -0x3d0(%rbp), %rdi
callq 0x4440
movq %rax, -0x3e0(%rbp)
leaq -0x3d8(%rbp), %rdi
leaq -0x3e0(%rbp), %rsi
callq 0x4470
testb $0x1, %al
jne 0x2d10
jmp 0x2e1a
leaq -0x3d8(%rbp), %rdi
callq 0x44b0
movq %rax, -0x3e8(%rbp)
leaq -0x570(%rbp), %rdi
callq 0x20e0
leaq -0x560(%rbp), %rdi
movl $0x1, %esi
callq 0x2250
movq %rax, -0x7a8(%rbp)
jmp 0x2d49
movq -0x7a8(%rbp), %rdi
leaq 0x430b(%rip), %rsi      # 0x7062
callq 0x2150
movq %rax, -0x7b0(%rbp)
jmp 0x2d65
movq -0x7b0(%rbp), %rdi
movq -0x3e8(%rbp), %rsi
callq 0x44d0
jmp 0x2d7a
leaq -0x590(%rbp), %rdi
leaq -0x570(%rbp), %rsi
callq 0x2140
jmp 0x2d8f
leaq -0x590(%rbp), %rdi
callq 0x2090
movq %rax, %rsi
leaq 0x4296(%rip), %rdi      # 0x703b
xorl %eax, %eax
callq 0x2030
jmp 0x2dae
leaq -0x590(%rbp), %rdi
callq 0x20b0
leaq -0x570(%rbp), %rdi
callq 0x20f0
leaq -0x3d8(%rbp), %rdi
callq 0x4560
jmp 0x2cf4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x2e09
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
leaq -0x590(%rbp), %rdi
callq 0x20b0
leaq -0x570(%rbp), %rdi
callq 0x20f0
jmp 0x2f63
movq -0x8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x598(%rbp)
movq -0x598(%rbp), %rdi
callq 0x4290
movq %rax, -0x5a0(%rbp)
movq -0x598(%rbp), %rdi
callq 0x42c0
movq %rax, -0x5a8(%rbp)
leaq -0x5a0(%rbp), %rdi
leaq -0x5a8(%rbp), %rsi
callq 0x42f0
testb $0x1, %al
jne 0x2e6b
jmp 0x2f58
leaq -0x5a0(%rbp), %rdi
callq 0x4330
movq %rax, -0x5b0(%rbp)
leaq -0x738(%rbp), %rdi
callq 0x20e0
leaq -0x728(%rbp), %rdi
leaq 0x441b(%rip), %rsi      # 0x72b3
callq 0x2150
movq %rax, -0x7b8(%rbp)
jmp 0x2ea6
movq -0x7b8(%rbp), %rdi
movq -0x5b0(%rbp), %rsi
callq 0x4350
jmp 0x2ebb
leaq -0x758(%rbp), %rdi
leaq -0x738(%rbp), %rsi
callq 0x2140
jmp 0x2ed0
leaq -0x758(%rbp), %rdi
callq 0x2090
movq %rax, %rsi
leaq 0x4155(%rip), %rdi      # 0x703b
xorl %eax, %eax
callq 0x2030
jmp 0x2eef
leaq -0x758(%rbp), %rdi
callq 0x20b0
leaq -0x738(%rbp), %rdi
callq 0x20f0
leaq -0x5a0(%rbp), %rdi
callq 0x43d0
jmp 0x2e4f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
jmp 0x2f4a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d8(%rbp)
movl %eax, -0x1dc(%rbp)
leaq -0x758(%rbp), %rdi
callq 0x20b0
leaq -0x738(%rbp), %rdi
callq 0x20f0
jmp 0x2f63
jmp 0x2f5a
addq $0x7c0, %rsp            # imm = 0x7C0
popq %rbp
retq
movq -0x1d8(%rbp), %rdi
callq 0x2260
nop