// File: cauimsouza[P]rikudo-solver/src/rikudo_solver/graph.cpp
// Function: Graph::add_cons(std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&, int)
void Graph::add_cons(std::vector<int>& orig_path, std::vector<int>& cons, int pos){
    std::ofstream ofile;
    ofile.open(get_path(sat_input), std::ofstream::app);

    int n_vertices = orig_path.size();
    for(int i = 0; i <= pos; i++){
        int con = cons[i];
        if(con >= 0){
            int u = orig_path[con];
            int v = orig_path[con+1];
            std::string diam = diam_s(u, v, n_vertices);
            ofile << diam;
        }
        else{
            con = -con;
            int var = encode(con, orig_path[con]);
            ofile << std::to_string(var) << " 0\n";
        }
    }

    ofile.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2f0, %rsp            # imm = 0x2F0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2e0(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x33d0
leaq -0x261(%rbp), %rdi
movq %rdi, -0x2d8(%rbp)
callq 0x3410
movq -0x2d8(%rbp), %rdx
leaq 0x87f2(%rip), %rsi      # 0x13124
leaq -0x260(%rbp), %rdi
callq 0x3300
jmp 0xa940
leaq -0x240(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0x8170
jmp 0xa955
leaq -0x220(%rbp), %rdi
leaq -0x240(%rbp), %rsi
movl $0x1, %edx
callq 0x3110
jmp 0xa96f
leaq -0x240(%rbp), %rdi
callq 0x3170
leaq -0x260(%rbp), %rdi
callq 0x3170
leaq -0x261(%rbp), %rdi
callq 0x3270
movq -0x10(%rbp), %rdi
callq 0x5460
movl %eax, -0x278(%rbp)
movl $0x0, -0x27c(%rbp)
movl -0x27c(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jg 0xabca
movq -0x18(%rbp), %rdi
movslq -0x27c(%rbp), %rsi
callq 0xaf50
movl (%rax), %eax
movl %eax, -0x280(%rbp)
cmpl $0x0, -0x280(%rbp)
jl 0xaaff
movq -0x10(%rbp), %rdi
movslq -0x280(%rbp), %rsi
callq 0xaf50
movl (%rax), %eax
movl %eax, -0x284(%rbp)
movq -0x10(%rbp), %rdi
movl -0x280(%rbp), %eax
incl %eax
movslq %eax, %rsi
callq 0xaf50
movq -0x2e0(%rbp), %rsi
movl (%rax), %eax
movl %eax, -0x288(%rbp)
movl -0x284(%rbp), %edx
movl -0x288(%rbp), %ecx
movl -0x278(%rbp), %r8d
leaq -0x2a8(%rbp), %rdi
callq 0xac10
jmp 0xaa3c
leaq -0x220(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0x31f0
jmp 0xaa51
leaq -0x2a8(%rbp), %rdi
callq 0x3170
jmp 0xabb4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x270(%rbp)
movl %eax, -0x274(%rbp)
jmp 0xaab4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x270(%rbp)
movl %eax, -0x274(%rbp)
jmp 0xaaa8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x270(%rbp)
movl %eax, -0x274(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x3170
leaq -0x260(%rbp), %rdi
callq 0x3170
leaq -0x261(%rbp), %rdi
callq 0x3270
jmp 0xabed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x270(%rbp)
movl %eax, -0x274(%rbp)
jmp 0xabed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x270(%rbp)
movl %eax, -0x274(%rbp)
leaq -0x2a8(%rbp), %rdi
callq 0x3170
jmp 0xabed
movl -0x280(%rbp), %eax
negl %eax
movl %eax, -0x280(%rbp)
movl -0x280(%rbp), %eax
movl %eax, -0x2e4(%rbp)
movq -0x10(%rbp), %rdi
movslq %eax, %rsi
callq 0xaf50
movq -0x2e0(%rbp), %rdi
movl -0x2e4(%rbp), %esi
movl (%rax), %edx
xorl %ecx, %ecx
callq 0x65f0
movl %eax, -0x2ac(%rbp)
movl -0x2ac(%rbp), %esi
leaq -0x2d0(%rbp), %rdi
callq 0xbc40
jmp 0xab55
leaq -0x220(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x31f0
movq %rax, -0x2f0(%rbp)
jmp 0xab71
movq -0x2f0(%rbp), %rdi
leaq 0x85ba(%rip), %rsi      # 0x13139
callq 0x3230
jmp 0xab86
leaq -0x2d0(%rbp), %rdi
callq 0x3170
jmp 0xabb4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x270(%rbp)
movl %eax, -0x274(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0x3170
jmp 0xabed
jmp 0xabb6
movl -0x27c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x27c(%rbp)
jmp 0xa9ac
leaq -0x220(%rbp), %rdi
callq 0x3330
jmp 0xabd8
leaq -0x220(%rbp), %rdi
callq 0x3350
addq $0x2f0, %rsp            # imm = 0x2F0
popq %rbp
retq
leaq -0x220(%rbp), %rdi
callq 0x3350
movq -0x270(%rbp), %rdi
callq 0x3400
nopw %cs:(%rax,%rax)