// File: /workspace/github_cpp_makefile_star2_O2/whitefusion[P]Jaipur_cardgame-/Player.cpp
// Function: Player::Sell(std::vector<int, std::allocator<int>>, All_Tokens&, All_Bonus&)
void Player::Sell(vector<int> goods2sell, All_Tokens &AT, All_Bonus &AB){ // pass an integer vector that contains the location(from 1) of the cards
    sort(goods2sell.begin(), goods2sell.end()); // just convenient for delete
    int i;
    int n = goods2sell.size();
    for (i = 0; i< n; ++i){
        int l = goods2sell.at(i)-1;
        string type = hand.at(0).at(l).getCard(); 
        int id = type2id[type];
        // update points, token number
        if (AT.getSize(id) != 0){
            point[0] += AT.getToken(id).getVal();
            point[2] += AT.getToken(id).getVal();
            AT.deleteToken(id);
            GTokenNum ++;
        }
    }

    // delete the handcard, update card size
    delHand(0,goods2sell.at(0)-1);
    for (i = 1; i < n; ++i)
        delHand(0,goods2sell.at(i)-i-1);

    //update the bonus points, bonus
    if (n > 2){
        point[1] += AB.getBonus(n).getVal(); 
        point[2] += AB.getBonus(n).getVal();
        AB.delBonus(n);
        BTokenNum++;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, 0x10(%rsp)
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rdi
movq 0x8(%rsi), %rsi
callq 0x9d73
movq 0x8(%r14), %rax
movq %r14, 0x8(%rsp)
subq (%r14), %rax
shrq $0x2, %rax
xorl %ebp, %ebp
testl %eax, %eax
movl $0x0, %ecx
movq %rax, 0x18(%rsp)
cmovgl %eax, %ecx
movq %rcx, 0x28(%rsp)
leaq 0x8(%rbx), %rax
movq %rax, 0x20(%rsp)
leaq 0x58(%rsp), %r15
leaq 0x30(%rsp), %r14
cmpq %rbp, 0x28(%rsp)
je 0x8df6
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x5358
movslq (%rax), %r12
decq %r12
movq 0x20(%rsp), %rdi
xorl %esi, %esi
callq 0x9940
movq %rax, %rdi
movq %r12, %rsi
callq 0x8396
movq %r15, %rdi
movq %rax, %rsi
callq 0x7d18
leaq 0xc524(%rip), %rdi      # 0x152a0
movq %r15, %rsi
callq 0x3da2
movl (%rax), %r12d
movq %r13, %rdi
movl %r12d, %esi
callq 0x4c28
testl %eax, %eax
je 0x8de6
movq %r14, %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0x4c5a
movq %r14, %rdi
callq 0x3c78
addl %eax, 0x48(%rbx)
movq %r14, %rdi
callq 0x3aa2
movq %r14, %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0x4c5a
movq %r14, %rdi
callq 0x3c78
addl %eax, 0x50(%rbx)
movq %r14, %rdi
callq 0x3aa2
movq %r13, %rdi
movl %r12d, %esi
callq 0x4ce4
incl 0x58(%rbx)
movq %r15, %rdi
callq 0x20e0
incq %rbp
jmp 0x8d35
movq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x5358
movl (%rax), %edx
decl %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x8c4c
movq 0x18(%rsp), %r12
movslq %r12d, %r15
pushq $0x1
popq %r14
pushq $-0x2
popq %rbp
cmpq %r15, %r14
jge 0x8e46
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x5358
movl (%rax), %edx
addl %ebp, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x8c4c
incq %r14
decl %ebp
jmp 0x8e1f
cmpl $0x3, %r12d
jl 0x8eaf
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq 0x10(%rsp), %r15
movq %r15, %rsi
movl %r12d, %edx
callq 0x672c
movq %r14, %rdi
callq 0x3c78
addl %eax, 0x4c(%rbx)
leaq 0x30(%rsp), %rdi
callq 0x3aa2
leaq 0x30(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movl %r12d, %edx
callq 0x672c
movq %r14, %rdi
callq 0x3c78
addl %eax, 0x50(%rbx)
leaq 0x30(%rsp), %rdi
callq 0x3aa2
movq %r15, %rdi
movl %r12d, %esi
callq 0x67b4
incl 0x5c(%rbx)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8ec0
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x3aa2
jmp 0x8ef1
jmp 0x8ee4
jmp 0x8ed5
jmp 0x8ee4
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x3aa2
jmp 0x8ee7
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x20e0
movq %rbx, %rdi
callq 0x22a0
nop