// File: /workspace/github_cpp_makefile_star2_O3/whitefusion[P]Jaipur_cardgame-/main.cpp
// Function: main
int main(){
    // initialize deck and market
    Deck   d1;
    d1.shuffle();
    Market m1(d1);

    Human p1(d1,"name1");
    Human p2(d1,"name2");

    Game g1(d1, m1, p1, p2);

    // initialize player game mode
    int mode;
    char tmp[256];
    char *token;

    cout << "Game starts! Choose Modes---> 1: AI vs. AI; 2: Human vs. Human; 3: Human vs. AI: " ; 
    cin.getline(tmp,256);

    token = strtok(tmp, " \t\n\r\f");
    while (!token || atoi(token) > 3 || atoi(token) < 1){
        cout << "Invalid choice! Try again." << endl;
        cout << "Choose Modes---> 1: AI vs. AI; 2: Human vs. Human; 3: Human vs. AI: ";
        cin.getline(tmp, 256);
        token = strtok(tmp, " \t\n\r\f");
    }
    mode = atoi(token);

    switch(mode){
        case 1:
        {
            cout << " AI vs. AI " << endl;     
            break;
        }
        case 2:
        {
            cout << "Enter Name for Player 1: ";
            cin.getline(tmp, 256);
            string n1(tmp);
            cout << "Enter Name for Player 2: ";
            cin.getline(tmp, 256);
            string n2(tmp);

            p1.setName(n1);
            p2.setName(n2);
            break;
        }
        case 3:
        {
            cout << "Enter Name for Human Player: ";
            cin.getline(tmp,256);
            string n1(tmp);
            p1.setName(n1); 
            break;
        }
    }

    while (p1.getPoints(3) != 2 && p2.getPoints(3) != 2){
        g1.play_a_round();
        int winner = g1.roundWinner();
        cout << "The winner of Round " << g1.getRound() - 1 << " is: " << g1.getPlayer(winner).getName() << endl;
        cout << "Starting a NEW ROUND..." << endl;
        std::this_thread::sleep_for (std::chrono::seconds(3));
        g1.newRound(winner);
    }

    int finalwinner = g1.finalWinner();

    cout << endl;
    cout << "The FINAL winner of this game is " << g1.getPlayer(finalwinner).getName() << endl;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x378, %rsp            # imm = 0x378
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
callq 0x8048
movq %rbx, %rdi
callq 0x8bb0
leaq 0x100(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x93e6
leaq 0xf0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xc9cd(%rip), %rsi      # 0x10004
leaq 0xc9cb(%rip), %rdx      # 0x10009
leaq 0xe0(%rsp), %rdi
callq 0x3fc4
leaq 0x120(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
callq 0xc340
movq 0xe0(%rsp), %rdi
cmpq %r14, %rdi
je 0x3682
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x21a0
leaq 0xd0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xc975(%rip), %rsi      # 0x1000a
leaq 0xc973(%rip), %rdx      # 0x1000f
leaq 0xc0(%rsp), %rdi
callq 0x3fc4
leaq 0x180(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0xc340
movq 0xc0(%rsp), %rdi
cmpq %r14, %rdi
je 0x36e0
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x21a0
leaq 0x1e0(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x100(%rsp), %rdx
leaq 0x120(%rsp), %rcx
leaq 0x180(%rsp), %r8
callq 0xc8e0
movq 0x128bf(%rip), %rbx     # 0x15fd0
leaq 0xc8f8(%rip), %rsi      # 0x10010
movl $0x51, %edx
movq %rbx, %rdi
callq 0x21d0
movq 0x128b4(%rip), %rdi     # 0x15fe0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %ecx
movq 0x12899(%rip), %r14     # 0x15fe0
leaq 0x270(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
callq 0x22a0
leaq 0xc8ff(%rip), %r15      # 0x10062
leaq 0x270(%rsp), %r12
leaq 0xc8f6(%rip), %r13      # 0x10068
leaq 0xc8a4(%rip), %rbp      # 0x1001d
movq %r12, %rdi
movq %r15, %rsi
callq 0x2230
testq %rax, %rax
je 0x3799
movq %rax, %rdi
callq 0x2220
leal -0x4(%rax), %ecx
cmpl $-0x4, %ecx
ja 0x380c
movl $0x1a, %edx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x21d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movl $0x44, %edx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x21d0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %ecx
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
movq %r12, %rsi
callq 0x22a0
jmp 0x3779
cmpl $0x3, %eax
je 0x39ee
cmpl $0x2, %eax
jne 0x3ac9
movq 0x127ab(%rip), %rdi     # 0x15fd0
leaq 0xc863(%rip), %rsi      # 0x1008f
movl $0x19, %edx
callq 0x21d0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %ecx
movq 0x1278c(%rip), %r14     # 0x15fe0
leaq 0x270(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
callq 0x22a0
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x270(%rsp), %r15
movq %r15, %rdi
callq 0x20c0
leaq (%rsp,%rax), %rdx
addq $0x270, %rdx            # imm = 0x270
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x3fc4
movq 0x1272e(%rip), %rdi     # 0x15fd0
leaq 0xc800(%rip), %rsi      # 0x100a9
movl $0x19, %edx
callq 0x21d0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %ecx
movq 0x1270f(%rip), %rdi     # 0x15fe0
leaq 0x270(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x22a0
leaq 0x50(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x270(%rsp), %r14
movq %r14, %rdi
callq 0x20c0
leaq (%rsp,%rax), %rdx
addq $0x270, %rdx            # imm = 0x270
leaq 0x40(%rsp), %rdi
movq %r14, %rsi
callq 0x3fc4
leaq 0xb0(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
leaq 0xa0(%rsp), %rdi
callq 0x3f2e
leaq 0x120(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0xa5ca
movq 0xa0(%rsp), %rdi
cmpq %r14, %rdi
je 0x396c
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x21a0
leaq 0x90(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x3f2e
leaq 0x180(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0xa5ca
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0x39c4
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0x39db
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
jne 0x3aba
jmp 0x3b0f
movq 0x125db(%rip), %rdi     # 0x15fd0
leaq 0xc6c7(%rip), %rsi      # 0x100c3
movl $0x1d, %edx
callq 0x21d0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %ecx
movq 0x125bc(%rip), %rdi     # 0x15fe0
leaq 0x270(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x22a0
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x270(%rsp), %r14
movq %r14, %rdi
callq 0x20c0
leaq (%rsp,%rax), %rdx
addq $0x270, %rdx            # imm = 0x270
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x3fc4
leaq 0x70(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0x3f2e
leaq 0x120(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0xa5ca
movq 0x60(%rsp), %rdi
cmpq %r14, %rdi
je 0x3ab0
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x3b0f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21a0
jmp 0x3b0f
movq 0x12500(%rip), %r14     # 0x15fd0
leaq 0xc5ac(%rip), %rsi      # 0x10083
movl $0xb, %edx
movq %r14, %rdi
callq 0x21d0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq 0x124ce(%rip), %rdi     # 0x15fd0
callq 0x2030
movq %rax, %rdi
callq 0x20f0
leaq 0x120(%rsp), %r14
leaq 0x1e0(%rsp), %r12
leaq 0x8(%rsp), %r13
movq %r14, %rdi
movl $0x3, %esi
callq 0xa8bc
cmpl $0x2, %eax
je 0x3c89
leaq 0x180(%rsp), %rdi
movl $0x3, %esi
callq 0xa8bc
cmpl $0x2, %eax
je 0x3c89
movq %r12, %rdi
callq 0xca96
movq %r12, %rdi
callq 0xd6ca
movl %eax, %ebp
movl $0x14, %edx
movq %rbx, %rdi
leaq 0xc56b(%rip), %rsi      # 0x100e1
callq 0x21d0
movl 0x260(%rsp), %esi
decl %esi
movq %rbx, %rdi
callq 0x2270
movq %rax, %r15
movl $0x5, %edx
movq %rax, %rdi
leaq 0xc558(%rip), %rsi      # 0x100f6
callq 0x21d0
xorl %eax, %eax
cmpl $0x1, %ebp
setne %al
movq 0x1f0(%rsp,%rax,8), %rsi
movq %r13, %rdi
callq 0xa5d4
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r15, %rdi
callq 0x21d0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3c13
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21a0
movl $0x17, %edx
movq %rbx, %rdi
leaq 0xc4da(%rip), %rsi      # 0x100fc
callq 0x21d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movq $0x3, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movq %r13, %rdi
movq %r13, %rsi
callq 0x2090
cmpl $-0x1, %eax
jne 0x3c7a
callq 0x2050
cmpl $0x4, (%rax)
je 0x3c60
movq %r12, %rdi
movl %ebp, %esi
callq 0xc9d8
jmp 0x3b24
leaq 0x1e0(%rsp), %rdi
callq 0xec72
movl %eax, %ebp
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq 0x1231a(%rip), %rdi     # 0x15fd0
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movq 0x12306(%rip), %rdi     # 0x15fd0
leaq 0xc443(%rip), %rsi      # 0x10114
movl $0x21, %edx
callq 0x21d0
xorl %eax, %eax
cmpl $0x1, %ebp
setne %al
movq 0x1f0(%rsp,%rax,8), %rsi
leaq 0x8(%rsp), %rdi
callq 0xa5d4
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x122ca(%rip), %rdi     # 0x15fd0
callq 0x21d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3d51
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21a0
leaq 0x1e0(%rsp), %rdi
callq 0xc976
leaq 0x180(%rsp), %rdi
callq 0xc3d0
leaq 0x120(%rsp), %rdi
callq 0xc3d0
leaq 0x100(%rsp), %rdi
callq 0x966c
leaq 0x28(%rsp), %rdi
callq 0x8aaa
xorl %eax, %eax
addq $0x378, %rsp            # imm = 0x378
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x80(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e20
movq 0x90(%rsp), %rsi
jmp 0x3dd5
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e20
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x21a0
jmp 0x3e20
jmp 0x3e3e
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r14, %rdi
je 0x3e00
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x21a0
jmp 0x3e00
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
jne 0x3ed1
jmp 0x3ee7
jmp 0x3ee4
jmp 0x3ee4
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r15, %rdi
je 0x3e41
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x21a0
jmp 0x3e41
jmp 0x3ee4
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
jne 0x3ed1
jmp 0x3ee7
movq %rax, %rbx
jmp 0x3ef4
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
cmpq %r14, %rdi
je 0x3f01
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x21a0
jmp 0x3f01
movq %rax, %rbx
jmp 0x3f01
movq %rax, %rbx
movq 0xe0(%rsp), %rdi
cmpq %r14, %rdi
je 0x3f0e
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x21a0
jmp 0x3f0e
movq %rax, %rbx
jmp 0x3f0e
jmp 0x3eb0
movq %rax, %rbx
jmp 0x3f1b
jmp 0x3ebf
jmp 0x3ee4
jmp 0x3ee4
jmp 0x3ee4
jmp 0x3ee4
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x3ee7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21a0
jmp 0x3ee7
jmp 0x3ee4
jmp 0x3ee4
movq %rax, %rbx
leaq 0x1e0(%rsp), %rdi
callq 0xc976
leaq 0x180(%rsp), %rdi
callq 0xc3d0
leaq 0x120(%rsp), %rdi
callq 0xc3d0
leaq 0x100(%rsp), %rdi
callq 0x966c
leaq 0x28(%rsp), %rdi
callq 0x8aaa
movq %rbx, %rdi
callq 0x2280
nop