// File: /workspace/github_cpp_makefile_star2_O2/whitefusion[P]Jaipur_cardgame-/Game.cpp
// Function: Game::tradeInputVerify(Player&, Market&)
vector<vector<int> > Game::tradeInputVerify(Player &p, Market &m){
    vector<vector<int> > temp;
    vector<int> tempM;
    vector<int> tempH;

    char tmp[256];
    char *token;

    // read in user's input
    cout << "Choose the cards on MARKET want to take in: ";
    //cin.getline(tmp, 256);
    cin.getline(tmp, 256);

    token = strtok(tmp, " \t\n\r\f");
    while (!token ){
        cout << "Invalid choice! Try again." << endl;
        cout << "Choose the cards on MARKET want to take in: ";
        cin.getline(tmp, 256);
        token = strtok(tmp, " \t\n\r\f");
    }

    tempM.push_back(atoi(token));
    token = strtok(NULL, " \t\n\r\f");
    while (token){
        tempM.push_back(atoi(token));
        token = strtok(NULL, " \t\n\r\f");
    }

    cout << "Choose the cards on HANDS want to trade: ";
    cin.getline(tmp, 256);

    token = strtok(tmp, " \t\n\r\f");


    // if nothing input, will trade camels
    if (token){
        tempH.push_back(atoi(token));
        token = strtok(NULL, " \t\n\r\f");
        while (token){
            tempH.push_back(atoi(token));
            token = strtok(NULL, " \t\n\r\f");
        }        
    }

    while(!tradeVerify(tempM, tempH, p, m)){
        tempM.clear();
        tempH.clear();
        cout << "Invalid choice! Try again." << endl;
        cout << "Choose the cards on MARKET want to take in: ";
        cin.getline(tmp, 256);

        token = strtok(tmp, " \t\n\r\f");
        while (!token){
            cout << "Invalid choice! Try again." << endl;
            cout << "Choose the cards on MARKET want to take in: ";
            cin.getline(tmp, 256);
            token = strtok(tmp, " \t\n\r\f");
        }


        tempM.push_back(atoi(token));
        token = strtok(NULL, " \t\n\r\f");
        while (token){
            tempM.push_back(atoi(token));
            token = strtok(NULL, " \t\n\r\f");
        }

        cout << "Choose the cards on HANDS want to trade: ";
        cin.getline(tmp, 256);

        token = strtok(tmp, " \t\n\r\f");

        // if nothing input, will trade camels
        if (token){
            tempH.push_back(atoi(token));
            token = strtok(NULL, " \t\n\r\f");
            while (token){
                tempH.push_back(atoi(token));
                token = strtok(NULL, " \t\n\r\f");
            }
        }
    }

    temp.push_back(tempM);
    temp.push_back(tempH);

    return temp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rcx, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rdi, 0x8(%rsp)
andq $0x0, 0x10(%rdi)
movaps %xmm0, 0x30(%rsp)
andq $0x0, 0x40(%rsp)
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movq 0x9d2b(%rip), %rdi      # 0x14fd0
leaq 0x2692(%rip), %rsi      # 0xd93e
callq 0x21b0
movq 0x9d28(%rip), %rdi      # 0x14fe0
leaq 0x60(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x2080
leaq 0x1d94(%rip), %rbx      # 0xd062
leaq 0x60(%rsp), %r14
movq 0x9cf6(%rip), %r15      # 0x14fd0
leaq 0x1d87(%rip), %r12      # 0xd068
leaq 0x2656(%rip), %r13      # 0xd93e
movq 0x9cf1(%rip), %rbp      # 0x14fe0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2250
testq %rax, %rax
jne 0xb32f
movq %r15, %rdi
movq %r12, %rsi
callq 0x21b0
movq %rax, %rdi
callq 0x20f0
movq %r15, %rdi
movq %r13, %rsi
callq 0x21b0
movl $0x100, %edx            # imm = 0x100
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2080
jmp 0xb2ef
movq %rax, %rdi
callq 0x2240
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
leaq 0x30(%rsp), %rdi
callq 0xc146
leaq 0x1d13(%rip), %rbx      # 0xd062
leaq 0x30(%rsp), %r14
leaq 0x4(%rsp), %r15
xorl %edi, %edi
movq %rbx, %rsi
callq 0x2250
testq %rax, %rax
je 0xb381
movq %rax, %rdi
callq 0x2240
movl %eax, 0x4(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0xc146
jmp 0xb359
movq 0x9c48(%rip), %rdi      # 0x14fd0
leaq 0x26d6(%rip), %rsi      # 0xda65
callq 0x21b0
movq 0x9c45(%rip), %rdi      # 0x14fe0
leaq 0x60(%rsp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x2080
leaq 0x1cb1(%rip), %rsi      # 0xd062
leaq 0x60(%rsp), %rdi
callq 0x2250
testq %rax, %rax
je 0xb412
movq %rax, %rdi
callq 0x2240
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
leaq 0x10(%rsp), %rdi
callq 0xc146
leaq 0x1c82(%rip), %rbx      # 0xd062
leaq 0x10(%rsp), %r14
leaq 0x4(%rsp), %r15
xorl %edi, %edi
movq %rbx, %rsi
callq 0x2250
testq %rax, %rax
je 0xb412
movq %rax, %rdi
callq 0x2240
movl %eax, 0x4(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0xc146
jmp 0xb3ea
leaq 0x30(%rsp), %r13
movq 0x9bb2(%rip), %rbx      # 0x14fd0
movq 0x9bbb(%rip), %r12      # 0x14fe0
leaq 0x60(%rsp), %rbp
leaq 0x1c31(%rip), %r14      # 0xd062
leaq 0x4(%rsp), %r15
movq 0x48(%rsp), %rdi
movq %r13, %rsi
leaq 0x10(%rsp), %rdx
movq 0x50(%rsp), %rcx
movq 0x58(%rsp), %r8
callq 0xb8ec
testb %al, %al
jne 0xb5b3
movq 0x30(%rsp), %rax
cmpq %rax, 0x38(%rsp)
je 0xb46b
movq %rax, 0x38(%rsp)
movq 0x10(%rsp), %rax
cmpq %rax, 0x18(%rsp)
je 0xb47c
movq %rax, 0x18(%rsp)
movq %rbx, %rdi
leaq 0x1be2(%rip), %rsi      # 0xd068
callq 0x21b0
movq %rax, %rdi
callq 0x20f0
movq %rbx, %rdi
leaq 0x24a1(%rip), %rsi      # 0xd93e
callq 0x21b0
movl $0x100, %edx            # imm = 0x100
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2080
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2250
testq %rax, %rax
jne 0xb4fa
movq %rbx, %rdi
leaq 0x1b9c(%rip), %rsi      # 0xd068
callq 0x21b0
movq %rax, %rdi
callq 0x20f0
movq %rbx, %rdi
leaq 0x245b(%rip), %rsi      # 0xd93e
callq 0x21b0
movl $0x100, %edx            # imm = 0x100
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2080
jmp 0xb4b2
movq %rax, %rdi
callq 0x2240
movl %eax, 0x4(%rsp)
movq %r13, %rdi
movq %r15, %rsi
callq 0xc146
xorl %edi, %edi
movq %r14, %rsi
callq 0x2250
testq %rax, %rax
je 0xb539
movq %rax, %rdi
callq 0x2240
movl %eax, 0x4(%rsp)
movq %r13, %rdi
movq %r15, %rsi
callq 0xc146
jmp 0xb511
movq %rbx, %rdi
leaq 0x2522(%rip), %rsi      # 0xda65
callq 0x21b0
movl $0x100, %edx            # imm = 0x100
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2080
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2250
testq %rax, %rax
je 0xb436
movq %rax, %rdi
callq 0x2240
movl %eax, 0x4(%rsp)
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0xc146
xorl %edi, %edi
movq %r14, %rsi
callq 0x2250
testq %rax, %rax
je 0xb436
movq %rax, %rdi
callq 0x2240
movl %eax, 0x4(%rsp)
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0xc146
jmp 0xb585
leaq 0x30(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0xbf5a
leaq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0xbf5a
leaq 0x10(%rsp), %rdi
callq 0x57aa
leaq 0x30(%rsp), %rdi
callq 0x57aa
movq 0x8(%rsp), %rax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb612
jmp 0xb612
jmp 0xb612
jmp 0xb612
jmp 0xb612
jmp 0xb612
jmp 0xb612
jmp 0xb612
jmp 0xb612
jmp 0xb612
jmp 0xb612
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x57aa
leaq 0x30(%rsp), %rdi
callq 0x57aa
movq 0x8(%rsp), %rdi
callq 0x52ca
movq %rbx, %rdi
callq 0x22a0
nop