// File: /workspace/github_cpp_makefile_star2_O3/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 $0x68, %rsp
movq %rcx, 0x10(%rsp)
movq %rdx, %r13
movq %rsi, %r12
movq %rdi, %rbx
movq (%rsi), %r14
movq 0x8(%rsi), %r15
cmpq %r15, %r14
je 0xa984
movq %r15, %rax
subq %r14, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0xbeef
movq %r14, %rdi
movq %r15, %rsi
callq 0xbfd2
movq (%r12), %r14
movq 0x8(%r12), %rax
jmp 0xa987
movq %r14, %rax
movq %rax, %r15
subq %r14, %r15
shrq $0x2, %r15
testl %r15d, %r15d
jle 0xaab7
movq %r15, 0x8(%rsp)
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
movq %r15, 0x18(%rsp)
xorl %ebp, %ebp
leaq 0x20(%rsp), %r15
movq (%r12), %rax
movq 0x8(%r12), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rbp, %rdx
jbe 0xabb2
movq 0x8(%rbx), %rcx
cmpq %rcx, 0x10(%rbx)
je 0xab9c
movslq (%rax,%rbp,4), %rsi
decq %rsi
movq (%rcx), %rax
movq 0x8(%rcx), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
cmpq %rsi, %rdx
jbe 0xaba9
shlq $0x5, %rsi
addq %rsi, %rax
leaq 0x48(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x92ae
leaq 0xb87b(%rip), %rdi      # 0x16290
movq %r14, %rsi
callq 0x44e2
movl (%rax), %r14d
movq %r13, %rdi
movl %r14d, %esi
callq 0x5462
testl %eax, %eax
je 0xaa7f
movq %r15, %rdi
movq %r13, %rsi
movl %r14d, %edx
callq 0x54ba
movq %r15, %rdi
callq 0x4384
addl %eax, 0x48(%rbx)
movq %r15, %rdi
callq 0x40b8
movq %r15, %rdi
movq %r13, %rsi
movl %r14d, %edx
callq 0x54ba
movq %r15, %rdi
callq 0x4384
addl %eax, 0x50(%rbx)
movq %r15, %rdi
callq 0x40b8
movq %r13, %rdi
movl %r14d, %esi
callq 0x5630
incl 0x58(%rbx)
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xaa9b
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21a0
incq %rbp
cmpq %rbp, 0x18(%rsp)
jne 0xa9b2
movq (%r12), %r14
movq 0x8(%r12), %rax
movq 0x8(%rsp), %r15
cmpq %r14, %rax
je 0xab9c
movl (%r14), %edx
decl %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xa858
cmpl $0x2, %r15d
jl 0xab8d
movq %r15, %r13
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
movl $0x1, %r14d
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
movq (%r12), %rax
movq 0x8(%r12), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %r14, %rdx
jbe 0xabbe
movl (%rax,%r14,4), %edx
addl %ebp, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xa858
incq %r14
decl %ebp
cmpq %r14, %r15
jne 0xaaee
movq %r13, %r12
cmpl $0x2, %r12d
je 0xab8d
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq 0x10(%rsp), %r15
movq %r15, %rsi
movl %r12d, %edx
callq 0x740c
movq %r14, %rdi
callq 0x4384
addl %eax, 0x4c(%rbx)
leaq 0x20(%rsp), %rdi
callq 0x40b8
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movl %r12d, %edx
callq 0x740c
movq %r14, %rdi
callq 0x4384
addl %eax, 0x50(%rbx)
leaq 0x20(%rsp), %rdi
callq 0x40b8
movq %r15, %rdi
movl %r12d, %esi
callq 0x7538
incl 0x5c(%rbx)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x57b5(%rip), %rdi      # 0x10358
xorl %esi, %esi
xorl %edx, %edx
jmp 0xabc8
leaq 0x57a8(%rip), %rdi      # 0x10358
jmp 0xabc8
leaq 0x579f(%rip), %rdi      # 0x10358
movq %rbp, %rsi
jmp 0xabc8
leaq 0x5793(%rip), %rdi      # 0x10358
movq %r14, %rsi
xorl %eax, %eax
callq 0x21f0
jmp 0xabd1
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x40b8
jmp 0xac14
jmp 0xabe4
jmp 0xabf5
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x40b8
jmp 0xabf8
jmp 0xabf5
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xac14
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21a0
movq %rbx, %rdi
callq 0x2280