// File: /workspace/github_cpp_makefile_star2_O1/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 0x4414(%rip), %rsi      # 0x28d44
movq %r14, %rdi
callq 0x50a0
testl %eax, %eax
je 0x24a2c
leaq 0x4406(%rip), %rsi      # 0x28d4d
movq %r14, %rdi
callq 0x50a0
testl %eax, %eax
je 0x24a60
leaq 0x43f8(%rip), %rsi      # 0x28d56
movq %r14, %rdi
callq 0x50a0
testl %eax, %eax
jne 0x24c13
movq 0x70(%rbx), %rdi
callq 0x17d2c
testb %al, %al
jne 0x24c25
movq 0x70(%rbx), %rsi
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x17bfc
movq (%r14), %rsi
leaq 0x8(%rsp), %rdi
callq 0x15c08
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x249ac
callq 0xb634
movq 0x70(%rbx), %rdi
callq 0x17d18
testb %al, %al
jne 0x24c37
movq 0x70(%rbx), %rsi
leaq 0x18(%rsp), %rdi
callq 0x17bfc
movq 0x18(%rsp), %rdi
callq 0x15fa8
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x249e4
callq 0xb634
movq 0x70(%rbx), %rsi
leaq 0x18(%rsp), %rdi
callq 0x17bd0
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x38(%rsp)
movq %rax, 0x40(%rsp)
testq %rax, %rax
je 0x24bcd
movq 0xf5a5(%rip), %rcx      # 0x33fc0
cmpb $0x0, (%rcx)
je 0x24bc9
incl 0x8(%rax)
jmp 0x24bcd
movq 0x70(%rbx), %rdi
callq 0x17d36
testb %al, %al
jne 0x24c58
movq 0x70(%rbx), %rsi
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x17b72
movq (%rbx), %rdi
movl $0x3, %esi
callq 0x24314
jmp 0x24bf5
movq 0x70(%rbx), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x17bd0
movq (%r14), %rdi
callq 0x24706
movq (%rax), %r15
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x24a8b
callq 0xb634
leaq 0x8(%rsp), %r14
movq 0x70(%rbx), %rsi
movq %r14, %rdi
callq 0x17bd0
movq 0x8(%rsp), %rdi
callq 0x24706
movq 0x8(%rax), %r12
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x24ab9
callq 0xb634
cmpq %r12, %r15
je 0x24ad5
movq (%r15), %rdi
movq (%rdi), %rax
movl $0x2, %esi
callq *0xb8(%rax)
addq $0x10, %r15
jmp 0x24a90
movq 0x70(%rbx), %rsi
leaq 0x28(%rsp), %r14
movq %r14, %rdi
callq 0x17b9e
movq (%r14), %rsi
leaq 0x18(%rsp), %rdi
callq 0x1206a
movq 0x18(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x17bd0
movq 0x8(%rsp), %rdi
callq 0x24706
movq (%rax), %r13
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x24b1e
callq 0xb634
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x24b2d
callq 0xb634
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x24b3c
callq 0xb634
leaq 0x28(%rsp), %r14
leaq 0x18(%rsp), %r15
leaq 0x8(%rsp), %r12
movq 0x70(%rbx), %rsi
movq %r14, %rdi
callq 0x17b9e
movq 0x28(%rsp), %rsi
movq %r15, %rdi
callq 0x1206a
movq 0x18(%rsp), %rsi
movq %r12, %rdi
callq 0x17bd0
movq 0x8(%rsp), %rdi
callq 0x24706
movq 0x8(%rax), %rbp
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x24b8e
callq 0xb634
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x24b9d
callq 0xb634
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x24bac
callq 0xb634
cmpq %rbp, %r13
je 0x24c04
movq (%r13), %rdi
movq (%rdi), %rax
movl $0x2, %esi
callq *0xb8(%rax)
addq $0x10, %r13
jmp 0x24b4b
lock
incl 0x8(%rax)
leaq 0x38(%rsp), %rsi
callq 0x24744
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x24be6
callq 0xb634
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x24bf5
callq 0xb634
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x24c04
callq 0xb634
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x4, %edi
callq 0x5100
movl $0xa, (%rax)
jmp 0x24c68
movl $0x4, %edi
callq 0x5100
movl $0x10, (%rax)
jmp 0x24c68
movl $0x4, %edi
callq 0x5100
movl $0x2, (%rax)
movq 0xf342(%rip), %rsi      # 0x33f90
movq %rax, %rdi
xorl %edx, %edx
callq 0x5300
movl $0x4, %edi
callq 0x5100
movl $0xf, (%rax)
movq 0xf321(%rip), %rsi      # 0x33f90
movq %rax, %rdi
xorl %edx, %edx
callq 0x5300
jmp 0x24cc5
jmp 0x24cc0
jmp 0x24cbb
jmp 0x24ced
jmp 0x24ced
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x24c9c
callq 0xb634
jmp 0x24c9c
jmp 0x24ced
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x24cf0
callq 0xb634
jmp 0x24cf0
jmp 0x24ced
movq %rax, %rbx
movq 0x20(%rsp), %rdi
jmp 0x24cf5
jmp 0x24ced
movq %rax, %rbx
jmp 0x24ce6
movq %rax, %rbx
jmp 0x24cd7
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x24cd7
callq 0xb634
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x24ce6
callq 0xb634
movq 0x30(%rsp), %rdi
jmp 0x24cf5
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x24cff
callq 0xb634
movq %rbx, %rdi
callq 0x5320
nop