// File: /workspace/github_cpp_makefile_star2_O3/m-wiesner[P]Jotto/Jotto.cpp
// Function: main
int main(int argc, char** argv)
{
    string path_to_dict = "./text_files/wordlist.txt";
    char read_rules;
    char play_to_end;
    int level;
    cout << "========================================";
    cout << "========================================" << endl;
    cout << "                                !!  JOTTO  !!";
    cout << "                                " << endl;
    cout << "========================================";
    cout << "========================================" << endl;

    cout << "Do you want to read the rules? (y)/(n)";
    do
    {   if (!(cin >> read_rules))
        {
            exit (0);
        }
    } while ((read_rules != 'y' && read_rules != 'n') && (cout << "Enter (y) or (n)."));
    
    if (read_rules == 'y')
    {
        print_intro();      
    }



    cout << endl << endl << endl;
    cout << "========================================";
    cout << "========================================" << endl;
    cout << "                                !! START GAME !!";
    cout << "                                " << endl;
    

    print_level();
    do
    {
        if(!(cin >> level))
        {
            exit(0);
        }
        cout << "LEVEL: " << level << endl;
    } while (((level != 1) && (level != 2) && (level !=3)) && (cout << "Enter a level (1-3)"));
    


    // Default names
    string name1 = "AI1";
    string name2 = "AI2";

    srand((int)time(0));
    Guesser *g1;
    Guesser *g2;
  
    g1 = new ManualGuesser(name1, path_to_dict); 
    //switch (level)
    //{
    //    case 0: cout << "Enter your name: ";
    //            cin >> name1;
    //            g1 = new ManualGuesser(name1, path_to_dict);
    //            break;
    //    case 1: g1 = new Guesser(name1, path_to_dict); break;
    //    case 2: g1 = new RandomGuesser(name1, path_to_dict); break;
    //    case 3: g1 = new MaxinfoGuesser(name1, path_to_dict); break;
    //}

    switch (level)
    {
        case 0: cout << "Enter your name: ";
                cin >> name1;
                g2 = new ManualGuesser(name1, path_to_dict);
                break;
        case 1: g2 = new Guesser(name2, path_to_dict); break;
        case 2: g2 = new RandomGuesser(name2, path_to_dict); break;
        case 3: g2 = new MaxinfoGuesser(name2, path_to_dict); break;
    }

    ScoreKeeper sk(g1, g2);
  
    clear_screen(3); 
   
    int turnnumber = 1; 
    cout << " ========= Turn " << turnnumber << " ============== " << endl;
    while (sk.give_turn_to(g1) && sk.give_turn_to(g2))
    {
        clear_screen(3);
        cout << " ========= Turn " << turnnumber << " ============== " << endl;
        g1->update();
        g2->update();
        ++turnnumber;
    }

    cout << "Do you want to keep guessing? (y)/(n)";
    do
    {   if(!(cin >> play_to_end))
        {
            cout << "Codeword were ..." << endl;
            sk.print_codewords();
            exit(0);
        }
    } while ((play_to_end != 'y' && play_to_end != 'n') && (cout << "Enter (y) or (n)."));
    
    if (play_to_end == 'y')
    {
        while(sk.give_turn_to(g1))
        {
            clear_screen(3);
            cout << " ========= Turn " << turnnumber << " ============== " << endl;
            g1->update();
            ++turnnumber;
        }
    } 
    else
    {
        cout << "Codewords were ..." << endl;
        sk.print_codewords();
    } 
    delete g1;
    delete g2;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
leaq -0x50(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x3a05(%rip), %rsi      # 0x6014
leaq 0x3a17(%rip), %rdx      # 0x602d
leaq -0x60(%rbp), %rdi
callq 0x36ac
movq 0x69aa(%rip), %rdi      # 0x8fd0
leaq 0x3a01(%rip), %rsi      # 0x602e
movl $0x28, %edx
callq 0x2260
movq 0x6992(%rip), %rbx      # 0x8fd0
leaq 0x39e9(%rip), %rsi      # 0x602e
movl $0x28, %edx
movq %rbx, %rdi
callq 0x2260
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq 0x6960(%rip), %rdi      # 0x8fd0
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x694c(%rip), %rdi      # 0x8fd0
leaq 0x39cc(%rip), %rsi      # 0x6057
movl $0x2d, %edx
callq 0x2260
movq 0x6934(%rip), %rbx      # 0x8fd0
leaq 0x39e2(%rip), %rsi      # 0x6085
movl $0x20, %edx
movq %rbx, %rdi
callq 0x2260
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq 0x6902(%rip), %rdi      # 0x8fd0
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x68ee(%rip), %rdi      # 0x8fd0
leaq 0x3945(%rip), %rsi      # 0x602e
movl $0x28, %edx
callq 0x2260
movq 0x68d6(%rip), %rbx      # 0x8fd0
leaq 0x392d(%rip), %rsi      # 0x602e
movl $0x28, %edx
movq %rbx, %rdi
callq 0x2260
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq 0x68a4(%rip), %rdi      # 0x8fd0
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x6890(%rip), %rbx      # 0x8fd0
leaq 0x395f(%rip), %rsi      # 0x60a6
movl $0x26, %edx
movq %rbx, %rdi
callq 0x2260
movq 0x6885(%rip), %r14      # 0x8fe0
leaq -0x2a(%rbp), %r15
leaq 0x3967(%rip), %r12      # 0x60cd
movq %r14, %rdi
movq %r15, %rsi
callq 0x22b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2ec9
movzbl -0x2a(%rbp), %eax
cmpl $0x6e, %eax
je 0x27b2
cmpl $0x79, %eax
je 0x27b2
movl $0x11, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2260
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rbx,%rax)
je 0x2766
movb -0x2a(%rbp), %al
cmpb $0x79, %al
jne 0x27bb
callq 0x2f80
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq 0x67f7(%rip), %rdi      # 0x8fd0
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x678f(%rip), %rdi      # 0x8fd0
leaq 0x37e6(%rip), %rsi      # 0x602e
movl $0x28, %edx
callq 0x2260
movq 0x6777(%rip), %rbx      # 0x8fd0
leaq 0x37ce(%rip), %rsi      # 0x602e
movl $0x28, %edx
movq %rbx, %rdi
callq 0x2260
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq 0x6745(%rip), %rdi      # 0x8fd0
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq 0x6731(%rip), %rdi      # 0x8fd0
leaq 0x3839(%rip), %rsi      # 0x60df
movl $0x30, %edx
callq 0x2260
movq 0x6719(%rip), %rbx      # 0x8fd0
leaq 0x37c7(%rip), %rsi      # 0x6085
movl $0x20, %edx
movq %rbx, %rdi
callq 0x2260
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq 0x66e7(%rip), %rbx      # 0x8fd0
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
callq 0x3242
leaq -0x3c(%rbp), %r15
leaq 0x3807(%rip), %r12      # 0x6110
leaq 0x3808(%rip), %r13      # 0x6118
movq 0x66c9(%rip), %rdi      # 0x8fe0
movq %r15, %rsi
callq 0x2110
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2ec9
movl $0x7, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2260
movl -0x3c(%rbp), %esi
movq %rbx, %rdi
callq 0x2310
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movl -0x3c(%rbp), %eax
addl $-0x4, %eax
cmpl $-0x4, %eax
ja 0x29a3
movl $0x13, %edx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2260
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rbx,%rax)
je 0x2910
leaq -0x70(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x377a(%rip), %rsi      # 0x612c
leaq 0x3776(%rip), %rdx      # 0x612f
leaq -0x80(%rbp), %rdi
callq 0x36ac
leaq -0x98(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x375c(%rip), %rsi      # 0x6130
leaq 0x3758(%rip), %rdx      # 0x6133
leaq -0xa8(%rbp), %rdi
callq 0x36ac
xorl %edi, %edi
callq 0x21d0
movl %eax, %edi
callq 0x21e0
movl $0x58, %edi
callq 0x2210
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rbx
leaq -0x80(%rbp), %rsi
leaq -0x60(%rbp), %rdx
movq %rbx, %rdi
callq 0x49d8
movl -0x3c(%rbp), %eax
cmpq $0x3, %rax
ja 0x2aeb
leaq 0x35d3(%rip), %rcx      # 0x6004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x658f(%rip), %rdi      # 0x8fd0
leaq 0x36ec(%rip), %rsi      # 0x6134
movl $0x11, %edx
callq 0x2260
movq 0x6587(%rip), %rdi      # 0x8fe0
leaq -0x80(%rbp), %rsi
callq 0x22a0
movl $0x58, %edi
callq 0x2210
leaq -0x80(%rbp), %rsi
leaq -0x60(%rbp), %rdx
movq %rax, -0x38(%rbp)
movq %rax, %rdi
callq 0x49d8
jmp 0x2aeb
movl $0x58, %edi
callq 0x2210
leaq -0xa8(%rbp), %rsi
leaq -0x60(%rbp), %rdx
movq %rax, -0x38(%rbp)
movq %rax, %rdi
callq 0x4c18
jmp 0x2aeb
movl $0x58, %edi
callq 0x2210
leaq -0xa8(%rbp), %rsi
leaq -0x60(%rbp), %rdx
movq %rax, -0x38(%rbp)
movq %rax, %rdi
callq 0x4ecc
jmp 0x2aeb
movl $0x58, %edi
callq 0x2210
leaq -0xa8(%rbp), %rsi
leaq -0x60(%rbp), %rdx
movq %rax, -0x38(%rbp)
movq %rax, %rdi
callq 0x40a4
jmp 0x2aeb
leaq -0xd8(%rbp), %rdi
movq %rbx, %rsi
movq -0x38(%rbp), %rdx
callq 0x5188
movl $0x3, %edi
callq 0x3431
movq 0x64c1(%rip), %rdi      # 0x8fd0
leaq 0x3630(%rip), %rsi      # 0x6146
movl $0x10, %edx
callq 0x2260
movq 0x64a9(%rip), %rdi      # 0x8fd0
movl $0x1, %esi
callq 0x2310
movq %rax, %r14
leaq 0x361c(%rip), %rsi      # 0x6157
movl $0x10, %edx
movq %rax, %rdi
callq 0x2260
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movl $0x1, %r12d
leaq -0xd8(%rbp), %r13
movq 0x644d(%rip), %r14      # 0x8fd0
movq %r13, %rdi
movq %rbx, %rsi
callq 0x5322
testb %al, %al
je 0x2c2c
movq %r13, %rdi
movq -0x38(%rbp), %rsi
callq 0x5322
testb %al, %al
je 0x2c2c
movl $0x3, %edi
callq 0x3431
movl $0x10, %edx
movq %r14, %rdi
leaq 0x3583(%rip), %rsi      # 0x6146
callq 0x2260
movq %r14, %rdi
movl %r12d, %esi
callq 0x2310
movq %rax, %r15
movl $0x10, %edx
movq %rax, %rdi
leaq 0x3572(%rip), %rsi      # 0x6157
callq 0x2260
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq -0x38(%rbp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
incl %r12d
jmp 0x2b83
movq 0x639d(%rip), %r14      # 0x8fd0
leaq 0x352e(%rip), %rsi      # 0x6168
movl $0x25, %edx
movq %r14, %rdi
callq 0x2260
movq 0x6392(%rip), %r13      # 0x8fe0
leaq -0x29(%rbp), %r15
movq %r13, %rdi
movq %r15, %rsi
callq 0x22b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2e99
movzbl -0x29(%rbp), %eax
cmpl $0x6e, %eax
je 0x2ca3
cmpl $0x79, %eax
je 0x2ca3
movl $0x11, %edx
movq %r14, %rdi
leaq 0x3441(%rip), %rsi      # 0x60cd
callq 0x2260
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%r14,%rax)
je 0x2c52
movb -0x29(%rbp), %al
cmpb $0x79, %al
jne 0x2d44
movq 0x631e(%rip), %r13      # 0x8fd0
leaq 0x349e(%rip), %r14      # 0x6157
leaq -0xd8(%rbp), %rdi
movq %rbx, %rsi
callq 0x5322
testb %al, %al
je 0x2d96
movl $0x3, %edi
callq 0x3431
movl $0x10, %edx
movq %r13, %rdi
leaq 0x345d(%rip), %rsi      # 0x6146
callq 0x2260
movq %r13, %rdi
movl %r12d, %esi
callq 0x2310
movq %rax, %r15
movl $0x10, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2260
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2150
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
incl %r12d
jmp 0x2cb9
movq 0x6285(%rip), %r14      # 0x8fd0
leaq 0x344e(%rip), %rsi      # 0x61a0
movl $0x12, %edx
movq %r14, %rdi
callq 0x2260
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq 0x6253(%rip), %rdi      # 0x8fd0
callq 0x2030
movq %rax, %rdi
callq 0x2150
leaq -0xd8(%rbp), %rdi
callq 0x5718
leaq 0x5f1b(%rip), %r14      # 0x8cb8
addq $0x10, %r14
movq %r14, (%rbx)
movq -0x88(%rbp), %r15
leaq 0x40(%r15), %rdi
callq 0x359e
leaq 0x28(%r15), %rdi
callq 0x3530
movq 0x8(%rbx), %rdi
addq $0x18, %r15
cmpq %r15, %rdi
je 0x2dd5
movq (%r15), %rsi
incq %rsi
callq 0x2220
movl $0x58, %esi
movq %rbx, %rdi
callq 0x2220
movq -0x38(%rbp), %rbx
testq %rbx, %rbx
je 0x2e18
movq %r14, (%rbx)
leaq 0x40(%rbx), %rdi
callq 0x359e
leaq 0x28(%rbx), %rdi
callq 0x3530
movq 0x8(%rbx), %rdi
leaq 0x18(%rbx), %rax
cmpq %rax, %rdi
je 0x2e18
movq (%rax), %rsi
incq %rsi
callq 0x2220
movl $0x58, %esi
movq %rbx, %rdi
callq 0x2220
leaq -0xd8(%rbp), %rdi
callq 0x35fc
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x2e53
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2220
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x2e6c
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x2220
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x2e85
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x2220
xorl %eax, %eax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x6130(%rip), %rdi      # 0x8fd0
leaq 0x32e7(%rip), %rsi      # 0x618e
movl $0x11, %edx
callq 0x2260
movq 0x6118(%rip), %rdi      # 0x8fd0
callq 0x20e0
leaq -0xd8(%rbp), %rdi
callq 0x5718
xorl %edi, %edi
callq 0x2280
jmp 0x2ed6
jmp 0x2ed6
jmp 0x2ed6
movq %rax, %r14
movl $0x58, %esi
movq -0x38(%rbp), %rdi
jmp 0x2ef3
jmp 0x2f15
jmp 0x2f01
movq %rax, %r14
movl $0x58, %esi
movq %rbx, %rdi
callq 0x2220
jmp 0x2f24
movq %rax, %r14
jmp 0x2f46
jmp 0x2f0e
movq %rax, %r14
jmp 0x2f24
jmp 0x2f15
jmp 0x2f15
jmp 0x2f0e
jmp 0x2f0e
movq %rax, %r14
jmp 0x2f5f
jmp 0x2f15
movq %rax, %r14
leaq -0xd8(%rbp), %rdi
callq 0x35fc
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x2f46
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2220
leaq -0x70(%rbp), %rax
movq -0x80(%rbp), %rdi
cmpq %rax, %rdi
je 0x2f5f
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x2220
leaq -0x50(%rbp), %rax
movq -0x60(%rbp), %rdi
cmpq %rax, %rdi
je 0x2f78
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x2220
movq %r14, %rdi
callq 0x2320