// File: /workspace/github_cpp_makefile_star2_O3/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 0x46b1(%rip), %rsi      # 0x9166
leaq 0x46b7(%rip), %rdx      # 0x9173
leaq -0x70(%rbp), %rdi
callq 0x799c
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x4cce
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 0x4af9
callq 0x21d0
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0x4b07
callq 0x21d0
leaq 0x4666(%rip), %rsi      # 0x9174
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 0x46a2(%rip), %rsi      # 0x91df
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 0x4613(%rip), %rsi      # 0x917d
movl $0x1, %edx
movq %rax, %rdi
callq 0x2250
movq (%rbx), %r14
movq 0x8(%rbx), %rax
movq %rax, -0x50(%rbp)
cmpq %rax, %r14
je 0x4c05
leaq -0x270(%rbp), %r12
leaq -0x48(%rbp), %rdi
movq %r14, %rsi
callq 0x335e
movq -0x48(%rbp), %r15
movq -0x40(%rbp), %r13
cmpq %r13, %r15
je 0x4bd9
movb $0x1, %al
movl (%r15), %ebx
testb $0x1, %al
jne 0x4bc4
movl $0x1, %edx
movq %r12, %rdi
leaq 0x4620(%rip), %rsi      # 0x91df
callq 0x2250
movq %r12, %rdi
movl %ebx, %esi
callq 0x2370
addq $0x4, %r15
xorl %eax, %eax
cmpq %r13, %r15
jne 0x4ba9
movl $0x3, %edx
movq %r12, %rdi
leaq 0x4593(%rip), %rsi      # 0x917b
callq 0x2250
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x4bfb
callq 0x21d0
addq $0x18, %r14
cmpq -0x50(%rbp), %r14
jne 0x4b8e
leaq -0x270(%rbp), %rdi
callq 0x22b0
movq 0x83b8(%rip), %rdi      # 0xcfd0
leaq 0x4560(%rip), %rsi      # 0x917f
movl $0x14, %edx
callq 0x2250
movq 0x8390(%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 0x4c8b
callq 0x21d0
jmp 0x4c8b
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0x4cc6
callq 0x21d0
jmp 0x4cc6
movq %rax, %rbx
jmp 0x4cc6
jmp 0x4ca4
jmp 0x4ca9
movq %rax, %rbx
jmp 0x4cba
movq %rax, %rbx
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x4cba
callq 0x21d0
leaq -0x270(%rbp), %rdi
callq 0x22e0
movq %rbx, %rdi
callq 0x2380