// File: /workspace/github_cpp_makefile_star2_O2/BohangZhang[P]Sorcery-C-Project/player.cc
// Function: Player::testing_play(int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Player::testing_play(int i, int p, string t) {
    if (getHand()->getHand().size() < i) throw 7; // Number; The card doesn't exist
    else {
        shared_ptr<Card> c = getHand()->getHand()[i - 1];
        string card_type = c->getType();
        if (card_type == "Spell") { 
            c->action(p,t);
            getHand()->pop(i);
        } else if (card_type == "Enchantment") {
            if (t == "r") throw 9; // Number; Wrong command, Enchantment can't be played on Ritual
            
            shared_ptr<Player> targetplayer {nullptr};
            if (p == 1) {targetplayer = getGame()->get1();} 
            else {targetplayer = getGame()->get2();}   
    
            int j;
            istringstream ss{t};
            ss >> j;
            shared_ptr<Minion> m = targetplayer->getSlot()->getSlot()[j - 1];
            shared_ptr<Minion> h = dynamic_pointer_cast<Minion>(c);
            h->setOrigin(m);
            targetplayer->getSlot()->getSlot()[j - 1] = h;
            getHand()->pop(i);
        } else throw 10; // Number; Wrong command, this card can't be played to a target
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rcx, %r15
movl %edx, %ebp
movl %esi, %ebx
movq %rdi, %r12
leaq 0x38(%rdi), %rsi
leaq 0xb8(%rsp), %r13
movq %r13, %rdi
movq %rsi, 0x18(%rsp)
callq 0x1a83e
movq (%r13), %rdi
callq 0x10e52
movq 0x8(%rax), %r13
subq (%rax), %r13
sarq $0x4, %r13
movl %ebx, %r14d
movslq %ebx, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x8ea0
cmpq %rbx, %r13
jb 0x13a0b
leaq 0xb8(%rsp), %r13
movq %r13, %rdi
movq 0x18(%rsp), %rsi
callq 0x1a83e
movq (%r13), %rdi
callq 0x10e52
movq (%rax), %rax
shlq $0x4, %rbx
leaq (%rax,%rbx), %rsi
addq $-0x10, %rsi
leaq 0x58(%rsp), %r13
movq %r13, %rdi
callq 0xb86e
leaq 0xc0(%rsp), %rdi
callq 0x8ea0
movq (%r13), %rsi
leaq 0x78(%rsp), %rdi
callq 0xb3f4
leaq 0xa0c2(%rip), %rsi      # 0x1d84a
leaq 0x78(%rsp), %rdi
callq 0x8dc3
testb %al, %al
je 0x137f9
movq 0x58(%rsp), %r12
leaq 0x98(%rsp), %rdi
movq %r15, %rsi
callq 0x5290
movq (%r12), %rax
leaq 0x98(%rsp), %rdx
movq %r12, %rdi
movl %ebp, %esi
callq *0x48(%rax)
leaq 0x98(%rsp), %rdi
callq 0x5378
leaq 0xb8(%rsp), %r15
movq %r15, %rdi
movq 0x18(%rsp), %rsi
callq 0x1a83e
movq (%r15), %rdi
movl %r14d, %esi
callq 0x10e84
leaq 0xc0(%rsp), %rdi
jmp 0x139e0
leaq 0xafd4(%rip), %rsi      # 0x1e7d4
leaq 0x78(%rsp), %rdi
callq 0x8dc3
testb %al, %al
je 0x13a2a
leaq 0x9fdb(%rip), %rsi      # 0x1d7f4
movq %r15, %rdi
callq 0x8dc3
testb %al, %al
jne 0x13a2e
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
addq $0x88, %r12
leaq 0x8(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
cmpl $0x1, %ebp
jne 0x13860
callq 0x8f1c
movq (%r13), %rsi
leaq 0xb8(%rsp), %rdi
callq 0xe58e
jmp 0x13876
callq 0x8f1c
movq (%r13), %rsi
leaq 0xb8(%rsp), %rdi
callq 0xe5a0
leaq 0x20(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x9f0c
leaq 0xc0(%rsp), %rdi
callq 0x8ea0
leaq 0x10(%rsp), %rdi
callq 0x8ea0
leaq 0xb8(%rsp), %rdi
pushq $0x8
popq %rdx
movq %r15, %rsi
callq 0x52f0
leaq 0xb8(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x5140
movq 0x20(%rsp), %rsi
addq $0x48, %rsi
leaq 0x38(%rsp), %r15
movq %r15, %rdi
callq 0x1a802
movq (%r15), %rdi
callq 0x1b2e2
movslq 0x4(%rsp), %rcx
movq (%rax), %rax
shlq $0x4, %rcx
leaq (%rax,%rcx), %rsi
addq $-0x10, %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x8f30
leaq 0x40(%rsp), %rdi
callq 0x8ea0
leaq 0x38(%rsp), %r12
leaq 0x58(%rsp), %rsi
movq %r12, %rdi
callq 0x1a7ac
movq (%r12), %r12
leaq 0x68(%rsp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x8f30
movq (%r12), %rax
movq %r12, %rdi
movq %r13, %rsi
callq *0xf8(%rax)
leaq 0x70(%rsp), %rdi
callq 0x8ea0
movq 0x20(%rsp), %rsi
addq $0x48, %rsi
leaq 0x48(%rsp), %r15
movq %r15, %rdi
callq 0x1a802
movq (%r15), %rdi
callq 0x1b2e2
movslq 0x4(%rsp), %rcx
movq (%rax), %rax
shlq $0x4, %rcx
leaq (%rax,%rcx), %rdi
addq $-0x10, %rdi
leaq 0x38(%rsp), %rsi
callq 0xb89e
leaq 0x50(%rsp), %rdi
callq 0x8ea0
leaq 0x48(%rsp), %r15
movq %r15, %rdi
movq 0x18(%rsp), %rsi
callq 0x1a83e
movq (%r15), %rdi
movl %r14d, %esi
callq 0x10e84
leaq 0x50(%rsp), %rdi
callq 0x8ea0
leaq 0x40(%rsp), %rdi
callq 0x8ea0
leaq 0x10(%rsp), %rdi
callq 0x8ea0
leaq 0xb8(%rsp), %rdi
callq 0x5100
leaq 0x28(%rsp), %rdi
callq 0x8ea0
leaq 0x78(%rsp), %rdi
callq 0x5378
leaq 0x60(%rsp), %rdi
callq 0x8ea0
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x4
popq %rdi
callq 0x5120
movl $0x7, (%rax)
movq 0x17580(%rip), %rsi     # 0x2afa0
movq %rax, %rdi
xorl %edx, %edx
callq 0x5310
pushq $0xa
jmp 0x13a30
pushq $0x9
popq %rbx
pushq $0x4
popq %rdi
callq 0x5120
movl %ebx, (%rax)
movq 0x1755e(%rip), %rsi     # 0x2afa0
movq %rax, %rdi
xorl %edx, %edx
callq 0x5310
jmp 0x13a4e
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x8ea0
jmp 0x13aa6
jmp 0x13a5f
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
jmp 0x13a71
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x8ea0
leaq 0x40(%rsp), %rdi
callq 0x8ea0
leaq 0x10(%rsp), %rdi
jmp 0x13a8f
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x8ea0
jmp 0x13a99
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x5100
leaq 0x28(%rsp), %rdi
callq 0x8ea0
jmp 0x13aed
movq %rax, %rbx
jmp 0x13aa6
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
jmp 0x13aab
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x5378
jmp 0x13aed
movq %rax, %rbx
jmp 0x13af7
jmp 0x13add
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
jmp 0x13afc
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x5378
leaq 0x60(%rsp), %rdi
callq 0x8ea0
movq %rbx, %rdi
callq 0x5330
nop