// File: cauimsouza[P]rikudo-solver/src/rikudo_solver/main.cpp
// Function: main
int main(int argc, char const *argv[])
{
    if(argc == 1){
        std::ifstream ifile("graph.txt");
        std::ofstream ofile("solution.txt");

        solves_rikudo(ifile, ofile);

        ifile.close();
        ofile.close();
    }
    else if(argc == 2){
        std::string ifile_name(argv[1]);
        std::ifstream ifile(ifile_name);
        Graph graph(ifile);
        int source, target;
        ifile >> source >> target;
        auto paths = graph.ham_path(source, target);
        if(paths.size() > 0){
            for(int i : paths[0])
                std::cout << i << " ";
            std::cout << "\n";
        }
    }
    else if(argc == 3){
        std::ifstream ifile;
        std::ofstream ofile;

        std::string inp_file(argv[1]);
        std::string out_file(argv[2]);
        ifile.open(get_path(inp_file));
        if(!ifile){
            std::cerr << "Unable to open input file " << argv[1] << "\n";
            exit(1);
        }

        ofile.open(get_path(out_file));
        if(!ofile){
            std::cerr << "Unable to open output file " << argv[2] << "\n";
            exit(1);
        }

        solves_rikudo(ifile, ofile);

        ifile.close();
        ofile.close();
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd00, %rsp            # imm = 0xD00
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x1, -0x8(%rbp)
jne 0x3b56
leaq 0xf5ab(%rip), %rsi      # 0x13045
leaq -0x218(%rbp), %rdi
movl $0x8, %edx
callq 0x3420
leaq 0xf59d(%rip), %rsi      # 0x1304f
leaq -0x418(%rbp), %rdi
movl $0x10, %edx
callq 0x3280
jmp 0x3ac5
leaq -0x218(%rbp), %rdi
leaq -0x418(%rbp), %rsi
callq 0x39c0
jmp 0x3ada
leaq -0x218(%rbp), %rdi
callq 0x3060
jmp 0x3ae8
leaq -0x418(%rbp), %rdi
callq 0x3330
jmp 0x3af6
leaq -0x418(%rbp), %rdi
callq 0x3350
leaq -0x218(%rbp), %rdi
callq 0x3080
jmp 0x42e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
jmp 0x3b45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
leaq -0x418(%rbp), %rdi
callq 0x3350
leaq -0x218(%rbp), %rdi
callq 0x3080
jmp 0x42ec
cmpl $0x2, -0x8(%rbp)
jne 0x3ed3
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xc68(%rbp)
leaq -0x449(%rbp), %rdi
movq %rdi, -0xc60(%rbp)
callq 0x3410
movq -0xc68(%rbp), %rsi
movq -0xc60(%rbp), %rdx
leaq -0x448(%rbp), %rdi
callq 0x3300
jmp 0x3b9e
leaq -0x449(%rbp), %rdi
callq 0x3270
leaq -0x658(%rbp), %rdi
leaq -0x448(%rbp), %rsi
movl $0x8, %edx
callq 0x3380
jmp 0x3bc4
leaq -0x700(%rbp), %rdi
leaq -0x658(%rbp), %rsi
callq 0x6a60
jmp 0x3bd9
leaq -0x658(%rbp), %rdi
leaq -0x704(%rbp), %rsi
callq 0x3160
movq %rax, -0xc70(%rbp)
jmp 0x3bf5
movq -0xc70(%rbp), %rdi
leaq -0x708(%rbp), %rsi
callq 0x3160
jmp 0x3c0a
movl -0x704(%rbp), %eax
movl %eax, -0xc88(%rbp)
movl -0x708(%rbp), %eax
movl %eax, -0xc84(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0xca0(%rbp)
movaps %xmm0, -0x740(%rbp)
movq $0x0, -0x730(%rbp)
leaq -0x740(%rbp), %rdi
movq %rdi, -0xc80(%rbp)
callq 0x4490
movaps -0xca0(%rbp), %xmm0
movaps %xmm0, -0x760(%rbp)
movq $0x0, -0x750(%rbp)
leaq -0x760(%rbp), %rdi
movq %rdi, -0xc90(%rbp)
callq 0x4490
movq -0xc90(%rbp), %rcx
movl -0xc88(%rbp), %esi
movl -0xc84(%rbp), %edx
movq -0xc80(%rbp), %r9
movq %rsp, %rax
movq %rcx, (%rax)
leaq -0x700(%rbp), %rdi
movl $0x1, %ecx
xorl %r8d, %r8d
callq 0x9f70
movq %rax, -0xc78(%rbp)
jmp 0x3cba
movq -0xc78(%rbp), %rsi
leaq -0x720(%rbp), %rdi
callq 0x44b0
jmp 0x3ccf
leaq -0x760(%rbp), %rdi
callq 0x45a0
leaq -0x740(%rbp), %rdi
callq 0x45a0
leaq -0x720(%rbp), %rdi
callq 0x4600
cmpq $0x0, %rax
jbe 0x3e75
leaq -0x720(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x4440
movq %rax, -0x768(%rbp)
movq -0x768(%rbp), %rdi
callq 0x4700
movq %rax, -0x770(%rbp)
movq -0x768(%rbp), %rdi
callq 0x4730
movq %rax, -0x778(%rbp)
leaq -0x770(%rbp), %rdi
leaq -0x778(%rbp), %rsi
callq 0x4760
testb $0x1, %al
jne 0x3d56
jmp 0x3e5e
leaq -0x770(%rbp), %rdi
callq 0x47a0
movl (%rax), %eax
movl %eax, -0x77c(%rbp)
movl -0x77c(%rbp), %esi
movq 0x16259(%rip), %rdi     # 0x19fd0
callq 0x33f0
movq %rax, -0xca8(%rbp)
jmp 0x3d85
movq -0xca8(%rbp), %rdi
leaq 0xf40a(%rip), %rsi      # 0x1319d
callq 0x3230
jmp 0x3d9a
jmp 0x3d9c
leaq -0x770(%rbp), %rdi
callq 0x47c0
jmp 0x3d3a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
leaq -0x449(%rbp), %rdi
callq 0x3270
jmp 0x42ec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
jmp 0x3ec2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
jmp 0x3eb6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
jmp 0x3eaa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
leaq -0x760(%rbp), %rdi
callq 0x45a0
leaq -0x740(%rbp), %rdi
callq 0x45a0
jmp 0x3eaa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
leaq -0x720(%rbp), %rdi
callq 0x4630
jmp 0x3eaa
movq 0x1616b(%rip), %rdi     # 0x19fd0
leaq 0xf2cf(%rip), %rsi      # 0x1313b
callq 0x3230
jmp 0x3e73
jmp 0x3e75
leaq -0x720(%rbp), %rdi
callq 0x4630
leaq -0x700(%rbp), %rdi
callq 0x4690
leaq -0x658(%rbp), %rdi
callq 0x3080
leaq -0x448(%rbp), %rdi
callq 0x3170
jmp 0x42df
leaq -0x700(%rbp), %rdi
callq 0x4690
leaq -0x658(%rbp), %rdi
callq 0x3080
leaq -0x448(%rbp), %rdi
callq 0x3170
jmp 0x42ec
cmpl $0x3, -0x8(%rbp)
jne 0x42dd
leaq -0x988(%rbp), %rdi
callq 0x3290
leaq -0xb88(%rbp), %rdi
callq 0x33d0
jmp 0x3ef7
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xcb8(%rbp)
leaq -0xba9(%rbp), %rdi
movq %rdi, -0xcb0(%rbp)
callq 0x3410
movq -0xcb8(%rbp), %rsi
movq -0xcb0(%rbp), %rdx
leaq -0xba8(%rbp), %rdi
callq 0x3300
jmp 0x3f35
leaq -0xba9(%rbp), %rdi
callq 0x3270
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xcc8(%rbp)
leaq -0xbd1(%rbp), %rdi
movq %rdi, -0xcc0(%rbp)
callq 0x3410
movq -0xcc8(%rbp), %rsi
movq -0xcc0(%rbp), %rdx
leaq -0xbd0(%rbp), %rdi
callq 0x3300
jmp 0x3f7f
leaq -0xbd1(%rbp), %rdi
callq 0x3270
leaq -0xc18(%rbp), %rdi
leaq -0xba8(%rbp), %rsi
callq 0x30e0
jmp 0x3fa0
leaq -0xbf8(%rbp), %rdi
leaq -0xc18(%rbp), %rsi
callq 0x8170
jmp 0x3fb5
leaq -0x988(%rbp), %rdi
leaq -0xbf8(%rbp), %rsi
movl $0x8, %edx
callq 0x31d0
jmp 0x3fcf
leaq -0xbf8(%rbp), %rdi
callq 0x3170
leaq -0xc18(%rbp), %rdi
callq 0x3170
movq -0x988(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x988(%rbp,%rax), %rdi
callq 0x30f0
movb %al, -0xcc9(%rbp)
jmp 0x4007
movb -0xcc9(%rbp), %al
testb $0x1, %al
jne 0x4016
jmp 0x4125
movq 0x15fd3(%rip), %rdi     # 0x19ff0
leaq 0xf038(%rip), %rsi      # 0x1305c
callq 0x3230
movq %rax, -0xcd8(%rbp)
jmp 0x4032
movq -0xcd8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x3230
movq %rax, -0xce0(%rbp)
jmp 0x404f
movq -0xce0(%rbp), %rdi
leaq 0xf0de(%rip), %rsi      # 0x1313b
callq 0x3230
jmp 0x4064
movl $0x1, %edi
callq 0x32a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
jmp 0x42cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
leaq -0xba9(%rbp), %rdi
callq 0x3270
jmp 0x42c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
leaq -0xbd1(%rbp), %rdi
callq 0x3270
jmp 0x42b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
jmp 0x42ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
jmp 0x4114
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
leaq -0xbf8(%rbp), %rdi
callq 0x3170
leaq -0xc18(%rbp), %rdi
callq 0x3170
jmp 0x42ab
leaq -0xc58(%rbp), %rdi
leaq -0xbd0(%rbp), %rsi
callq 0x30e0
jmp 0x413a
leaq -0xc38(%rbp), %rdi
leaq -0xc58(%rbp), %rsi
callq 0x8170
jmp 0x414f
leaq -0xb88(%rbp), %rdi
leaq -0xc38(%rbp), %rsi
movl $0x10, %edx
callq 0x3110
jmp 0x4169
leaq -0xc38(%rbp), %rdi
callq 0x3170
leaq -0xc58(%rbp), %rdi
callq 0x3170
movq -0xb88(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0xb88(%rbp,%rax), %rdi
callq 0x30f0
movb %al, -0xce1(%rbp)
jmp 0x41a1
movb -0xce1(%rbp), %al
testb $0x1, %al
jne 0x41b0
jmp 0x4248
movq 0x15e39(%rip), %rdi     # 0x19ff0
leaq 0xeeb9(%rip), %rsi      # 0x13077
callq 0x3230
movq %rax, -0xcf0(%rbp)
jmp 0x41cc
movq -0xcf0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x3230
movq %rax, -0xcf8(%rbp)
jmp 0x41e9
movq -0xcf8(%rbp), %rdi
leaq 0xef44(%rip), %rsi      # 0x1313b
callq 0x3230
jmp 0x41fe
movl $0x1, %edi
callq 0x32a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
jmp 0x423a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x420(%rbp)
movl %eax, -0x424(%rbp)
leaq -0xc38(%rbp), %rdi
callq 0x3170
leaq -0xc58(%rbp), %rdi
callq 0x3170
jmp 0x42ab
leaq -0x988(%rbp), %rdi
leaq -0xb88(%rbp), %rsi
callq 0x39c0
jmp 0x425d
leaq -0x988(%rbp), %rdi
callq 0x3060
jmp 0x426b
leaq -0xb88(%rbp), %rdi
callq 0x3330
jmp 0x4279
leaq -0xbd0(%rbp), %rdi
callq 0x3170
leaq -0xba8(%rbp), %rdi
callq 0x3170
leaq -0xb88(%rbp), %rdi
callq 0x3350
leaq -0x988(%rbp), %rdi
callq 0x3080
jmp 0x42dd
leaq -0xbd0(%rbp), %rdi
callq 0x3170
leaq -0xba8(%rbp), %rdi
callq 0x3170
leaq -0xb88(%rbp), %rdi
callq 0x3350
leaq -0x988(%rbp), %rdi
callq 0x3080
jmp 0x42ec
jmp 0x42df
jmp 0x42e1
xorl %eax, %eax
addq $0xd00, %rsp            # imm = 0xD00
popq %rbp
retq
movq -0x420(%rbp), %rdi
callq 0x3400
nopl (%rax,%rax)