// File: /workspace/github_cpp_makefile_star2_O2/BohangZhang[P]Sorcery-C-Project/spell.cc
// Function: Spell::action()
void Spell::action() {
    if (name == "Recharge") {
        if (this->master->isRitualEmpty()) {
            throw 15; // You haven't played a Ritual card!
        } else {
            this->master->getRitual()->addCharge(3);
        }
        return;
    }
    if (name == "Blizzard") {
        for (auto it = this->master->getSlot()->getSlot().begin(); it != this->master->getSlot()->getSlot().end(); ++it) {
            (*it)->subDefense(2);
        }
        for (auto it = this->master->getGame()->getNoncurrent()->getSlot()->getSlot().begin(); 
             it != this->master->getGame()->getNoncurrent()->getSlot()->getSlot().end(); ++it) {
            (*it)->subDefense(2);
        }
        return;
    }
    if (name == "Raise Dead") {
        if (this->master->isGraveyardEmpty()) {
            throw 16; // Your Graveyard is empty!
        } else {
            shared_ptr<Minion> p = this->master->getGraveyard()->top();
            if (this->master->isSlotFull()) {
                throw 2; // You have already own 5 Minions!
            } else {
                this->master->getGraveyard()->popfirst();
                this->master->getSlot()->push(p);
            }
        }
        return;
    }
    throw 10; // You use the wrong command
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq 0x8(%rdi), %r14
leaq 0x3843(%rip), %rsi      # 0x1eca1
movq %r14, %rdi
callq 0x8dc3
testb %al, %al
je 0x1b49c
movq 0x70(%rbx), %rdi
callq 0x1224e
testb %al, %al
jne 0x1b6db
movq 0x70(%rbx), %rsi
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x1214a
movq (%rbx), %rdi
pushq $0x3
popq %rsi
callq 0x1afd8
jmp 0x1b5e9
leaq 0x3807(%rip), %rsi      # 0x1ecaa
movq %r14, %rdi
callq 0x8dc3
testb %al, %al
je 0x1b522
movq 0x70(%rbx), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x12172
movq (%r14), %rdi
callq 0x1b2e2
movq (%rax), %r12
leaq 0x10(%rsp), %rdi
callq 0x8ea0
leaq 0x10(%rsp), %r14
leaq 0x8(%rsp), %r15
pushq $0x2
popq %rbp
movq 0x70(%rbx), %rsi
movq %r15, %rdi
callq 0x12172
movq 0x8(%rsp), %rdi
callq 0x1b2e2
movq 0x8(%rax), %r13
movq %r14, %rdi
callq 0x8ea0
cmpq %r13, %r12
je 0x1b602
movq (%r12), %rdi
movq (%rdi), %rax
movl %ebp, %esi
callq *0xb8(%rax)
addq $0x10, %r12
jmp 0x1b4e2
leaq 0x378a(%rip), %rsi      # 0x1ecb3
movq %r14, %rdi
callq 0x8dc3
testb %al, %al
je 0x1b6eb
movq 0x70(%rbx), %rdi
callq 0x12244
testb %al, %al
jne 0x1b6fb
movq 0x70(%rbx), %rsi
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x12184
movq (%r14), %rsi
leaq 0x8(%rsp), %rdi
callq 0x10b04
leaq 0x20(%rsp), %rdi
callq 0x8ea0
movq 0x70(%rbx), %rdi
callq 0x12230
testb %al, %al
jne 0x1b71a
movq 0x70(%rbx), %rsi
leaq 0x18(%rsp), %rdi
callq 0x12184
movq 0x18(%rsp), %rdi
callq 0x10db2
leaq 0x20(%rsp), %rdi
callq 0x8ea0
movq 0x70(%rbx), %rsi
leaq 0x18(%rsp), %rdi
callq 0x12172
movq 0x18(%rsp), %rbx
leaq 0x38(%rsp), %r14
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x8f30
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1b320
leaq 0x40(%rsp), %rdi
callq 0x8ea0
leaq 0x20(%rsp), %rdi
callq 0x8ea0
leaq 0x10(%rsp), %rdi
callq 0x8ea0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x70(%rbx), %rsi
leaq 0x28(%rsp), %r14
movq %r14, %rdi
callq 0x1215c
movq (%r14), %rsi
leaq 0x18(%rsp), %rdi
callq 0xe57c
movq 0x18(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x12172
movq 0x8(%rsp), %rdi
callq 0x1b2e2
movq (%rax), %r12
leaq 0x10(%rsp), %rdi
callq 0x8ea0
leaq 0x20(%rsp), %rdi
callq 0x8ea0
leaq 0x30(%rsp), %rdi
callq 0x8ea0
leaq 0x18(%rsp), %rbp
leaq 0x8(%rsp), %r14
pushq $0x2
popq %r15
movq 0x70(%rbx), %rsi
leaq 0x28(%rsp), %rdi
callq 0x1215c
movq 0x28(%rsp), %rsi
movq %rbp, %rdi
callq 0xe57c
movq 0x18(%rsp), %rsi
movq %r14, %rdi
callq 0x12172
movq 0x8(%rsp), %rdi
callq 0x1b2e2
movq 0x8(%rax), %r13
leaq 0x10(%rsp), %rdi
callq 0x8ea0
leaq 0x20(%rsp), %rdi
callq 0x8ea0
leaq 0x30(%rsp), %rdi
callq 0x8ea0
cmpq %r13, %r12
je 0x1b5f3
movq (%r12), %rdi
movq (%rdi), %rax
movl %r15d, %esi
callq *0xb8(%rax)
addq $0x10, %r12
jmp 0x1b668
pushq $0x4
popq %rdi
callq 0x5120
movl $0xf, (%rax)
jmp 0x1b709
pushq $0x4
popq %rdi
callq 0x5120
movl $0xa, (%rax)
jmp 0x1b709
pushq $0x4
popq %rdi
callq 0x5120
movl $0x10, (%rax)
movq 0xf890(%rip), %rsi      # 0x2afa0
movq %rax, %rdi
xorl %edx, %edx
callq 0x5310
pushq $0x4
popq %rdi
callq 0x5120
movl $0x2, (%rax)
movq 0xf871(%rip), %rsi      # 0x2afa0
movq %rax, %rdi
xorl %edx, %edx
callq 0x5310
jmp 0x1b783
jmp 0x1b77e
jmp 0x1b779
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x8ea0
jmp 0x1b753
jmp 0x1b76f
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x8ea0
jmp 0x1b772
jmp 0x1b76f
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
jmp 0x1b7a7
jmp 0x1b76f
jmp 0x1b76f
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
jmp 0x1b7a7
movq %rax, %rbx
jmp 0x1b79a
movq %rax, %rbx
jmp 0x1b790
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x8ea0
leaq 0x20(%rsp), %rdi
callq 0x8ea0
leaq 0x30(%rsp), %rdi
jmp 0x1b7a7
movq %rax, %rbx
movq %r14, %rdi
callq 0x8ea0
movq %rbx, %rdi
callq 0x5330