// File: chrischute[P]are-you-the-one/src/ayto.cpp
// Function: main
int main(int argc, char** argv) {
    AytoSettings* settings = new AytoSettings();

    if (settings->initializeFromArgs(argc, argv)) {
        if (settings->_isAllPermutationsMode) {
            cout << "Running on all possible answers." << endl;
            PerfectMatching answer = DIGITS;
            do {
                runAreYouTheOne(answer, settings);
            } while (next_permutation(answer.begin(), answer.end()));
        } else if (settings->_isReadFromFileMode) {
            cout << "Reading answers from " << settings->_fileToRead << "." << endl;
            PmSet *answers = new PmSet();
            answers->populateFromFile(settings->_fileToRead);
            for (PmSet::const_iterator answer = answers->begin();
                 answer != answers->end();
                 ++answer) {
                runAreYouTheOne(*answer, settings);
            }
            delete answers;
        } else if (settings->_isInteractiveMode) {
            cout << "Interactive mode. I think I'm going to win." << endl;
            runAreYouTheOne("", settings);
        } else {
            cout << "Running on a random answer." << endl;
            std::srand(unsigned(std::time(nullptr)));
            Pm answer = getRandomPerfectMatching();
            runAreYouTheOne(answer, settings);
        }
    } else {
        cout << "usage: ./ayto" << endl;
        cout << "\t[-a | -all]     * Run on all permutations" << endl;
        cout << "\t[-f <filename>] * Run on permutations in file" << endl;
        cout << "\t[-i]            * Interactive, user gives feedback" << endl;
        cout << "\t[-v]            * Verbose mode, more printing" << endl;
    }

    delete settings;

    return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x38, %edi
callq 0x32f0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xf0(%rbp)
callq 0x6df0
jmp 0x36a7
movq -0xf0(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
callq 0x3bc0
testb $0x1, %al
jne 0x36cb
jmp 0x3ad2
movq -0x18(%rbp), %rax
testb $0x1, 0x20(%rax)
je 0x37e7
movq 0x1a8e8(%rip), %rdi     # 0x1dfc8
leaq 0x1091d(%rip), %rsi     # 0x14004
callq 0x32e0
movq %rax, %rdi
movq 0x1a8ba(%rip), %rsi     # 0x1dfb0
callq 0x3320
leaq -0x49(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x34e0
movq -0xf8(%rbp), %rdx
leaq 0x1090c(%rip), %rsi     # 0x14025
leaq -0x48(%rbp), %rdi
callq 0x6e80
jmp 0x3724
leaq -0x49(%rbp), %rdi
callq 0x3340
movq -0x18(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x4460
jmp 0x373c
jmp 0x373e
leaq -0x48(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x3260
movq -0x108(%rbp), %rdi
movq %rax, -0x58(%rbp)
callq 0x3160
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x6f30
movb %al, -0xf9(%rbp)
jmp 0x3777
movb -0xf9(%rbp), %al
testb $0x1, %al
jne 0x372d
jmp 0x3783
leaq -0x48(%rbp), %rdi
callq 0x3190
jmp 0x3acd
movq -0xf0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x38, %esi
callq 0x3300
jmp 0x3bb5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x49(%rbp), %rdi
callq 0x3340
jmp 0x3bb5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x3190
jmp 0x3bb5
movq -0x18(%rbp), %rax
testb $0x1, 0x23(%rax)
je 0x3982
movq 0x1a7cc(%rip), %rdi     # 0x1dfc8
leaq 0x1082d(%rip), %rsi     # 0x14030
callq 0x32e0
movq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0x3280
movq %rax, %rdi
leaq 0x10a1a(%rip), %rsi     # 0x14238
callq 0x32e0
movq %rax, %rdi
movq 0x1a783(%rip), %rsi     # 0x1dfb0
callq 0x3320
movl $0x8, %edi
callq 0x32f0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x110(%rbp)
callq 0x10100
jmp 0x3850
movq -0x110(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x88(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x30f0
movq -0x120(%rbp), %rdi
movq -0x118(%rbp), %rsi
callq 0x10680
jmp 0x3892
leaq -0x88(%rbp), %rdi
callq 0x3190
movq -0x68(%rbp), %rdi
callq 0x10280
movq %rax, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x6f70
movq -0x68(%rbp), %rdi
callq 0x10320
movq %rax, -0xa0(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x6fb0
testb $0x1, %al
jne 0x38ea
jmp 0x394f
leaq -0x90(%rbp), %rdi
callq 0x6ff0
movq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0x4460
leaq -0x90(%rbp), %rdi
callq 0x7010
jmp 0x38c1
movq -0x110(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x8, %esi
callq 0x3300
jmp 0x3bb5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x3190
jmp 0x3bb5
movq -0x68(%rbp), %rax
movq %rax, -0x128(%rbp)
cmpq $0x0, %rax
je 0x397d
movq -0x128(%rbp), %rdi
callq 0x10210
movq -0x128(%rbp), %rdi
movl $0x8, %esi
callq 0x3300
jmp 0x3acb
movq -0x18(%rbp), %rax
testb $0x1, 0x21(%rax)
je 0x3a47
movq 0x1a631(%rip), %rdi     # 0x1dfc8
leaq 0x106a8(%rip), %rsi     # 0x14046
callq 0x32e0
movq %rax, %rdi
movq 0x1a603(%rip), %rsi     # 0x1dfb0
callq 0x3320
leaq -0xc1(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x34e0
movq -0x130(%rbp), %rdx
leaq 0x1086b(%rip), %rsi     # 0x1423e
leaq -0xc0(%rbp), %rdi
callq 0x6e80
jmp 0x39e1
movq -0x18(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
callq 0x4460
jmp 0x39f3
leaq -0xc0(%rbp), %rdi
callq 0x3190
leaq -0xc1(%rbp), %rdi
callq 0x3340
jmp 0x3ac9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x3a36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x3190
leaq -0xc1(%rbp), %rdi
callq 0x3340
jmp 0x3bb5
movq 0x1a57a(%rip), %rdi     # 0x1dfc8
leaq 0x1061d(%rip), %rsi     # 0x14072
callq 0x32e0
movq %rax, %rdi
movq 0x1a54c(%rip), %rsi     # 0x1dfb0
callq 0x3320
xorl %eax, %eax
movl %eax, %edi
callq 0x32a0
movl %eax, %edi
callq 0x32c0
leaq -0xe8(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x5600
movq -0x138(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x4460
jmp 0x3a9e
leaq -0xe8(%rbp), %rdi
callq 0x3190
jmp 0x3ac9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x3190
jmp 0x3bb5
jmp 0x3acb
jmp 0x3acd
jmp 0x3b7c
movq 0x1a4ef(%rip), %rdi     # 0x1dfc8
leaq 0x105ae(%rip), %rsi     # 0x1408e
callq 0x32e0
movq %rax, %rdi
movq 0x1a4c1(%rip), %rsi     # 0x1dfb0
callq 0x3320
movq 0x1a4cd(%rip), %rdi     # 0x1dfc8
leaq 0x1059a(%rip), %rsi     # 0x1409c
callq 0x32e0
movq %rax, %rdi
movq 0x1a49f(%rip), %rsi     # 0x1dfb0
callq 0x3320
movq 0x1a4ab(%rip), %rdi     # 0x1dfc8
leaq 0x105a3(%rip), %rsi     # 0x140c7
callq 0x32e0
movq %rax, %rdi
movq 0x1a47d(%rip), %rsi     # 0x1dfb0
callq 0x3320
movq 0x1a489(%rip), %rdi     # 0x1dfc8
leaq 0x105b0(%rip), %rsi     # 0x140f6
callq 0x32e0
movq %rax, %rdi
movq 0x1a45b(%rip), %rsi     # 0x1dfb0
callq 0x3320
movq 0x1a467(%rip), %rdi     # 0x1dfc8
leaq 0x105c2(%rip), %rsi     # 0x1412a
callq 0x32e0
movq %rax, %rdi
movq 0x1a439(%rip), %rsi     # 0x1dfb0
callq 0x3320
movq -0x18(%rbp), %rax
movq %rax, -0x140(%rbp)
cmpq $0x0, %rax
je 0x3baa
movq -0x140(%rbp), %rdi
callq 0x7030
movq -0x140(%rbp), %rdi
movl $0x38, %esi
callq 0x3300
xorl %eax, %eax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0x34d0
nop