// File: /workspace/github_cpp_makefile_star2_O2/BohangZhang[P]Sorcery-C-Project/player.cc
// Function: Player::play(int)
void Player::play(int i) { // call Game notify()
    if (getHand()->getHand().size() < i) throw 7; // Number; The card doesn't exist
    else {
        shared_ptr<Card> c = getHand()->getHand()[i - 1];
        if (getMagic() < c->getCost()) throw 6; // Number; You don't have enough Magic
        string card_type = c->getType();
        if (card_type == "Enchantment") throw 8; // Number; Wrong command
        else if (card_type == "Spell") {
            c->action();
            getHand()->pop(i);
        } else if (card_type == "Ritual") {
            ritual = dynamic_pointer_cast<Ritual>(c);
            game->notifyRitual("REnter", ritual);
            getHand()->pop(i);
        } else {
            if (isSlotFull()) {
                throw 2;
            } else {
                shared_ptr<Minion> m = dynamic_pointer_cast<Minion>(c);
                getSlot()->push(m);
                getHand()->pop(i);
                game->notify("Enter", m);
            }
        }
        subMagic(c->getCost());
        for (auto it = this->getSlot()->getSlot().begin(); it != this->getSlot()->getSlot().end(); ) {
            if ((*it)->ifDead()) {
                this->getGraveyard()->pushfirst((*it));
                this->getSlot()->pop((*it));
            } else {
                ++it;
            }
        }
        for (auto it = this->getGame()->getNoncurrent()->getSlot()->getSlot().begin(); 
             it != this->getGame()->getNoncurrent()->getSlot()->getSlot().end(); ) {
            if ((*it)->ifDead()) {
                this->getGame()->getNoncurrent()->getGraveyard()->pushfirst((*it));
                this->getGame()->getNoncurrent()->getSlot()->pop((*it));
            } else {
                ++it;
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movl %esi, %ebp
movq %rdi, %r12
leaq 0x38(%rdi), %r14
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1a83e
movq (%rbx), %rdi
callq 0x10e52
movq 0x8(%rax), %rbx
subq (%rax), %rbx
sarq $0x4, %rbx
movslq %ebp, %r15
leaq 0x58(%rsp), %rdi
callq 0x8ea0
cmpq %r15, %rbx
jb 0x12941
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1a83e
movq (%rbx), %rdi
callq 0x10e52
movq (%rax), %rax
shlq $0x4, %r15
leaq (%rax,%r15), %rsi
addq $-0x10, %rsi
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
callq 0xb86e
leaq 0x58(%rsp), %rdi
callq 0x8ea0
movl 0x24(%r12), %r15d
movq (%rbx), %rdi
callq 0xb418
cmpl %eax, %r15d
jl 0x12960
movq 0x40(%rsp), %rsi
leaq 0x50(%rsp), %rdi
callq 0xb3f4
leaq 0xc3ff(%rip), %rsi      # 0x1e7d4
leaq 0x50(%rsp), %rdi
callq 0x8dc3
testb %al, %al
jne 0x1297f
leaq 0xb45c(%rip), %rsi      # 0x1d84a
leaq 0x50(%rsp), %rdi
callq 0x8dc3
testb %al, %al
movq %r12, 0x38(%rsp)
je 0x1242b
movq 0x40(%rsp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1a83e
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x10e84
jmp 0x125f7
leaq 0xb411(%rip), %rsi      # 0x1d843
leaq 0x50(%rsp), %rdi
callq 0x8dc3
testb %al, %al
je 0x124ff
leaq 0x8(%rsp), %r15
leaq 0x40(%rsp), %rsi
movq %r15, %rdi
callq 0x1a757
leaq 0x68(%r12), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1a8a6
leaq 0x10(%rsp), %rdi
callq 0x8ea0
movq 0x88(%r12), %r15
leaq 0xc538(%rip), %rsi      # 0x1e9b7
leaq 0x108(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x8d88
leaq 0xd8(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x1078c
leaq 0x108(%rsp), %rsi
movq %r15, %rdi
movq %r12, %rdx
callq 0x105e2
leaq 0xe0(%rsp), %rdi
callq 0x8ea0
leaq 0x108(%rsp), %rdi
callq 0x5378
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1a83e
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x10e84
leaq 0x10(%rsp), %rdi
callq 0x8ea0
movq 0x38(%rsp), %r12
jmp 0x12601
movq %r12, %rdi
callq 0x12230
testb %al, %al
jne 0x1299d
leaq 0x8(%rsp), %rbx
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x1a7ac
leaq 0x48(%r12), %rsi
leaq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0x1a802
movq (%r15), %r15
leaq 0xc8(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x8f30
movq %r15, %rdi
movq %r12, %rsi
callq 0x1b320
leaq 0xd0(%rsp), %rdi
callq 0x8ea0
leaq 0x20(%rsp), %rdi
callq 0x8ea0
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1a83e
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x10e84
leaq 0x20(%rsp), %rdi
callq 0x8ea0
movq 0x38(%rsp), %r12
movq 0x88(%r12), %rbx
leaq 0xc407(%rip), %rsi      # 0x1e9aa
leaq 0xe8(%rsp), %rdi
leaq 0x18(%rsp), %rdx
callq 0x8d88
leaq 0xb8(%rsp), %r14
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x8f30
leaq 0xe8(%rsp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0xe740
leaq 0xc0(%rsp), %rdi
callq 0x8ea0
leaq 0xe8(%rsp), %rdi
callq 0x5378
leaq 0x10(%rsp), %rdi
callq 0x8ea0
movq 0x40(%rsp), %rdi
callq 0xb418
movq %r12, %rdi
movl %eax, %esi
callq 0x121d0
leaq 0x48(%r12), %rbx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1a802
movq (%r14), %rdi
callq 0x1b2e2
movq (%rax), %r15
leaq 0x10(%rsp), %rdi
callq 0x8ea0
leaq 0x58(%r12), %rax
movq %rax, 0x70(%rsp)
leaq 0x8(%rsp), %rbp
leaq 0xa8(%rsp), %r14
leaq 0x98(%rsp), %r12
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x1a802
movq 0x8(%rsp), %rdi
callq 0x1b2e2
movq 0x8(%rax), %r13
leaq 0x10(%rsp), %rdi
callq 0x8ea0
cmpq %r13, %r15
je 0x12728
movq (%r15), %rdi
movq (%rdi), %rax
callq *0xc0(%rax)
testb %al, %al
je 0x1271f
movq %rbp, %rdi
movq 0x70(%rsp), %rsi
callq 0x1a816
movq 0x8(%rsp), %r13
movq %r14, %rdi
movq %r15, %rsi
callq 0x8f30
movq %r13, %rdi
movq %r14, %rsi
callq 0x10b26
leaq 0xb0(%rsp), %rdi
callq 0x8ea0
leaq 0x10(%rsp), %rdi
callq 0x8ea0
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x1a802
movq 0x8(%rsp), %r13
movq %r12, %rdi
movq %r15, %rsi
callq 0x8f30
movq %r13, %rdi
movq %r12, %rsi
callq 0x1b326
leaq 0xa0(%rsp), %rdi
callq 0x8ea0
leaq 0x10(%rsp), %rdi
callq 0x8ea0
jmp 0x1265e
addq $0x10, %r15
jmp 0x1265e
movq 0x38(%rsp), %r12
addq $0x88, %r12
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x8f1c
movq (%rbx), %rsi
leaq 0x18(%rsp), %rdi
callq 0xe57c
movq 0x18(%rsp), %rsi
addq $0x48, %rsi
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x1a802
movq (%rbx), %rdi
callq 0x1b2e2
movq (%rax), %r13
leaq 0x10(%rsp), %rdi
callq 0x8ea0
leaq 0x20(%rsp), %rdi
callq 0x8ea0
leaq 0x30(%rsp), %rdi
callq 0x8ea0
leaq 0x28(%rsp), %r14
leaq 0x8(%rsp), %rbp
movq %r14, %rdi
movq %r12, %rsi
callq 0x8f1c
movq 0x28(%rsp), %rsi
leaq 0x18(%rsp), %rdi
callq 0xe57c
movq %r12, %rbx
movq 0x18(%rsp), %rsi
addq $0x48, %rsi
movq %rbp, %rdi
callq 0x1a802
movq 0x8(%rsp), %rdi
callq 0x1b2e2
movq 0x8(%rax), %r12
leaq 0x10(%rsp), %rdi
callq 0x8ea0
leaq 0x20(%rsp), %rdi
callq 0x8ea0
leaq 0x30(%rsp), %rdi
callq 0x8ea0
cmpq %r12, %r13
je 0x1291b
movq (%r13), %rdi
movq (%rdi), %rax
callq *0xc0(%rax)
movq %rbx, %r12
testb %al, %al
je 0x12912
movq %r14, %r15
movq %r14, %rdi
movq %r12, %rsi
callq 0x8f1c
movq 0x28(%rsp), %rsi
leaq 0x18(%rsp), %rdi
callq 0xe57c
movq 0x18(%rsp), %rsi
addq $0x58, %rsi
movq %rbp, %rdi
callq 0x1a816
movq 0x8(%rsp), %r12
leaq 0x88(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x8f30
movq %r12, %rdi
movq %r14, %rsi
callq 0x10b26
leaq 0x90(%rsp), %rdi
callq 0x8ea0
leaq 0x10(%rsp), %rdi
callq 0x8ea0
leaq 0x20(%rsp), %rdi
callq 0x8ea0
leaq 0x30(%rsp), %rdi
callq 0x8ea0
movq %r15, %r14
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8f1c
movq 0x28(%rsp), %rsi
leaq 0x18(%rsp), %rdi
callq 0xe57c
movq 0x18(%rsp), %rsi
addq $0x48, %rsi
movq %rbp, %rdi
callq 0x1a802
movq 0x8(%rsp), %r12
leaq 0x78(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x8f30
movq %r12, %rdi
movq %r15, %rsi
callq 0x1b326
leaq 0x80(%rsp), %rdi
callq 0x8ea0
leaq 0x10(%rsp), %rdi
callq 0x8ea0
leaq 0x20(%rsp), %rdi
callq 0x8ea0
leaq 0x30(%rsp), %rdi
callq 0x8ea0
movq %rbx, %r12
jmp 0x1279a
addq $0x10, %r13
jmp 0x1279a
leaq 0x50(%rsp), %rdi
callq 0x5378
leaq 0x48(%rsp), %rdi
callq 0x8ea0
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x4
popq %rdi
callq 0x5120
movl $0x7, (%rax)
movq 0x1864a(%rip), %rsi     # 0x2afa0
movq %rax, %rdi
xorl %edx, %edx
callq 0x5310
pushq $0x4
popq %rdi
callq 0x5120
movl $0x6, (%rax)
movq 0x1862b(%rip), %rsi     # 0x2afa0
movq %rax, %rdi
xorl %edx, %edx
callq 0x5310
pushq $0x8
popq %rbx
pushq $0x4
popq %rdi
callq 0x5120
movl %ebx, (%rax)
movq 0x1860d(%rip), %rsi     # 0x2afa0
movq %rax, %rdi
xorl %edx, %edx
callq 0x5310
pushq $0x2
jmp 0x12981
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x8ea0
leaq 0xe8(%rsp), %rdi
callq 0x5378
jmp 0x12aa8
jmp 0x12aa5
movq %rax, %rbx
jmp 0x129dd
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x8ea0
leaq 0x20(%rsp), %rdi
jmp 0x12a74
jmp 0x12aa5
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
callq 0x8ea0
leaq 0x108(%rsp), %rdi
callq 0x5378
jmp 0x12ab2
jmp 0x12a7d
jmp 0x12aa5
jmp 0x12a87
jmp 0x12a82
jmp 0x12aa5
jmp 0x12a2f
jmp 0x12a22
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
jmp 0x12ac1
movq %rax, %rbx
jmp 0x12abc
jmp 0x12a7d
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
jmp 0x12a53
jmp 0x12a82
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x8ea0
jmp 0x12a8a
jmp 0x12a82
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
jmp 0x12a74
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x8ea0
jmp 0x12aa8
jmp 0x12a7d
movq %rax, %rbx
jmp 0x12ab2
movq %rax, %rbx
jmp 0x12a9e
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x8ea0
leaq 0x20(%rsp), %rdi
callq 0x8ea0
leaq 0x30(%rsp), %rdi
jmp 0x12aad
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x8ea0
leaq 0x50(%rsp), %rdi
callq 0x5378
leaq 0x48(%rsp), %rdi
callq 0x8ea0
movq %rbx, %rdi
callq 0x5330