// File: /workspace/github_cpp_makefile_star2_O1/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 $0xf8, %rsp
movl %esi, %ebp
movq %rdi, %r14
movq 0x38(%rdi), %rdi
movq 0x40(%r14), %r13
testq %r13, %r13
je 0x17e24
movq 0x1c1ac(%rip), %rax     # 0x33fc0
cmpb $0x0, (%rax)
je 0x17e1f
incl 0x8(%r13)
jmp 0x17e24
lock
incl 0x8(%r13)
callq 0x16056
movq 0x8(%rax), %rbx
subq (%rax), %rbx
sarq $0x4, %rbx
movslq %ebp, %r12
testq %r13, %r13
je 0x17e44
movq %r13, %rdi
callq 0xb634
cmpq %r12, %rbx
jb 0x186eb
movq 0x38(%r14), %rdi
movq 0x40(%r14), %rbx
testq %rbx, %rbx
je 0x17e6f
movq 0x1c15f(%rip), %rax     # 0x33fc0
cmpb $0x0, (%rax)
je 0x17e6b
incl 0x8(%rbx)
jmp 0x17e6f
lock
incl 0x8(%rbx)
callq 0x16056
movq (%rax), %rax
shlq $0x4, %r12
movq -0x10(%rax,%r12), %r15
movq -0x8(%rax,%r12), %r13
testq %r13, %r13
je 0x17ea1
movq 0x1c12f(%rip), %rax     # 0x33fc0
cmpb $0x0, (%rax)
je 0x17e9c
incl 0x8(%r13)
jmp 0x17ea1
lock
incl 0x8(%r13)
testq %rbx, %rbx
je 0x17eae
movq %rbx, %rdi
callq 0xb634
movl 0x24(%r14), %ebx
movq %r15, %rdi
callq 0xe85e
cmpl %eax, %ebx
jl 0x1870c
leaq 0x98(%rsp), %rdi
movq %r15, %rsi
callq 0xe816
leaq 0x10999(%rip), %rsi     # 0x28872
leaq 0x98(%rsp), %rdi
callq 0x50a0
testl %eax, %eax
movq %r13, 0x8(%rsp)
je 0x1872d
leaq 0xf9ee(%rip), %rsi      # 0x278e8
leaq 0x98(%rsp), %rdi
callq 0x50a0
testl %eax, %eax
je 0x17f91
leaq 0xf9cb(%rip), %rsi      # 0x278e1
leaq 0x98(%rsp), %rdi
callq 0x50a0
testl %eax, %eax
je 0x17fba
movq 0x48(%r14), %rdi
callq 0x24716
testb %al, %al
jne 0x18734
testq %r13, %r13
sete %bl
leaq 0x1b167(%rip), %rsi     # 0x330b0
leaq 0x1ba48(%rip), %rdx     # 0x33998
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x5220
movq %r13, %r12
movq %rax, %r13
testq %rax, %rax
sete %al
cmoveq %r13, %r12
orb %bl, %al
jne 0x18023
movq 0x1c047(%rip), %rax     # 0x33fc0
cmpb $0x0, (%rax)
je 0x18018
movq 0x8(%rsp), %r12
incl 0x8(%r12)
jmp 0x18023
movq (%r15), %rax
movq %r15, %rdi
callq *0x40(%rax)
movq 0x38(%r14), %rdi
movq 0x40(%r14), %r12
testq %r12, %r12
je 0x1800c
movq 0x1c012(%rip), %rax     # 0x33fc0
cmpb $0x0, (%rax)
je 0x18006
incl 0x8(%r12)
jmp 0x1800c
testq %r13, %r13
sete %bl
leaq 0x1b0e9(%rip), %rsi     # 0x330b0
leaq 0x1bbe2(%rip), %rdx     # 0x33bb0
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x5220
testq %rax, %rax
sete %dl
movq %rax, %rcx
cmovneq %r13, %rcx
orb %bl, %dl
jne 0x1817c
movq 0x1bfcc(%rip), %rcx     # 0x33fc0
cmpb $0x0, (%rcx)
je 0x18174
incl 0x8(%r13)
jmp 0x18179
lock
incl 0x8(%r12)
movl %ebp, %esi
callq 0x16088
jmp 0x18267
movq 0x8(%rsp), %r12
lock
incl 0x8(%r12)
movq 0x48(%r14), %rdi
movq 0x50(%r14), %rbx
testq %rbx, %rbx
je 0x18045
movq 0x1bf89(%rip), %rax     # 0x33fc0
cmpb $0x0, (%rax)
je 0x18041
incl 0x8(%rbx)
jmp 0x18045
lock
incl 0x8(%rbx)
movq %r13, 0x78(%rsp)
movq %r12, 0x80(%rsp)
testq %r12, %r12
je 0x18070
movq 0x1bf62(%rip), %rax     # 0x33fc0
cmpb $0x0, (%rax)
je 0x1806a
incl 0x8(%r12)
jmp 0x18070
lock
incl 0x8(%r12)
leaq 0x78(%rsp), %rsi
callq 0x24744
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x1808c
callq 0xb634
testq %rbx, %rbx
je 0x18099
movq %rbx, %rdi
callq 0xb634
movq 0x38(%r14), %rdi
movq 0x40(%r14), %rbx
testq %rbx, %rbx
je 0x180bb
movq 0x1bf13(%rip), %rax     # 0x33fc0
cmpb $0x0, (%rax)
je 0x180b7
incl 0x8(%rbx)
jmp 0x180bb
lock
incl 0x8(%rbx)
movl %ebp, %esi
callq 0x16088
testq %rbx, %rbx
je 0x180cf
movq %rbx, %rdi
callq 0xb634
movq 0x88(%r14), %rbx
leaq 0xc8(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x10979(%rip), %rsi     # 0x28a62
leaq 0x10977(%rip), %rdx     # 0x28a67
leaq 0xb8(%rsp), %rdi
callq 0xb734
movq %r13, 0x68(%rsp)
movq %r12, 0x70(%rsp)
testq %r12, %r12
movq 0x8(%rsp), %r13
je 0x1812a
movq 0x1bea8(%rip), %rax     # 0x33fc0
cmpb $0x0, (%rax)
je 0x18124
incl 0x8(%r12)
jmp 0x1812a
lock
incl 0x8(%r12)
leaq 0xb8(%rsp), %rsi
leaq 0x68(%rsp), %rdx
movq %rbx, %rdi
callq 0x12304
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x1814e
callq 0xb634
movq 0xb8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x18267
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x51f0
jmp 0x18267
lock
incl 0x8(%r13)
movq %r13, %rcx
movq %rax, 0x68(%r14)
movq 0x70(%r14), %rdi
movq %rcx, 0x70(%r14)
testq %rdi, %rdi
je 0x18192
callq 0xb634
movq 0x88(%r14), %rbx
leaq 0xe8(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x108c2(%rip), %rsi     # 0x28a6f
leaq 0x108c1(%rip), %rdx     # 0x28a75
leaq 0xd8(%rsp), %rdi
callq 0xb734
movq 0x68(%r14), %rax
movq %rax, 0x88(%rsp)
movq 0x70(%r14), %rax
movq %rax, 0x90(%rsp)
testq %rax, %rax
je 0x181f3
movq 0x1bddb(%rip), %rcx     # 0x33fc0
cmpb $0x0, (%rcx)
je 0x181ef
incl 0x8(%rax)
jmp 0x181f3
lock
incl 0x8(%rax)
leaq 0xd8(%rsp), %rsi
leaq 0x88(%rsp), %rdx
movq %rbx, %rdi
callq 0x156c2
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x1821d
callq 0xb634
movq 0xd8(%rsp), %rdi
cmpq %r12, %rdi
je 0x1823a
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x51f0
movq 0x38(%r14), %rdi
movq 0x40(%r14), %r12
testq %r12, %r12
je 0x18260
movq 0x1bd72(%rip), %rax     # 0x33fc0
cmpb $0x0, (%rax)
je 0x1825a
incl 0x8(%r12)
jmp 0x18260
lock
incl 0x8(%r12)
movl %ebp, %esi
callq 0x16088
testq %r12, %r12
je 0x18274
movq %r12, %rdi
callq 0xb634
movq %r15, %rdi
callq 0xe85e
movq %r14, %rdi
movl %eax, %esi
callq 0x17cb4
movq 0x48(%r14), %rdi
movq 0x50(%r14), %rbx
testq %rbx, %rbx
je 0x182a8
movq 0x1bd26(%rip), %rax     # 0x33fc0
cmpb $0x0, (%rax)
je 0x182a4
incl 0x8(%rbx)
jmp 0x182a8
lock
incl 0x8(%rbx)
callq 0x24706
movq (%rax), %rbp
testq %rbx, %rbx
je 0x182bd
movq %rbx, %rdi
callq 0xb634
leaq 0x48(%rsp), %r12
movq 0x1bcf7(%rip), %r13     # 0x33fc0
movq 0x48(%r14), %rdi
movq 0x50(%r14), %rbx
testq %rbx, %rbx
je 0x182e6
cmpb $0x0, (%r13)
je 0x182e2
incl 0x8(%rbx)
jmp 0x182e6
lock
incl 0x8(%rbx)
callq 0x24706
movq 0x8(%rax), %r15
testq %rbx, %rbx
je 0x182fc
movq %rbx, %rdi
callq 0xb634
cmpq %r15, %rbp
je 0x183fe
movq (%rbp), %rdi
movq (%rdi), %rax
callq *0xc0(%rax)
testb %al, %al
je 0x183f5
movq 0x58(%r14), %rdi
movq 0x60(%r14), %rbx
testq %rbx, %rbx
je 0x18337
cmpb $0x0, (%r13)
je 0x18333
incl 0x8(%rbx)
jmp 0x18337
lock
incl 0x8(%rbx)
movq (%rbp), %rax
movq %rax, 0x58(%rsp)
movq 0x8(%rbp), %rax
movq %rax, 0x60(%rsp)
testq %rax, %rax
je 0x1835e
cmpb $0x0, (%r13)
je 0x1835a
incl 0x8(%rax)
jmp 0x1835e
lock
incl 0x8(%rax)
leaq 0x58(%rsp), %rsi
callq 0x15c44
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x18377
callq 0xb634
testq %rbx, %rbx
je 0x18384
movq %rbx, %rdi
callq 0xb634
movq 0x48(%r14), %rdi
movq 0x50(%r14), %rbx
testq %rbx, %rbx
je 0x183a1
cmpb $0x0, (%r13)
je 0x1839d
incl 0x8(%rbx)
jmp 0x183a1
lock
incl 0x8(%rbx)
movq (%rbp), %rax
movq %rax, 0x48(%rsp)
movq 0x8(%rbp), %rax
movq %rax, 0x50(%rsp)
testq %rax, %rax
je 0x183c8
cmpb $0x0, (%r13)
je 0x183c4
incl 0x8(%rax)
jmp 0x183c8
lock
incl 0x8(%rax)
movq %r12, %rsi
callq 0x2474a
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x183df
callq 0xb634
testq %rbx, %rbx
je 0x182c9
movq %rbx, %rdi
callq 0xb634
jmp 0x182c9
addq $0x10, %rbp
jmp 0x182c9
movq 0x88(%r14), %rsi
movq 0x90(%r14), %r15
testq %r15, %r15
je 0x18423
cmpb $0x0, (%r13)
je 0x1841e
incl 0x8(%r15)
jmp 0x18423
lock
incl 0x8(%r15)
leaq 0x10(%rsp), %rdi
callq 0x1206a
movq 0x10(%rsp), %rax
movq 0x48(%rax), %rdi
movq 0x50(%rax), %rbx
testq %rbx, %rbx
je 0x1844f
cmpb $0x0, (%r13)
je 0x1844b
incl 0x8(%rbx)
jmp 0x1844f
lock
incl 0x8(%rbx)
callq 0x24706
movq (%rax), %r12
testq %rbx, %rbx
je 0x18464
movq %rbx, %rdi
callq 0xb634
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x18473
callq 0xb634
testq %r15, %r15
je 0x18480
movq %r15, %rdi
callq 0xb634
leaq 0x10(%rsp), %r15
movq 0x88(%r14), %rsi
movq 0x90(%r14), %rax
testq %rax, %rax
je 0x184a8
cmpb $0x0, (%r13)
je 0x184a4
incl 0x8(%rax)
jmp 0x184a8
lock
incl 0x8(%rax)
movq %rax, 0x20(%rsp)
movq %r15, %rdi
callq 0x1206a
movq 0x10(%rsp), %rax
movq 0x48(%rax), %rdi
movq 0x50(%rax), %rbx
testq %rbx, %rbx
je 0x184d7
cmpb $0x0, (%r13)
je 0x184d3
incl 0x8(%rbx)
jmp 0x184d7
lock
incl 0x8(%rbx)
callq 0x24706
movq 0x8(%rax), %rbp
testq %rbx, %rbx
je 0x184ed
movq %rbx, %rdi
callq 0xb634
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x184fc
callq 0xb634
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1850b
callq 0xb634
cmpq %rbp, %r12
je 0x186a9
movq (%r12), %rdi
movq (%rdi), %rax
callq *0xc0(%rax)
testb %al, %al
je 0x186a0
movq 0x88(%r14), %rsi
movq 0x90(%r14), %rbp
testq %rbp, %rbp
je 0x1854c
cmpb $0x0, (%r13)
je 0x18548
incl 0x8(%rbp)
jmp 0x1854c
lock
incl 0x8(%rbp)
movq %r15, %rdi
callq 0x1206a
movq 0x10(%rsp), %rax
movq 0x58(%rax), %rdi
movq 0x60(%rax), %rbx
testq %rbx, %rbx
je 0x18576
cmpb $0x0, (%r13)
je 0x18572
incl 0x8(%rbx)
jmp 0x18576
lock
incl 0x8(%rbx)
movq (%r12), %rax
movq %rax, 0x38(%rsp)
movq 0x8(%r12), %rax
movq %rax, 0x40(%rsp)
testq %rax, %rax
je 0x1859e
cmpb $0x0, (%r13)
je 0x1859a
incl 0x8(%rax)
jmp 0x1859e
lock
incl 0x8(%rax)
leaq 0x38(%rsp), %rsi
callq 0x15c44
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x185b7
callq 0xb634
testq %rbx, %rbx
je 0x185c4
movq %rbx, %rdi
callq 0xb634
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x185d3
callq 0xb634
testq %rbp, %rbp
je 0x185e0
movq %rbp, %rdi
callq 0xb634
movq 0x88(%r14), %rsi
movq 0x90(%r14), %rbp
testq %rbp, %rbp
je 0x18603
cmpb $0x0, (%r13)
je 0x185ff
incl 0x8(%rbp)
jmp 0x18603
lock
incl 0x8(%rbp)
movq %r15, %rdi
callq 0x1206a
movq 0x10(%rsp), %rax
movq 0x48(%rax), %rdi
movq 0x50(%rax), %rbx
testq %rbx, %rbx
je 0x1862d
cmpb $0x0, (%r13)
je 0x18629
incl 0x8(%rbx)
jmp 0x1862d
lock
incl 0x8(%rbx)
movq (%r12), %rax
movq %rax, 0x28(%rsp)
movq 0x8(%r12), %rax
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0x18655
cmpb $0x0, (%r13)
je 0x18651
incl 0x8(%rax)
jmp 0x18655
lock
incl 0x8(%rax)
leaq 0x28(%rsp), %rsi
callq 0x2474a
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x1866e
callq 0xb634
testq %rbx, %rbx
je 0x1867b
movq %rbx, %rdi
callq 0xb634
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1868a
callq 0xb634
testq %rbp, %rbp
je 0x18485
movq %rbp, %rdi
callq 0xb634
jmp 0x18485
addq $0x10, %r12
jmp 0x18485
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x186ca
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x51f0
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x186d9
callq 0xb634
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x4, %edi
callq 0x5100
movl $0x7, (%rax)
movq 0x1b88e(%rip), %rsi     # 0x33f90
movq %rax, %rdi
xorl %edx, %edx
callq 0x5300
movl $0x4, %edi
callq 0x5100
movl $0x6, (%rax)
movq 0x1b86d(%rip), %rsi     # 0x33f90
movq %rax, %rdi
xorl %edx, %edx
callq 0x5300
movl $0x8, %ebx
jmp 0x18739
movl $0x2, %ebx
movl $0x4, %edi
callq 0x5100
movl %ebx, (%rax)
movq 0x1b844(%rip), %rsi     # 0x33f90
movq %rax, %rdi
xorl %edx, %edx
movq 0x8(%rsp), %r13
callq 0x5300
jmp 0x187d0
movq %rax, %r14
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x18772
callq 0xb634
movq 0xd8(%rsp), %rdi
cmpq %r12, %rdi
je 0x18920
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x51f0
jmp 0x18920
jmp 0x18867
jmp 0x187d0
movq %rax, %r14
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x187b1
callq 0xb634
movq 0xb8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x187fc
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x51f0
jmp 0x187fc
movq %rax, %r14
jmp 0x187fc
movq %rax, %r14
jmp 0x187ef
movq %rax, %r14
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x187ef
callq 0xb634
testq %rbx, %rbx
je 0x187fc
movq %rbx, %rdi
callq 0xb634
testq %r12, %r12
je 0x18920
movq %r12, %rdi
jmp 0x1891b
movq %rax, %r14
testq %rbx, %rbx
je 0x1881d
movq %rbx, %rdi
callq 0xb634
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x18831
callq 0xb634
jmp 0x18831
movq %rax, %r14
testq %r15, %r15
je 0x18920
movq %r15, %rdi
jmp 0x1891b
jmp 0x18910
jmp 0x1885f
movq %rax, %r14
movq %rbx, %r13
testq %rbx, %rbx
jne 0x1894b
jmp 0x18953
jmp 0x1885f
movq %rax, %r14
jmp 0x18946
movq %rax, %r14
jmp 0x18925
movq %rax, %r14
movq 0x30(%rsp), %rdi
jmp 0x18883
jmp 0x188ab
movq %rax, %r14
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x1888d
callq 0xb634
testq %rbx, %rbx
je 0x1889a
movq %rbx, %rdi
callq 0xb634
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x188ae
callq 0xb634
jmp 0x188ae
movq %rax, %r14
testq %rbp, %rbp
je 0x18920
movq %rbp, %rdi
jmp 0x1891b
movq %rax, %r14
movq 0x50(%rsp), %rdi
jmp 0x188ca
movq %rax, %r14
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x18913
callq 0xb634
jmp 0x18913
jmp 0x188d8
movq %rax, %r14
jmp 0x18920
movq %rax, %r14
jmp 0x18901
movq %rax, %r14
testq %rbx, %rbx
je 0x188f2
movq %rbx, %rdi
callq 0xb634
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x18901
callq 0xb634
cmpq $0x0, 0x20(%rsp)
je 0x18920
movq 0x20(%rsp), %rdi
jmp 0x1891b
movq %rax, %r14
testq %rbx, %rbx
je 0x18920
movq %rbx, %rdi
callq 0xb634
movq 0x8(%rsp), %r13
leaq 0xa8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x18946
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x51f0
testq %r13, %r13
je 0x18953
movq %r13, %rdi
callq 0xb634
movq %r14, %rdi
callq 0x5320
nop