// File: /workspace/github_cpp_makefile_star2_O3/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 0x3760(%rip), %rsi      # 0x27d44
movq %r14, %rdi
callq 0x50a0
testl %eax, %eax
je 0x246e0
leaq 0x3752(%rip), %rsi      # 0x27d4d
movq %r14, %rdi
callq 0x50a0
testl %eax, %eax
je 0x24714
leaq 0x3744(%rip), %rsi      # 0x27d56
movq %r14, %rdi
callq 0x50a0
testl %eax, %eax
jne 0x248c7
movq 0x70(%rbx), %rdi
callq 0x17bf0
testb %al, %al
jne 0x248d9
movq 0x70(%rbx), %rsi
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x17ac0
movq (%r14), %rsi
leaq 0x8(%rsp), %rdi
callq 0x15b38
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x24660
callq 0xb478
movq 0x70(%rbx), %rdi
callq 0x17bdc
testb %al, %al
jne 0x248eb
movq 0x70(%rbx), %rsi
leaq 0x18(%rsp), %rdi
callq 0x17ac0
movq 0x18(%rsp), %rdi
callq 0x15ed8
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x24698
callq 0xb478
movq 0x70(%rbx), %rsi
leaq 0x18(%rsp), %rdi
callq 0x17a94
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x38(%rsp)
movq %rax, 0x40(%rsp)
testq %rax, %rax
je 0x24881
movq 0xe8f1(%rip), %rcx      # 0x32fc0
cmpb $0x0, (%rcx)
je 0x2487d
incl 0x8(%rax)
jmp 0x24881
movq 0x70(%rbx), %rdi
callq 0x17bfa
testb %al, %al
jne 0x2490c
movq 0x70(%rbx), %rsi
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x17a36
movq (%rbx), %rdi
movl $0x3, %esi
callq 0x23fe4
jmp 0x248a9
movq 0x70(%rbx), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x17a94
movq (%r14), %rdi
callq 0x243d6
movq (%rax), %r15
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2473f
callq 0xb478
leaq 0x8(%rsp), %r14
movq 0x70(%rbx), %rsi
movq %r14, %rdi
callq 0x17a94
movq 0x8(%rsp), %rdi
callq 0x243d6
movq 0x8(%rax), %r12
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2476d
callq 0xb478
cmpq %r12, %r15
je 0x24789
movq (%r15), %rdi
movq (%rdi), %rax
movl $0x2, %esi
callq *0xb8(%rax)
addq $0x10, %r15
jmp 0x24744
movq 0x70(%rbx), %rsi
leaq 0x28(%rsp), %r14
movq %r14, %rdi
callq 0x17a62
movq (%r14), %rsi
leaq 0x18(%rsp), %rdi
callq 0x11e3e
movq 0x18(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x17a94
movq 0x8(%rsp), %rdi
callq 0x243d6
movq (%rax), %r13
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x247d2
callq 0xb478
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x247e1
callq 0xb478
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x247f0
callq 0xb478
leaq 0x28(%rsp), %r14
leaq 0x18(%rsp), %r15
leaq 0x8(%rsp), %r12
movq 0x70(%rbx), %rsi
movq %r14, %rdi
callq 0x17a62
movq 0x28(%rsp), %rsi
movq %r15, %rdi
callq 0x11e3e
movq 0x18(%rsp), %rsi
movq %r12, %rdi
callq 0x17a94
movq 0x8(%rsp), %rdi
callq 0x243d6
movq 0x8(%rax), %rbp
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x24842
callq 0xb478
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x24851
callq 0xb478
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x24860
callq 0xb478
cmpq %rbp, %r13
je 0x248b8
movq (%r13), %rdi
movq (%rdi), %rax
movl $0x2, %esi
callq *0xb8(%rax)
addq $0x10, %r13
jmp 0x247ff
lock
incl 0x8(%rax)
leaq 0x38(%rsp), %rsi
callq 0x24414
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x2489a
callq 0xb478
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x248a9
callq 0xb478
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x248b8
callq 0xb478
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 0x2491c
movl $0x4, %edi
callq 0x5100
movl $0x10, (%rax)
jmp 0x2491c
movl $0x4, %edi
callq 0x5100
movl $0x2, (%rax)
movq 0xe68e(%rip), %rsi      # 0x32f90
movq %rax, %rdi
xorl %edx, %edx
callq 0x5300
movl $0x4, %edi
callq 0x5100
movl $0xf, (%rax)
movq 0xe66d(%rip), %rsi      # 0x32f90
movq %rax, %rdi
xorl %edx, %edx
callq 0x5300
jmp 0x24979
jmp 0x24974
jmp 0x2496f
jmp 0x249a1
jmp 0x249a1
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x24950
callq 0xb478
jmp 0x24950
jmp 0x249a1
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x249a4
callq 0xb478
jmp 0x249a4
jmp 0x249a1
movq %rax, %rbx
movq 0x20(%rsp), %rdi
jmp 0x249a9
jmp 0x249a1
movq %rax, %rbx
jmp 0x2499a
movq %rax, %rbx
jmp 0x2498b
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2498b
callq 0xb478
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x2499a
callq 0xb478
movq 0x30(%rsp), %rdi
jmp 0x249a9
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x249b3
callq 0xb478
movq %rbx, %rdi
callq 0x5320
nop