// File: /workspace/github_cpp_makefile_star2_O3/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 $0x208, %rsp            # imm = 0x208
movq %rcx, %r13
movl %edx, 0x10(%rsp)
movl %esi, %ebp
movq %rdi, %r14
movq 0x38(%rdi), %rdi
movq 0x40(%r14), %rbx
testq %rbx, %rbx
je 0x199c9
movq 0x19605(%rip), %rax     # 0x32fc0
cmpb $0x0, (%rax)
je 0x199c5
incl 0x8(%rbx)
jmp 0x199c9
lock
incl 0x8(%rbx)
callq 0x15f86
movq 0x8(%rax), %r12
subq (%rax), %r12
sarq $0x4, %r12
movl %ebp, 0x18(%rsp)
movslq %ebp, %r15
testq %rbx, %rbx
je 0x199ed
movq %rbx, %rdi
callq 0xb478
cmpq %r15, %r12
jb 0x19e31
movq 0x38(%r14), %rdi
movq 0x40(%r14), %rbp
testq %rbp, %rbp
je 0x19a18
movq 0x195b6(%rip), %rax     # 0x32fc0
cmpb $0x0, (%rax)
je 0x19a14
incl 0x8(%rbp)
jmp 0x19a18
lock
incl 0x8(%rbp)
callq 0x15f86
movq (%rax), %rax
shlq $0x4, %r15
movq -0x10(%rax,%r15), %r12
movq -0x8(%rax,%r15), %r15
testq %r15, %r15
je 0x19a4a
movq 0x19586(%rip), %rax     # 0x32fc0
cmpb $0x0, (%rax)
je 0x19a45
incl 0x8(%r15)
jmp 0x19a4a
lock
incl 0x8(%r15)
testq %rbp, %rbp
je 0x19a57
movq %rbp, %rdi
callq 0xb478
leaq 0x60(%rsp), %rdi
movq %r12, %rsi
callq 0xe5f6
leaq 0xce7d(%rip), %rsi      # 0x268e8
leaq 0x60(%rsp), %rdi
callq 0x50a0
testl %eax, %eax
je 0x19ae8
leaq 0xddf2(%rip), %rsi      # 0x27872
leaq 0x60(%rsp), %rdi
callq 0x50a0
testl %eax, %eax
jne 0x19e52
leaq 0xcdf9(%rip), %rsi      # 0x26892
movq %r13, %rdi
callq 0x50a0
testl %eax, %eax
je 0x19e59
cmpl $0x1, 0x10(%rsp)
movq %r15, 0x8(%rsp)
jne 0x19b4e
movq 0x88(%r14), %rsi
movq 0x90(%r14), %rbp
testq %rbp, %rbp
je 0x19b88
movq 0x194e9(%rip), %rax     # 0x32fc0
cmpb $0x0, (%rax)
je 0x19b84
incl 0x8(%rbp)
jmp 0x19b88
leaq 0x50(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq 0x40(%rsp), %rdi
callq 0xb4e8
movq (%r12), %rax
leaq 0x40(%rsp), %rdx
movq %r12, %rdi
movl 0x10(%rsp), %esi
callq *0x48(%rax)
movq 0x40(%rsp), %rdi
cmpq %rbx, %rdi
je 0x19b30
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x51f0
movq 0x38(%r14), %rdi
movq 0x40(%r14), %rbx
testq %rbx, %rbx
je 0x19b76
movq 0x1947c(%rip), %rax     # 0x32fc0
cmpb $0x0, (%rax)
je 0x19b72
incl 0x8(%rbx)
jmp 0x19b76
movq 0x88(%r14), %rsi
movq 0x90(%r14), %rbp
testq %rbp, %rbp
je 0x19b9b
movq 0x19458(%rip), %rax     # 0x32fc0
cmpb $0x0, (%rax)
je 0x19b97
incl 0x8(%rbp)
jmp 0x19b9b
lock
incl 0x8(%rbx)
movl 0x18(%rsp), %esi
callq 0x15fb8
jmp 0x19dea
lock
incl 0x8(%rbp)
leaq 0x80(%rsp), %rdi
callq 0x11e6a
jmp 0x19ba8
lock
incl 0x8(%rbp)
leaq 0x80(%rsp), %rdi
callq 0x11e96
movq 0x80(%rsp), %rbx
movq 0x88(%rsp), %rax
movq %rax, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
testq %rbp, %rbp
je 0x19bd5
movq %rbp, %rdi
callq 0xb478
leaq 0x80(%rsp), %rdi
movq %r13, %rsi
movl $0x8, %edx
callq 0x52e0
leaq 0x80(%rsp), %rdi
leaq 0x1c(%rsp), %rsi
callq 0x5130
movq 0x48(%rbx), %rdi
movq 0x50(%rbx), %rbp
testq %rbp, %rbp
je 0x19c1e
movq 0x193b0(%rip), %rax     # 0x32fc0
cmpb $0x0, (%rax)
je 0x19c1a
incl 0x8(%rbp)
jmp 0x19c1e
lock
incl 0x8(%rbp)
callq 0x243d6
movslq 0x1c(%rsp), %rcx
movq (%rax), %rax
shlq $0x4, %rcx
movq -0x10(%rax,%rcx), %r15
movq -0x8(%rax,%rcx), %r13
testq %r13, %r13
je 0x19c55
movq 0x1937b(%rip), %rax     # 0x32fc0
cmpb $0x0, (%rax)
je 0x19c50
incl 0x8(%r13)
jmp 0x19c55
lock
incl 0x8(%r13)
testq %rbp, %rbp
je 0x19c62
movq %rbp, %rdi
callq 0xb478
leaq 0x18447(%rip), %rsi     # 0x320b0
leaq 0x18d28(%rip), %rdx     # 0x32998
movq %r12, %rdi
xorl %ecx, %ecx
callq 0x5220
testq %rax, %rax
je 0x19ca9
movq %rax, 0x20(%rsp)
movq 0x8(%rsp), %rcx
movq %rcx, 0x28(%rsp)
testq %rcx, %rcx
je 0x19cc3
movq 0x19326(%rip), %rcx     # 0x32fc0
cmpb $0x0, (%rcx)
je 0x19cb5
movq 0x8(%rsp), %rcx
incl 0x8(%rcx)
jmp 0x19cc3
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
xorl %eax, %eax
jmp 0x19cc3
movq 0x8(%rsp), %rax
lock
incl 0x8(%rax)
movq 0x20(%rsp), %rax
movq %r15, 0x30(%rsp)
movq %r13, 0x38(%rsp)
testq %r13, %r13
movq 0x8(%rsp), %r15
je 0x19cee
movq 0x192e2(%rip), %rcx     # 0x32fc0
cmpb $0x0, (%rcx)
je 0x19ce9
incl 0x8(%r13)
jmp 0x19cee
lock
incl 0x8(%r13)
movq (%rax), %rcx
leaq 0x30(%rsp), %rsi
movq %rax, %rdi
callq *0xf8(%rcx)
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x19d0e
callq 0xb478
movq 0x48(%rbx), %rdi
movq 0x50(%rbx), %r12
testq %r12, %r12
je 0x19d34
movq 0x1929e(%rip), %rax     # 0x32fc0
cmpb $0x0, (%rax)
je 0x19d2e
incl 0x8(%r12)
jmp 0x19d34
lock
incl 0x8(%r12)
callq 0x243d6
movslq 0x1c(%rsp), %rcx
movq (%rax), %rax
shlq $0x4, %rcx
leaq 0x28(%rsp), %rsi
movq -0x8(%rsi), %rdx
leaq (%rax,%rcx), %rdi
addq $-0x8, %rdi
movq %rdx, -0x8(%rdi)
callq 0xe6ba
testq %r12, %r12
je 0x19d6c
movq %r12, %rdi
callq 0xb478
movq 0x38(%r14), %rdi
movq 0x40(%r14), %r12
testq %r12, %r12
je 0x19d92
movq 0x19240(%rip), %rax     # 0x32fc0
cmpb $0x0, (%rax)
je 0x19d8c
incl 0x8(%r12)
jmp 0x19d92
lock
incl 0x8(%r12)
movl 0x18(%rsp), %esi
callq 0x15fb8
testq %r12, %r12
je 0x19da8
movq %r12, %rdi
callq 0xb478
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x19db7
callq 0xb478
testq %r13, %r13
movq 0x10(%rsp), %rbx
je 0x19dc9
movq %r13, %rdi
callq 0xb478
movq 0x191e0(%rip), %rsi     # 0x32fb0
leaq 0x80(%rsp), %rdi
callq 0x5280
leaq 0xf8(%rsp), %rdi
callq 0x50b0
testq %rbx, %rbx
je 0x19df7
movq %rbx, %rdi
callq 0xb478
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19e12
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x51f0
testq %r15, %r15
je 0x19e1f
movq %r15, %rdi
callq 0xb478
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x4, %edi
callq 0x5100
movl $0x7, (%rax)
movq 0x19148(%rip), %rsi     # 0x32f90
movq %rax, %rdi
xorl %edx, %edx
callq 0x5300
movl $0xa, %ebx
jmp 0x19e5e
movl $0x9, %ebx
movl $0x4, %edi
callq 0x5100
movl %ebx, (%rax)
movq 0x1911f(%rip), %rsi     # 0x32f90
movq %rax, %rdi
xorl %edx, %edx
callq 0x5300
jmp 0x19e7d
movq %rax, %r14
testq %rbp, %rbp
je 0x19f82
movq %rbp, %rdi
jmp 0x19f4a
movq %r15, 0x8(%rsp)
movq %rax, %r14
testq %rbx, %rbx
je 0x19f82
movq %rbx, %rdi
jmp 0x19f4a
movq %r15, 0x8(%rsp)
movq %rax, %r14
movq 0x40(%rsp), %rdi
cmpq %rbx, %rdi
je 0x19f82
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x51f0
jmp 0x19f82
jmp 0x19ed4
movq %rax, %r14
jmp 0x19ee1
movq %rax, %r14
movq 0x38(%rsp), %r12
testq %r12, %r12
je 0x19eee
movq %r12, %rdi
callq 0xb478
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x19efd
callq 0xb478
testq %r13, %r13
je 0x19f1c
movq %r13, %rdi
jmp 0x19f12
movq %rax, %r14
testq %rbp, %rbp
je 0x19f1c
movq %rbp, %rdi
callq 0xb478
jmp 0x19f1c
movq %rax, %r14
movq 0x1908d(%rip), %rsi     # 0x32fb0
leaq 0x80(%rsp), %rdi
callq 0x5280
leaq 0xf8(%rsp), %rdi
callq 0x50b0
cmpq $0x0, 0x10(%rsp)
je 0x19f82
movq 0x10(%rsp), %rdi
callq 0xb478
jmp 0x19f82
movq %rax, %r14
jmp 0x19f3d
movq %r15, 0x8(%rsp)
movq %rax, %r14
jmp 0x19f9d
movq %rax, %r14
testq %rbp, %rbp
je 0x19faf
movq %rbp, %rdi
jmp 0x19faa
movq %rax, %r14
testq %rbx, %rbx
je 0x19faf
movq %rbx, %rdi
jmp 0x19faa
movq %r15, 0x8(%rsp)
movq %rax, %r14
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x19f9d
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x51f0
cmpq $0x0, 0x8(%rsp)
je 0x19faf
movq 0x8(%rsp), %rdi
callq 0xb478
movq %r14, %rdi
callq 0x5320
nop