// File: 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
movq %rsp, %rbp
subq $0x4f0, %rsp            # imm = 0x4F0
movl $0x0, -0x4(%rbp)
leaq -0x20(%rbp), %rdi
movq %rdi, -0x440(%rbp)
callq 0x107c0
movq -0x440(%rbp), %rdi
callq 0x11520
jmp 0x4320
leaq -0x50(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x12f00
jmp 0x432f
leaq -0xd1(%rbp), %rdi
movq %rdi, -0x448(%rbp)
callq 0x2370
movq -0x448(%rbp), %rdx
leaq 0x19cb4(%rip), %rsi     # 0x1e004
leaq -0xd0(%rbp), %rdi
callq 0x4cb0
jmp 0x435e
leaq -0xb0(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0xd0(%rbp), %rdx
callq 0x18a90
jmp 0x4377
leaq -0xd0(%rbp), %rdi
callq 0x2130
leaq -0xd1(%rbp), %rdi
callq 0x2260
leaq -0x159(%rbp), %rdi
movq %rdi, -0x450(%rbp)
callq 0x2370
movq -0x450(%rbp), %rdx
leaq 0x19c5a(%rip), %rsi     # 0x1e00a
leaq -0x158(%rbp), %rdi
callq 0x4cb0
jmp 0x43be
leaq -0x138(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x158(%rbp), %rdx
callq 0x18a90
jmp 0x43d7
leaq -0x158(%rbp), %rdi
callq 0x2130
leaq -0x159(%rbp), %rdi
callq 0x2260
leaq -0x1f0(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x50(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
leaq -0x138(%rbp), %r8
callq 0x19160
jmp 0x4413
movq 0x26bb6(%rip), %rdi     # 0x2afd0
leaq 0x19bef(%rip), %rsi     # 0x1e010
callq 0x2200
jmp 0x4428
movq 0x26bb1(%rip), %rdi     # 0x2afe0
leaq -0x300(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x20a0
jmp 0x4442
leaq -0x300(%rbp), %rdi
leaq 0x19c12(%rip), %rsi     # 0x1e062
callq 0x2310
movq %rax, -0x308(%rbp)
movb $0x1, %al
cmpq $0x0, -0x308(%rbp)
movb %al, -0x451(%rbp)
je 0x44a1
movq -0x308(%rbp), %rdi
callq 0x2300
movl %eax, %ecx
movb $0x1, %al
cmpl $0x3, %ecx
movb %al, -0x451(%rbp)
jg 0x44a1
movq -0x308(%rbp), %rdi
callq 0x2300
cmpl $0x1, %eax
setl %al
movb %al, -0x451(%rbp)
movb -0x451(%rbp), %al
testb $0x1, %al
jne 0x44b0
jmp 0x45d0
movq 0x26b19(%rip), %rdi     # 0x2afd0
leaq 0x19baa(%rip), %rsi     # 0x1e068
callq 0x2200
movq %rax, -0x460(%rbp)
jmp 0x44cc
movq -0x460(%rbp), %rdi
movq 0x26ae6(%rip), %rsi     # 0x2afc0
callq 0x2240
jmp 0x44e1
movq 0x26ae8(%rip), %rdi     # 0x2afd0
leaq 0x19b2e(%rip), %rsi     # 0x1e01d
callq 0x2200
jmp 0x44f6
movq 0x26ae3(%rip), %rdi     # 0x2afe0
leaq -0x300(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x20a0
jmp 0x4510
leaq -0x300(%rbp), %rdi
leaq 0x19b44(%rip), %rsi     # 0x1e062
callq 0x2310
movq %rax, -0x308(%rbp)
jmp 0x445c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x4c99
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x4566
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x2130
leaq -0xd1(%rbp), %rdi
callq 0x2260
jmp 0x4c90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x459d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x2130
leaq -0x159(%rbp), %rdi
callq 0x2260
jmp 0x4c84
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x4c78
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x4c6c
movq -0x308(%rbp), %rdi
callq 0x2300
movl %eax, -0x1f4(%rbp)
movl -0x1f4(%rbp), %eax
movl %eax, -0x464(%rbp)
subl $0x1, %eax
je 0x4616
jmp 0x45f5
movl -0x464(%rbp), %eax
subl $0x2, %eax
je 0x464c
jmp 0x4602
movl -0x464(%rbp), %eax
subl $0x3, %eax
je 0x484b
jmp 0x494d
movq 0x269b3(%rip), %rdi     # 0x2afd0
leaq 0x19a5f(%rip), %rsi     # 0x1e083
callq 0x2200
movq %rax, -0x470(%rbp)
jmp 0x4632
movq -0x470(%rbp), %rdi
movq 0x26980(%rip), %rsi     # 0x2afc0
callq 0x2240
jmp 0x4647
jmp 0x494d
movq 0x2697d(%rip), %rdi     # 0x2afd0
leaq 0x19a35(%rip), %rsi     # 0x1e08f
callq 0x2200
jmp 0x4661
movq 0x26978(%rip), %rdi     # 0x2afe0
leaq -0x300(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x20a0
jmp 0x467b
leaq -0x329(%rbp), %rdi
movq %rdi, -0x478(%rbp)
callq 0x2370
movq -0x478(%rbp), %rdx
leaq -0x328(%rbp), %rdi
leaq -0x300(%rbp), %rsi
callq 0x4cb0
jmp 0x46aa
leaq -0x329(%rbp), %rdi
callq 0x2260
movq 0x26913(%rip), %rdi     # 0x2afd0
leaq 0x199e5(%rip), %rsi     # 0x1e0a9
callq 0x2200
jmp 0x46cb
movq 0x2690e(%rip), %rdi     # 0x2afe0
leaq -0x300(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x20a0
jmp 0x46e5
leaq -0x351(%rbp), %rdi
movq %rdi, -0x480(%rbp)
callq 0x2370
movq -0x480(%rbp), %rdx
leaq -0x350(%rbp), %rdi
leaq -0x300(%rbp), %rsi
callq 0x4cb0
jmp 0x4714
leaq -0x351(%rbp), %rdi
callq 0x2260
leaq -0x378(%rbp), %rdi
leaq -0x328(%rbp), %rsi
callq 0x20e0
jmp 0x4735
leaq -0xb0(%rbp), %rdi
leaq -0x378(%rbp), %rsi
callq 0x146d0
jmp 0x474a
leaq -0x378(%rbp), %rdi
callq 0x2130
leaq -0x398(%rbp), %rdi
leaq -0x350(%rbp), %rsi
callq 0x20e0
jmp 0x476b
leaq -0x138(%rbp), %rdi
leaq -0x398(%rbp), %rsi
callq 0x146d0
jmp 0x4780
leaq -0x398(%rbp), %rdi
callq 0x2130
leaq -0x350(%rbp), %rdi
callq 0x2130
leaq -0x328(%rbp), %rdi
callq 0x2130
jmp 0x494d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x329(%rbp), %rdi
callq 0x2260
jmp 0x4c6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x483a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x351(%rbp), %rdi
callq 0x2260
jmp 0x483a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x482e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x378(%rbp), %rdi
callq 0x2130
jmp 0x482e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x398(%rbp), %rdi
callq 0x2130
leaq -0x350(%rbp), %rdi
callq 0x2130
leaq -0x328(%rbp), %rdi
callq 0x2130
jmp 0x4c6c
movq 0x2677e(%rip), %rdi     # 0x2afd0
leaq 0x1986a(%rip), %rsi     # 0x1e0c3
callq 0x2200
jmp 0x4860
movq 0x26779(%rip), %rdi     # 0x2afe0
leaq -0x300(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x20a0
jmp 0x487a
leaq -0x3b9(%rbp), %rdi
movq %rdi, -0x488(%rbp)
callq 0x2370
movq -0x488(%rbp), %rdx
leaq -0x3b8(%rbp), %rdi
leaq -0x300(%rbp), %rsi
callq 0x4cb0
jmp 0x48a9
leaq -0x3b9(%rbp), %rdi
callq 0x2260
leaq -0x3e0(%rbp), %rdi
leaq -0x3b8(%rbp), %rsi
callq 0x20e0
jmp 0x48ca
leaq -0xb0(%rbp), %rdi
leaq -0x3e0(%rbp), %rsi
callq 0x146d0
jmp 0x48df
leaq -0x3e0(%rbp), %rdi
callq 0x2130
leaq -0x3b8(%rbp), %rdi
callq 0x2130
jmp 0x494d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x3b9(%rbp), %rdi
callq 0x2260
jmp 0x4c6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x493c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x3e0(%rbp), %rdi
callq 0x2130
leaq -0x3b8(%rbp), %rdi
callq 0x2130
jmp 0x4c6c
jmp 0x494f
leaq -0xb0(%rbp), %rdi
movl $0x3, %esi
callq 0x149f0
movl %eax, -0x48c(%rbp)
jmp 0x4968
movl -0x48c(%rbp), %ecx
xorl %eax, %eax
cmpl $0x2, %ecx
movb %al, -0x48d(%rbp)
je 0x49a6
leaq -0x138(%rbp), %rdi
movl $0x3, %esi
callq 0x149f0
movl %eax, -0x494(%rbp)
jmp 0x4994
movl -0x494(%rbp), %eax
cmpl $0x2, %eax
setne %al
movb %al, -0x48d(%rbp)
movb -0x48d(%rbp), %al
testb $0x1, %al
jne 0x49b5
jmp 0x4b4d
leaq -0x1f0(%rbp), %rdi
callq 0x19470
jmp 0x49c3
leaq -0x1f0(%rbp), %rdi
callq 0x1a490
movl %eax, -0x498(%rbp)
jmp 0x49d7
movl -0x498(%rbp), %eax
movl %eax, -0x3e4(%rbp)
movq 0x265e6(%rip), %rdi     # 0x2afd0
leaq 0x196f0(%rip), %rsi     # 0x1e0e1
callq 0x2200
movq %rax, -0x4a0(%rbp)
jmp 0x49ff
leaq -0x1f0(%rbp), %rdi
callq 0x4d60
movl %eax, -0x4a4(%rbp)
jmp 0x4a13
movq -0x4a0(%rbp), %rdi
movl -0x4a4(%rbp), %esi
decl %esi
callq 0x2350
movq %rax, -0x4b0(%rbp)
jmp 0x4a30
movq -0x4b0(%rbp), %rdi
leaq 0x196b8(%rip), %rsi     # 0x1e0f6
callq 0x2200
movq %rax, -0x4b8(%rbp)
jmp 0x4a4c
movl -0x3e4(%rbp), %esi
leaq -0x1f0(%rbp), %rdi
callq 0x4d80
movq %rax, -0x4c0(%rbp)
jmp 0x4a67
movq -0x4c0(%rbp), %rsi
leaq -0x408(%rbp), %rdi
callq 0x14700
jmp 0x4a7c
movq -0x4b8(%rbp), %rdi
leaq -0x408(%rbp), %rsi
callq 0x21d0
movq %rax, -0x4c8(%rbp)
jmp 0x4a98
movq -0x4c8(%rbp), %rdi
movq 0x2651a(%rip), %rsi     # 0x2afc0
callq 0x2240
jmp 0x4aad
leaq -0x408(%rbp), %rdi
callq 0x2130
movq 0x26510(%rip), %rdi     # 0x2afd0
leaq 0x19635(%rip), %rsi     # 0x1e0fc
callq 0x2200
movq %rax, -0x4d0(%rbp)
jmp 0x4ad5
movq -0x4d0(%rbp), %rdi
movq 0x264dd(%rip), %rsi     # 0x2afc0
callq 0x2240
jmp 0x4aea
movl $0x3, -0x414(%rbp)
leaq -0x410(%rbp), %rdi
leaq -0x414(%rbp), %rsi
callq 0x4e70
jmp 0x4b09
leaq -0x410(%rbp), %rdi
callq 0x4dc0
jmp 0x4b17
movl -0x3e4(%rbp), %esi
leaq -0x1f0(%rbp), %rdi
callq 0x19330
jmp 0x4b2b
jmp 0x494f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x408(%rbp), %rdi
callq 0x2130
jmp 0x4c6c
leaq -0x1f0(%rbp), %rdi
callq 0x1bbf0
movl %eax, -0x4d4(%rbp)
jmp 0x4b61
movl -0x4d4(%rbp), %eax
movl %eax, -0x418(%rbp)
movq 0x2645c(%rip), %rdi     # 0x2afd0
movq 0x26445(%rip), %rsi     # 0x2afc0
callq 0x2240
jmp 0x4b82
movq 0x26447(%rip), %rdi     # 0x2afd0
leaq 0x19584(%rip), %rsi     # 0x1e114
callq 0x2200
movq %rax, -0x4e0(%rbp)
jmp 0x4b9e
movl -0x418(%rbp), %esi
leaq -0x1f0(%rbp), %rdi
callq 0x4d80
movq %rax, -0x4e8(%rbp)
jmp 0x4bb9
movq -0x4e8(%rbp), %rsi
leaq -0x438(%rbp), %rdi
callq 0x14700
jmp 0x4bce
movq -0x4e0(%rbp), %rdi
leaq -0x438(%rbp), %rsi
callq 0x21d0
movq %rax, -0x4f0(%rbp)
jmp 0x4bea
movq -0x4f0(%rbp), %rdi
movq 0x263c8(%rip), %rsi     # 0x2afc0
callq 0x2240
jmp 0x4bff
leaq -0x438(%rbp), %rdi
callq 0x2130
movl $0x0, -0x4(%rbp)
leaq -0x1f0(%rbp), %rdi
callq 0x19290
leaq -0x138(%rbp), %rdi
callq 0x18b20
leaq -0xb0(%rbp), %rdi
callq 0x18b20
leaq -0x50(%rbp), %rdi
callq 0x13260
leaq -0x20(%rbp), %rdi
callq 0x11420
movl -0x4(%rbp), %eax
addq $0x4f0, %rsp            # imm = 0x4F0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x438(%rbp), %rdi
callq 0x2130
leaq -0x1f0(%rbp), %rdi
callq 0x19290
leaq -0x138(%rbp), %rdi
callq 0x18b20
leaq -0xb0(%rbp), %rdi
callq 0x18b20
leaq -0x50(%rbp), %rdi
callq 0x13260
leaq -0x20(%rbp), %rdi
callq 0x11420
movq -0x28(%rbp), %rdi
callq 0x2360
nopl (%rax,%rax)