// File: /workspace/github_cpp_makefile_star2_O1/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 0xa9cf
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 0xbf59
movq %r14, %rdi
movq %r15, %rsi
callq 0xc03c
movq 0x8(%r12), %rax
subq (%r12), %rax
shrq $0x2, %rax
movq %rax, 0x8(%rsp)
testl %eax, %eax
jle 0xaaf9
movq 0x8(%rsp), %rax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %rax, 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 0xac07
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rsi
subq %rcx, %rsi
je 0xabe1
movslq (%rax,%rbp,4), %rsi
decq %rsi
movq (%rcx), %rax
movq 0x8(%rcx), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
cmpq %rsi, %rdx
jbe 0xabfe
shlq $0x5, %rsi
addq %rsi, %rax
leaq 0x48(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x92fe
leaq 0xb82b(%rip), %rdi      # 0x16290
movq %r14, %rsi
callq 0x451c
movl (%rax), %r14d
movq %r13, %rdi
movl %r14d, %esi
callq 0x54aa
testl %eax, %eax
je 0xaacf
movq %r15, %rdi
movq %r13, %rsi
movl %r14d, %edx
callq 0x5502
movq %r15, %rdi
callq 0x43be
addl %eax, 0x48(%rbx)
movq %r15, %rdi
callq 0x40dc
movq %r15, %rdi
movq %r13, %rsi
movl %r14d, %edx
callq 0x5502
movq %r15, %rdi
callq 0x43be
addl %eax, 0x50(%rbx)
movq %r15, %rdi
callq 0x40dc
movq %r13, %rdi
movl %r14d, %esi
callq 0x5678
incl 0x58(%rbx)
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xaaeb
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21a0
incq %rbp
cmpq %rbp, 0x18(%rsp)
jne 0xa9ff
movq (%r12), %rax
cmpq %rax, 0x8(%r12)
je 0xac24
movl (%rax), %edx
decl %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xa8ae
movq 0x8(%rsp), %r13
cmpl $0x2, %r13d
jl 0xab69
movl %r13d, %r15d
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 0xac13
movl (%rax,%r14,4), %edx
addl %ebp, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xa8ae
incq %r14
decl %ebp
cmpq %r14, %r15
jne 0xab36
cmpl $0x3, %r13d
jl 0xabd2
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq 0x10(%rsp), %r15
movq %r15, %rsi
movl %r13d, %edx
callq 0x7458
movq %r14, %rdi
callq 0x43be
addl %eax, 0x4c(%rbx)
leaq 0x20(%rsp), %rdi
callq 0x40dc
leaq 0x20(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movl %r13d, %edx
callq 0x7458
movq %r14, %rdi
callq 0x43be
addl %eax, 0x50(%rbx)
leaq 0x20(%rsp), %rdi
callq 0x40dc
movq %r15, %rdi
movl %r13d, %esi
callq 0x7598
incl 0x5c(%rbx)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rdx
leaq 0x574e(%rip), %rdi      # 0x10348
xorl %esi, %esi
jmp 0xac1d
leaq 0x5743(%rip), %rdi      # 0x10348
jmp 0xac1d
leaq 0x573a(%rip), %rdi      # 0x10348
movq %rbp, %rsi
jmp 0xac1d
leaq 0x572e(%rip), %rdi      # 0x10348
movq %r14, %rsi
xorl %eax, %eax
callq 0x21f0
leaq 0x571d(%rip), %rdi      # 0x10348
xorl %esi, %esi
xorl %edx, %edx
jmp 0xac1d
jmp 0xac33
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x40dc
jmp 0xac76
jmp 0xac46
jmp 0xac57
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x40dc
jmp 0xac5a
jmp 0xac57
movq %rax, %rbx
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xac76
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x21a0
movq %rbx, %rdi
callq 0x2280