// File: /workspace/github_cpp_makefile_star2_O1/cauimsouza[P]rikudo-solver/src/rikudo_solver/graph.cpp
// Function: Graph::write_sat(std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>&)
void Graph::write_sat(std::vector<std::vector<int> > &clauses){
    std::ofstream ofs(get_path(sat_input));

    ofs << "p cnf " << n_vertices*n_vertices*2 << " " << (int) clauses.size() << "\n";
    for(auto c : clauses){
        bool first = true;
        for(auto v : c){
            if(!first)  ofs << " ";
            ofs << v;
            first = false;
        }
        ofs << " 0\n";
    }

    ofs.close();

    std::cout << "sat formula written\n";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x60(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x45f1(%rip), %rsi      # 0x914e
leaq 0x45f7(%rip), %rdx      # 0x915b
leaq -0x70(%rbp), %rdi
callq 0x7a46
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x4d76
leaq -0x270(%rbp), %rdi
leaq -0x48(%rbp), %rsi
movl $0x10, %edx
callq 0x23d0
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4ba1
callq 0x21d0
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0x4baf
callq 0x21d0
leaq 0x45a6(%rip), %rsi      # 0x915c
leaq -0x270(%rbp), %rdi
movl $0x6, %edx
callq 0x2250
movl (%r14), %esi
imull %esi, %esi
addl %esi, %esi
leaq -0x270(%rbp), %rdi
callq 0x2370
movq %rax, %r14
leaq 0x45e2(%rip), %rsi      # 0x91c7
movl $0x1, %edx
movq %rax, %rdi
callq 0x2250
movq 0x8(%rbx), %rax
subq (%rbx), %rax
shrq $0x3, %rax
imull $0xaaaaaaab, %eax, %esi # imm = 0xAAAAAAAB
movq %r14, %rdi
callq 0x2370
leaq 0x4553(%rip), %rsi      # 0x9165
movl $0x1, %edx
movq %rax, %rdi
callq 0x2250
movq (%rbx), %r14
movq 0x8(%rbx), %rax
movq %rax, -0x50(%rbp)
cmpq %rax, %r14
je 0x4cad
leaq -0x270(%rbp), %r12
leaq -0x48(%rbp), %rdi
movq %r14, %rsi
callq 0x3364
movq -0x48(%rbp), %r15
movq -0x40(%rbp), %r13
cmpq %r13, %r15
je 0x4c81
movb $0x1, %al
movl (%r15), %ebx
testb $0x1, %al
jne 0x4c6c
movl $0x1, %edx
movq %r12, %rdi
leaq 0x4560(%rip), %rsi      # 0x91c7
callq 0x2250
movq %r12, %rdi
movl %ebx, %esi
callq 0x2370
addq $0x4, %r15
xorl %eax, %eax
cmpq %r13, %r15
jne 0x4c51
movl $0x3, %edx
movq %r12, %rdi
leaq 0x44d3(%rip), %rsi      # 0x9163
callq 0x2250
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x4ca3
callq 0x21d0
addq $0x18, %r14
cmpq -0x50(%rbp), %r14
jne 0x4c36
leaq -0x270(%rbp), %rdi
callq 0x22b0
movq 0x8310(%rip), %rdi      # 0xcfd0
leaq 0x44a0(%rip), %rsi      # 0x9167
movl $0x14, %edx
callq 0x2250
movq 0x82e8(%rip), %rax      # 0xcfc0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x268(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x270(%rbp,%rcx)
callq 0x2180
leaq -0x178(%rbp), %rdi
callq 0x20a0
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4d33
callq 0x21d0
jmp 0x4d33
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0x4d6e
callq 0x21d0
jmp 0x4d6e
movq %rax, %rbx
jmp 0x4d6e
jmp 0x4d4c
jmp 0x4d51
movq %rax, %rbx
jmp 0x4d62
movq %rax, %rbx
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x4d62
callq 0x21d0
leaq -0x270(%rbp), %rdi
callq 0x22e0
movq %rbx, %rdi
callq 0x2380