// File: 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
movq %rsp, %rbp
subq $0x3a0, %rsp            # imm = 0x3A0
movq %rcx, -0x300(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq -0x8(%rbp), %rsi
movq %rsi, -0x2f8(%rbp)
leaq -0x28(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
callq 0x2a770
movq -0x2f0(%rbp), %rdi
callq 0x12e10
movq %rax, %rdi
callq 0x278e0
movq %rax, -0x2e8(%rbp)
jmp 0x2d038
movq -0x2e8(%rbp), %rdi
callq 0x1d510
movq %rax, -0x308(%rbp)
movslq -0xc(%rbp), %rax
movq %rax, -0x310(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x12e30
movq -0x310(%rbp), %rcx
movq -0x308(%rbp), %rax
cmpq %rcx, %rax
jae 0x2d0af
movl $0x4, %edi
callq 0x6160
movq %rax, %rdi
movl $0x7, (%rdi)
movq 0x26f0c(%rip), %rsi     # 0x53f98
xorl %eax, %eax
movl %eax, %edx
callq 0x6430
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x12e30
jmp 0x2d703
movq -0x2f8(%rbp), %rsi
leaq -0x58(%rbp), %rdi
movq %rdi, -0x320(%rbp)
callq 0x2a770
movq -0x320(%rbp), %rdi
callq 0x12e10
movq %rax, %rdi
callq 0x278e0
movq %rax, -0x318(%rbp)
jmp 0x2d0e3
movq -0x318(%rbp), %rdi
movl -0xc(%rbp), %eax
decl %eax
movslq %eax, %rsi
callq 0x287a0
movq %rax, %rsi
leaq -0x48(%rbp), %rdi
movq %rdi, -0x328(%rbp)
callq 0x1a1f0
leaq -0x58(%rbp), %rdi
callq 0x12e30
movq -0x328(%rbp), %rdi
callq 0x15c20
movq %rax, %rsi
leaq -0x78(%rbp), %rdi
callq 0x19c20
jmp 0x2d12d
leaq 0x13716(%rip), %rsi     # 0x4084a
leaq -0x78(%rbp), %rdi
callq 0x12920
movb %al, -0x329(%rbp)
jmp 0x2d145
movb -0x329(%rbp), %al
testb $0x1, %al
jne 0x2d154
jmp 0x2d267
leaq -0x48(%rbp), %rdi
callq 0x15c20
movq -0x300(%rbp), %rsi
movq %rax, -0x338(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x330(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x6100
jmp 0x2d182
movl -0x330(%rbp), %esi
movq -0x338(%rbp), %rdi
movq (%rdi), %rax
movq 0x48(%rax), %rax
leaq -0x98(%rbp), %rdx
callq *%rax
jmp 0x2d1a1
leaq -0x98(%rbp), %rdi
callq 0x64c8
movq -0x2f8(%rbp), %rsi
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x340(%rbp)
callq 0x2a770
movq -0x340(%rbp), %rdi
callq 0x12e10
movq %rax, %rdi
movl -0xc(%rbp), %esi
callq 0x27990
jmp 0x2d1e0
leaq -0xa8(%rbp), %rdi
callq 0x12e30
jmp 0x2d6d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x12e30
jmp 0x2d703
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2d6ef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2d6e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x64c8
jmp 0x2d6e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x12e30
jmp 0x2d6e6
leaq 0x14566(%rip), %rsi     # 0x417d4
leaq -0x78(%rbp), %rdi
callq 0x12920
movb %al, -0x341(%rbp)
jmp 0x2d27f
movb -0x341(%rbp), %al
testb $0x1, %al
jne 0x2d28e
jmp 0x2d6ab
movq -0x300(%rbp), %rdi
leaq 0x13558(%rip), %rsi     # 0x407f4
callq 0x12920
movb %al, -0x342(%rbp)
jmp 0x2d2a9
movb -0x342(%rbp), %al
testb $0x1, %al
jne 0x2d2b5
jmp 0x2d2dd
movl $0x4, %edi
callq 0x6160
movq %rax, %rdi
movl $0x9, (%rdi)
movq 0x26cc9(%rip), %rsi     # 0x53f98
xorl %eax, %eax
movl %eax, %edx
callq 0x6430
jmp 0x2d70c
leaq -0xb8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x15c60
cmpl $0x1, -0x10(%rbp)
jne 0x2d37b
movq -0x2f8(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
movq %rdi, -0x350(%rbp)
callq 0x2a670
movq -0x350(%rbp), %rdi
callq 0x12a20
movq %rax, %rsi
leaq -0xc8(%rbp), %rdi
callq 0x22940
jmp 0x2d32e
leaq -0xb8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x15c80
leaq -0xc8(%rbp), %rdi
callq 0x12a00
leaq -0xd8(%rbp), %rdi
callq 0x12a70
jmp 0x2d3fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x12a70
jmp 0x2d69d
movq -0x2f8(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
movq %rdi, -0x358(%rbp)
callq 0x2a670
movq -0x358(%rbp), %rdi
callq 0x12a20
movq %rax, %rsi
leaq -0xe8(%rbp), %rdi
callq 0x22970
jmp 0x2d3b2
leaq -0xb8(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x15c80
leaq -0xe8(%rbp), %rdi
callq 0x12a00
leaq -0xf8(%rbp), %rdi
callq 0x12a70
jmp 0x2d3fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x12a70
jmp 0x2d69d
movq -0x300(%rbp), %rsi
leaq -0x280(%rbp), %rdi
movl $0x8, %edx
callq 0x6410
jmp 0x2d416
leaq -0x280(%rbp), %rdi
leaq -0xfc(%rbp), %rsi
callq 0x61a0
jmp 0x2d42b
leaq -0xb8(%rbp), %rdi
callq 0x12980
movq %rax, %rsi
leaq -0x2a0(%rbp), %rdi
movq %rdi, -0x368(%rbp)
callq 0x2a6b0
movq -0x368(%rbp), %rdi
callq 0x12af0
movq %rax, %rdi
callq 0x3d220
movq %rax, -0x360(%rbp)
jmp 0x2d46a
movq -0x360(%rbp), %rdi
movl -0xfc(%rbp), %eax
decl %eax
movslq %eax, %rsi
callq 0x12c80
movq %rax, %rsi
leaq -0x290(%rbp), %rdi
movq %rdi, -0x380(%rbp)
callq 0x12c10
leaq -0x2a0(%rbp), %rdi
callq 0x12b30
leaq -0x2b0(%rbp), %rdi
movq %rdi, -0x388(%rbp)
leaq -0x48(%rbp), %rsi
callq 0x3ad20
movq -0x388(%rbp), %rdi
callq 0x12d30
movq -0x380(%rbp), %rsi
movq %rax, -0x378(%rbp)
leaq -0x2c0(%rbp), %rdi
movq %rdi, -0x370(%rbp)
callq 0x12c10
movq -0x378(%rbp), %rdi
movq -0x370(%rbp), %rsi
movq (%rdi), %rax
movq 0xf8(%rax), %rax
callq *%rax
jmp 0x2d503
leaq -0x2c0(%rbp), %rdi
callq 0x12d50
leaq -0xb8(%rbp), %rdi
callq 0x12980
movq %rax, %rsi
leaq -0x2d0(%rbp), %rdi
movq %rdi, -0x398(%rbp)
callq 0x2a6b0
movq -0x398(%rbp), %rdi
callq 0x12af0
movq %rax, %rdi
callq 0x3d220
movq %rax, -0x390(%rbp)
jmp 0x2d54e
movq -0x390(%rbp), %rdi
movl -0xfc(%rbp), %eax
decl %eax
movslq %eax, %rsi
callq 0x12c80
movq %rax, %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x1a4f0
leaq -0x2d0(%rbp), %rdi
callq 0x12b30
movq -0x2f8(%rbp), %rsi
leaq -0x2e0(%rbp), %rdi
movq %rdi, -0x3a0(%rbp)
callq 0x2a770
movq -0x3a0(%rbp), %rdi
callq 0x12e10
movq %rax, %rdi
movl -0xc(%rbp), %esi
callq 0x27990
jmp 0x2d5b3
leaq -0x2e0(%rbp), %rdi
callq 0x12e30
leaq -0x2b0(%rbp), %rdi
callq 0x12d50
leaq -0x290(%rbp), %rdi
callq 0x12d50
leaq -0x280(%rbp), %rdi
callq 0x6150
leaq -0xb8(%rbp), %rdi
callq 0x12a00
jmp 0x2d6d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2d69d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x2d691
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x12b30
jmp 0x2d691
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x2c0(%rbp), %rdi
callq 0x12d50
jmp 0x2d679
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0x12b30
jmp 0x2d679
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x2e0(%rbp), %rdi
callq 0x12e30
leaq -0x2b0(%rbp), %rdi
callq 0x12d50
leaq -0x290(%rbp), %rdi
callq 0x12d50
leaq -0x280(%rbp), %rdi
callq 0x6150
leaq -0xb8(%rbp), %rdi
callq 0x12a00
jmp 0x2d6e6
movl $0x4, %edi
callq 0x6160
movq %rax, %rdi
movl $0xa, (%rdi)
movq 0x268d3(%rip), %rsi     # 0x53f98
xorl %eax, %eax
movl %eax, %edx
callq 0x6430
jmp 0x2d70c
jmp 0x2d6d2
leaq -0x78(%rbp), %rdi
callq 0x64c8
leaq -0x48(%rbp), %rdi
callq 0x15c40
jmp 0x2d6fa
leaq -0x78(%rbp), %rdi
callq 0x64c8
leaq -0x48(%rbp), %rdi
callq 0x15c40
jmp 0x2d703
addq $0x3a0, %rsp            # imm = 0x3A0
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x6460
nopl (%rax)