// File: /workspace/github_cpp_makefile_star2_O3/BohangZhang[P]Sorcery-C-Project/act_minion.cc
// Function: Act_Minion::use(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Act_Minion::use(int p, string t) {
    if (getSilent()) throw 1;//Number; The minion has been silented
    // use(int, "r"), bonus part if we want to add an action attacking the Ritual card
    shared_ptr<Player> targetplayer = nullptr;
    if (p == 1) {
        targetplayer = this->master->getGame()->get1();
    } else {
        targetplayer = this->master->getGame()->get2();
    }
    
    /*if (t == "r") {
        if (targetplayer->isRitualEmpty()) {
            throw 1; // You haven't played a Ritual card!
        }
        if (name == "Banish") {
            targetplayer->getRitual() = nullptr;
        } else {
            throw 4; // The Spell cannot be played upon a Ritual!
        }
    } else {
    */
    int j;
    istringstream ss{t};
    ss >> j;
    
    if (targetplayer->getSlot()->getSize() < j) throw 3; // The target Minion DNE!
    if (name == "Novice Pyromancer") {
        shared_ptr<Minion> m = targetplayer->getSlot()->getSlot()[j-1];
        m->subDefense(1);    
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdx, %r12
movl %esi, %ebx
movq %rdi, %r14
movq (%rdi), %rax
callq *0x60(%rax)
testb %al, %al
jne 0xc444
cmpl $0x1, %ebx
jne 0xc2e7
movq 0x70(%r14), %rsi
leaq 0x8(%rsp), %rdi
callq 0x17a62
movq 0x8(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x11e6a
jmp 0xc304
movq 0x70(%r14), %rsi
leaq 0x8(%rsp), %rdi
callq 0x17a62
movq 0x8(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x11e96
movq 0x20(%rsp), %r15
movq 0x28(%rsp), %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xc325
callq 0xb478
leaq 0x20(%rsp), %rdi
movq %r12, %rsi
movl $0x8, %edx
callq 0x52e0
leaq 0x20(%rsp), %rdi
leaq 0x1c(%rsp), %rsi
callq 0x5130
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x17a94
movq 0x8(%rsp), %rdi
callq 0x243da
movl %eax, %ebp
movl 0x1c(%rsp), %r12d
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xc373
callq 0xb478
cmpl %r12d, %ebp
jl 0xc465
addq $0x8, %r14
leaq 0x1a4fb(%rip), %rsi     # 0x26882
movq %r14, %rdi
callq 0x50a0
testl %eax, %eax
jne 0xc409
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x17a94
movq 0x8(%rsp), %rdi
callq 0x243d6
movslq 0x1c(%rsp), %rcx
movq (%rax), %rax
shlq $0x4, %rcx
movq -0x10(%rax,%rcx), %r14
movq -0x8(%rax,%rcx), %r15
testq %r15, %r15
je 0xc3dc
movq 0x26bf4(%rip), %rax     # 0x32fc0
cmpb $0x0, (%rax)
je 0xc3d7
incl 0x8(%r15)
jmp 0xc3dc
lock
incl 0x8(%r15)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xc3eb
callq 0xb478
movq (%r14), %rax
movq %r14, %rdi
movl $0x1, %esi
callq *0xb8(%rax)
testq %r15, %r15
je 0xc409
movq %r15, %rdi
callq 0xb478
movq 0x26ba0(%rip), %rsi     # 0x32fb0
leaq 0x20(%rsp), %rdi
callq 0x5280
leaq 0x98(%rsp), %rdi
callq 0x50b0
testq %rbx, %rbx
je 0xc434
movq %rbx, %rdi
callq 0xb478
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x4, %edi
callq 0x5100
movl $0x1, (%rax)
movq 0x26b35(%rip), %rsi     # 0x32f90
movq %rax, %rdi
xorl %edx, %edx
callq 0x5300
movl $0x4, %edi
callq 0x5100
movl $0x3, (%rax)
movq 0x26b14(%rip), %rsi     # 0x32f90
movq %rax, %rdi
xorl %edx, %edx
callq 0x5300
movq %rax, %r14
testq %r15, %r15
je 0xc4cd
movq %r15, %rdi
jmp 0xc4bc
jmp 0xc4af
jmp 0xc4ca
jmp 0xc499
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
jne 0xc4f3
jmp 0xc4f8
jmp 0xc4aa
movq %rax, %r14
jmp 0xc4f8
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xc4cd
callq 0xb478
jmp 0xc4cd
jmp 0xc4ca
movq %rax, %r14
jmp 0xc4eb
movq %rax, %r14
movq 0x26adc(%rip), %rsi     # 0x32fb0
leaq 0x20(%rsp), %rdi
callq 0x5280
leaq 0x98(%rsp), %rdi
callq 0x50b0
testq %rbx, %rbx
je 0xc4f8
movq %rbx, %rdi
callq 0xb478
movq %r14, %rdi
callq 0x5320