// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x60(%rax)
testb %al, %al
jne 0x9bab
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
cmpl $0x1, %ebp
jne 0x9a85
movq 0x70(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0x1215c
movq 0x8(%rsp), %rsi
leaq 0x40(%rsp), %rdi
callq 0xe58e
jmp 0x9aa2
movq 0x70(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0x1215c
movq 0x8(%rsp), %rsi
leaq 0x40(%rsp), %rdi
callq 0xe5a0
leaq 0x20(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x9f0c
leaq 0x48(%rsp), %rdi
callq 0x8ea0
leaq 0x10(%rsp), %rdi
callq 0x8ea0
leaq 0x40(%rsp), %rdi
pushq $0x8
popq %rdx
movq %r14, %rsi
callq 0x52f0
leaq 0x40(%rsp), %rdi
leaq 0x1c(%rsp), %rsi
callq 0x5140
movq 0x20(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x12172
movq 0x8(%rsp), %rdi
callq 0x1b2e6
movl %eax, %ebp
movl 0x1c(%rsp), %r14d
leaq 0x10(%rsp), %rdi
callq 0x8ea0
cmpl %r14d, %ebp
jl 0x9bca
addq $0x8, %rbx
leaq 0x13cc2(%rip), %rsi     # 0x1d7e4
movq %rbx, %rdi
callq 0x8dc3
testb %al, %al
je 0x9b8b
movq 0x20(%rsp), %rsi
leaq 0x30(%rsp), %rdi
callq 0x12172
movq 0x30(%rsp), %rdi
callq 0x1b2e2
movslq 0x1c(%rsp), %rcx
movq (%rax), %rax
shlq $0x4, %rcx
leaq (%rax,%rcx), %rsi
addq $-0x10, %rsi
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x8f30
leaq 0x38(%rsp), %rdi
callq 0x8ea0
movq (%rbx), %rdi
movq (%rdi), %rax
pushq $0x1
popq %rsi
callq *0xb8(%rax)
leaq 0x10(%rsp), %rdi
callq 0x8ea0
leaq 0x40(%rsp), %rdi
callq 0x5100
leaq 0x28(%rsp), %rdi
callq 0x8ea0
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x4
popq %rdi
callq 0x5120
movl $0x1, (%rax)
movq 0x213e0(%rip), %rsi     # 0x2afa0
movq %rax, %rdi
xorl %edx, %edx
callq 0x5310
pushq $0x4
popq %rdi
callq 0x5120
movl $0x3, (%rax)
movq 0x213c1(%rip), %rsi     # 0x2afa0
movq %rax, %rdi
xorl %edx, %edx
callq 0x5310
jmp 0x9c0c
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
jmp 0x9c14
jmp 0x9c22
jmp 0x9bf9
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x8ea0
jmp 0x9c2f
jmp 0x9c1d
jmp 0x9c1d
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x8ea0
jmp 0x9c25
jmp 0x9c22
movq %rax, %rbx
jmp 0x9c2f
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x5100
leaq 0x28(%rsp), %rdi
callq 0x8ea0
movq %rbx, %rdi
callq 0x5330
nop