// File: cauimsouza[P]rikudo-solver/src/rikudo_solver/graph.cpp
// Function: Graph::read_sol()
std::vector<int>& Graph::read_sol()
{
    path.assign(n_vertices, -1);

    std::ifstream myfile;
    myfile.open(get_path(sat_output));

    std::string line;

    while(getline(myfile, line)){
        std::istringstream iss(line);

        std::string type;
        iss >> type;

        if(type == "v"){
            int val;
            while(iss >> val){
                if(val > 0 && val <= n_vertices * n_vertices){
                    int i, j;
                    decode(val, i, j);
                    path[i] = j;
                }
            }
        }
    }


    myfile.close();

    std::cout << "sat file read\n";
    
    for(int i = 0; i < n_vertices; i++){
        if(path[i] == -1) {
            path.clear();
            return path;
        }
    }

    return path;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x490, %rsp            # imm = 0x490
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x460(%rbp)
movq %rax, %rdi
addq $0x90, %rdi
movslq (%rax), %rsi
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
leaq -0x14(%rbp), %rdx
callq 0xb540
leaq -0x220(%rbp), %rdi
callq 0x3290
leaq -0x261(%rbp), %rdi
movq %rdi, -0x458(%rbp)
callq 0x3410
movq -0x458(%rbp), %rdx
leaq 0xadce(%rip), %rsi      # 0x13152
leaq -0x260(%rbp), %rdi
callq 0x3300
jmp 0x8392
leaq -0x240(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0x8170
jmp 0x83a7
leaq -0x220(%rbp), %rdi
leaq -0x240(%rbp), %rsi
movl $0x8, %edx
callq 0x31d0
jmp 0x83c1
leaq -0x240(%rbp), %rdi
callq 0x3170
leaq -0x260(%rbp), %rdi
callq 0x3170
leaq -0x261(%rbp), %rdi
callq 0x3270
leaq -0x298(%rbp), %rdi
callq 0x3310
leaq -0x220(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x3050
movq %rax, -0x468(%rbp)
jmp 0x840d
movq -0x468(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x32c0
movb %al, -0x469(%rbp)
jmp 0x842b
movb -0x469(%rbp), %al
testb $0x1, %al
jne 0x843a
jmp 0x8638
leaq -0x418(%rbp), %rdi
leaq -0x298(%rbp), %rsi
movl $0x8, %edx
callq 0x33b0
jmp 0x8454
leaq -0x438(%rbp), %rdi
movq %rdi, -0x478(%rbp)
callq 0x3310
movq -0x478(%rbp), %rsi
leaq -0x418(%rbp), %rdi
callq 0x32d0
jmp 0x847c
leaq 0xacde(%rip), %rsi      # 0x13161
leaq -0x438(%rbp), %rdi
callq 0xb570
movb %al, -0x479(%rbp)
jmp 0x8497
movb -0x479(%rbp), %al
testb $0x1, %al
jne 0x84a6
jmp 0x861b
jmp 0x84a8
leaq -0x418(%rbp), %rdi
leaq -0x43c(%rbp), %rsi
callq 0x3160
movq %rax, -0x488(%rbp)
jmp 0x84c4
movq -0x488(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x32c0
movb %al, -0x489(%rbp)
jmp 0x84e2
movb -0x489(%rbp), %al
testb $0x1, %al
jne 0x84f1
jmp 0x8619
cmpl $0x0, -0x43c(%rbp)
jle 0x8614
movq -0x460(%rbp), %rdx
movl -0x43c(%rbp), %eax
movl (%rdx), %ecx
imull (%rdx), %ecx
cmpl %ecx, %eax
jg 0x8614
movq -0x460(%rbp), %rdi
movl -0x43c(%rbp), %esi
leaq -0x440(%rbp), %rdx
leaq -0x444(%rbp), %rcx
callq 0x6640
movq -0x460(%rbp), %rdi
movl -0x444(%rbp), %eax
movl %eax, -0x490(%rbp)
addq $0x90, %rdi
movslq -0x440(%rbp), %rsi
callq 0xaf50
movl -0x490(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x8614
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x270(%rbp)
movl %eax, -0x274(%rbp)
jmp 0x85bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x270(%rbp)
movl %eax, -0x274(%rbp)
jmp 0x85b1
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 0x8724
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x270(%rbp)
movl %eax, -0x274(%rbp)
jmp 0x8718
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x270(%rbp)
movl %eax, -0x274(%rbp)
leaq -0x438(%rbp), %rdi
callq 0x3170
leaq -0x418(%rbp), %rdi
callq 0x3100
jmp 0x8718
jmp 0x84a8
jmp 0x861b
leaq -0x438(%rbp), %rdi
callq 0x3170
leaq -0x418(%rbp), %rdi
callq 0x3100
jmp 0x83f1
leaq -0x220(%rbp), %rdi
callq 0x3060
jmp 0x8646
movq 0x11983(%rip), %rdi     # 0x19fd0
leaq 0xab0f(%rip), %rsi      # 0x13163
callq 0x3230
jmp 0x865b
movl $0x0, -0x448(%rbp)
movq -0x460(%rbp), %rcx
movl -0x448(%rbp), %eax
cmpl (%rcx), %eax
jge 0x86d8
movq -0x460(%rbp), %rdi
addq $0x90, %rdi
movslq -0x448(%rbp), %rsi
callq 0xaf50
cmpl $-0x1, (%rax)
jne 0x86c5
movq -0x460(%rbp), %rdi
addq $0x90, %rdi
callq 0xb440
movq -0x460(%rbp), %rax
addq $0x90, %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0x44c(%rbp)
jmp 0x86f3
jmp 0x86c7
movl -0x448(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x448(%rbp)
jmp 0x8665
movq -0x460(%rbp), %rax
addq $0x90, %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0x44c(%rbp)
leaq -0x298(%rbp), %rdi
callq 0x3170
leaq -0x220(%rbp), %rdi
callq 0x3080
movq -0x8(%rbp), %rax
addq $0x490, %rsp            # imm = 0x490
popq %rbp
retq
leaq -0x298(%rbp), %rdi
callq 0x3170
leaq -0x220(%rbp), %rdi
callq 0x3080
movq -0x270(%rbp), %rdi
callq 0x3400
nopl (%rax)