// File: cauimsouza[P]rikudo-solver/src/rikudo_solver/graph.cpp
// Function: Graph::write_min_cons(std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&, int, std::basic_ofstream<char, std::char_traits<char>>&)
void Graph::write_min_cons(std::vector<int>& orig_path, std::vector<int>& cons, int num, std::ofstream &ofile){
    for(int v : orig_path){
        ofile << v << "\n";
    }
    
    ofile << "-1\n";

    for(int i = 0; i <= num; i++){
        int con = cons[i];

        if(con < 0){
            con = -con;
            ofile << orig_path[con] << " " << con + 1 << "\n";
        }
    }

    ofile << "-1\n";

    for(int i = 0; i <= num; i++){
        int con = cons[i];

        if(con >= 0){
            int u = orig_path[con];
            int v = orig_path[con+1];
            ofile << u << " " << v << "\n";
        }
    }

    ofile << "-1\n";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x4700
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0x4730
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x4760
testb $0x1, %al
jne 0xa5c0
jmp 0xa5f4
leaq -0x38(%rbp), %rdi
callq 0x47a0
movl (%rax), %eax
movl %eax, -0x44(%rbp)
movq -0x28(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0x33f0
movq %rax, %rdi
leaq 0x8b57(%rip), %rsi      # 0x1313b
callq 0x3230
leaq -0x38(%rbp), %rdi
callq 0x47c0
jmp 0xa5ad
movq -0x28(%rbp), %rdi
leaq 0x8bb2(%rip), %rsi      # 0x131b1
callq 0x3230
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jg 0xa68f
movq -0x18(%rbp), %rdi
movslq -0x48(%rbp), %rsi
callq 0xaf50
movl (%rax), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
jge 0xa67f
xorl %eax, %eax
subl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
movslq -0x4c(%rbp), %rsi
callq 0xaf50
movq -0x68(%rbp), %rdi
movl (%rax), %esi
callq 0x33f0
movq %rax, %rdi
leaq 0x8b40(%rip), %rsi      # 0x1319d
callq 0x3230
movq %rax, %rdi
movl -0x4c(%rbp), %esi
addl $0x1, %esi
callq 0x33f0
movq %rax, %rdi
leaq 0x8ac1(%rip), %rsi      # 0x1313b
callq 0x3230
jmp 0xa681
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0xa60b
movq -0x28(%rbp), %rdi
leaq 0x8b17(%rip), %rsi      # 0x131b1
callq 0x3230
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jg 0xa738
movq -0x18(%rbp), %rdi
movslq -0x50(%rbp), %rsi
callq 0xaf50
movl (%rax), %eax
movl %eax, -0x54(%rbp)
cmpl $0x0, -0x54(%rbp)
jl 0xa728
movq -0x10(%rbp), %rdi
movslq -0x54(%rbp), %rsi
callq 0xaf50
movl (%rax), %eax
movl %eax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
movl -0x54(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0xaf50
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x28(%rbp), %rdi
movl -0x58(%rbp), %esi
callq 0x33f0
movq %rax, %rdi
leaq 0x8a94(%rip), %rsi      # 0x1319d
callq 0x3230
movq %rax, %rdi
movl -0x5c(%rbp), %esi
callq 0x33f0
movq %rax, %rdi
leaq 0x8a18(%rip), %rsi      # 0x1313b
callq 0x3230
jmp 0xa72a
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0xa6a6
movq -0x28(%rbp), %rdi
leaq 0x8a6e(%rip), %rsi      # 0x131b1
callq 0x3230
addq $0x70, %rsp
popq %rbp
retq
nop