// File: 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
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x120(%rbp)
addq $0x8, %rdi
leaq 0x4767(%rip), %rsi      # 0x41c8c
callq 0x12920
testb $0x1, %al
jne 0x3d533
jmp 0x3d5dc
movq -0x120(%rbp), %rdi
addq $0x70, %rdi
callq 0x12980
movq %rax, %rdi
callq 0x2a9b0
testb $0x1, %al
jne 0x3d551
jmp 0x3d574
movl $0x4, %edi
callq 0x6160
movq %rax, %rdi
movl $0xf, (%rdi)
movq 0x16a2d(%rip), %rsi     # 0x53f98
xorl %eax, %eax
movl %eax, %edx
callq 0x6430
movq -0x120(%rbp), %rdi
addq $0x70, %rdi
callq 0x12980
movq %rax, %rsi
leaq -0x18(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0x2a640
movq -0x128(%rbp), %rdi
callq 0x3adb0
movq %rax, %rdi
movl $0x3, %esi
callq 0x3ccb0
jmp 0x3d5b2
leaq -0x18(%rbp), %rdi
callq 0x12e70
jmp 0x3d5d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x12e70
jmp 0x3dbf6
jmp 0x3dbed
movq -0x120(%rbp), %rdi
addq $0x8, %rdi
leaq 0x46a7(%rip), %rsi      # 0x41c95
callq 0x12920
testb $0x1, %al
jne 0x3d5fc
jmp 0x3d97a
movq -0x120(%rbp), %rdi
addq $0x70, %rdi
callq 0x12980
movq %rax, %rsi
leaq -0x40(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x2a6b0
movq -0x138(%rbp), %rdi
callq 0x12af0
movq %rax, %rdi
callq 0x3d220
movq %rax, -0x130(%rbp)
jmp 0x3d63c
movq -0x130(%rbp), %rdi
callq 0x12b50
movq %rax, -0x30(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x12b30
movq -0x120(%rbp), %rdi
addq $0x70, %rdi
callq 0x12980
movq %rax, %rsi
leaq -0x58(%rbp), %rdi
movq %rdi, -0x148(%rbp)
callq 0x2a6b0
movq -0x148(%rbp), %rdi
callq 0x12af0
movq %rax, %rdi
callq 0x3d220
movq %rax, -0x140(%rbp)
jmp 0x3d695
movq -0x140(%rbp), %rdi
callq 0x12b80
movq %rax, -0x48(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x12bb0
movb %al, -0x149(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x12b30
movb -0x149(%rbp), %al
testb $0x1, %al
jne 0x3d6cd
jmp 0x3d731
leaq -0x30(%rbp), %rdi
callq 0x12bf0
movq %rax, %rdi
callq 0x12d30
movq %rax, %rdi
movq (%rdi), %rax
movl $0x2, %esi
callq *0xb8(%rax)
leaq -0x30(%rbp), %rdi
callq 0x12d70
jmp 0x3d655
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x12b30
jmp 0x3dbf6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x12b30
jmp 0x3dbf6
movq -0x120(%rbp), %rdi
addq $0x70, %rdi
callq 0x12980
movq %rax, %rsi
leaq -0x90(%rbp), %rdi
movq %rdi, -0x158(%rbp)
callq 0x2a670
movq -0x158(%rbp), %rdi
callq 0x12a20
movq %rax, %rsi
leaq -0x80(%rbp), %rdi
callq 0x22910
jmp 0x3d771
leaq -0x80(%rbp), %rdi
callq 0x12980
movq %rax, %rsi
leaq -0x70(%rbp), %rdi
callq 0x2a6b0
jmp 0x3d788
leaq -0x70(%rbp), %rdi
callq 0x12af0
movq %rax, %rdi
callq 0x3d220
movq %rax, -0x160(%rbp)
jmp 0x3d7a2
movq -0x160(%rbp), %rdi
callq 0x12b50
movq %rax, -0x60(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x12b30
leaq -0x80(%rbp), %rdi
callq 0x12a00
leaq -0x90(%rbp), %rdi
callq 0x12a70
movq -0x120(%rbp), %rdi
addq $0x70, %rdi
callq 0x12980
movq %rax, %rsi
leaq -0xc8(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x2a670
movq -0x168(%rbp), %rdi
callq 0x12a20
movq %rax, %rsi
leaq -0xb8(%rbp), %rdi
callq 0x22910
jmp 0x3d813
leaq -0xb8(%rbp), %rdi
callq 0x12980
movq %rax, %rsi
leaq -0xa8(%rbp), %rdi
callq 0x2a6b0
jmp 0x3d830
leaq -0xa8(%rbp), %rdi
callq 0x12af0
movq %rax, %rdi
callq 0x3d220
movq %rax, -0x170(%rbp)
jmp 0x3d84d
movq -0x170(%rbp), %rdi
callq 0x12b80
movq %rax, -0x98(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x12bb0
movb %al, -0x171(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x12b30
leaq -0xb8(%rbp), %rdi
callq 0x12a00
leaq -0xc8(%rbp), %rdi
callq 0x12a70
movb -0x171(%rbp), %al
testb $0x1, %al
jne 0x3d8a9
jmp 0x3d975
leaq -0x60(%rbp), %rdi
callq 0x12bf0
movq %rax, %rdi
callq 0x12d30
movq %rax, %rdi
movq (%rdi), %rax
movl $0x2, %esi
callq *0xb8(%rax)
leaq -0x60(%rbp), %rdi
callq 0x12d70
jmp 0x3d7d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x3d913
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x3d90a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x12b30
leaq -0x80(%rbp), %rdi
callq 0x12a00
leaq -0x90(%rbp), %rdi
callq 0x12a70
jmp 0x3dbf6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x3d964
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x3d958
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x12b30
leaq -0xb8(%rbp), %rdi
callq 0x12a00
leaq -0xc8(%rbp), %rdi
callq 0x12a70
jmp 0x3dbf6
jmp 0x3dbed
movq -0x120(%rbp), %rdi
addq $0x8, %rdi
leaq 0x4312(%rip), %rsi      # 0x41c9e
callq 0x12920
testb $0x1, %al
jne 0x3d99a
jmp 0x3dbca
movq -0x120(%rbp), %rdi
addq $0x70, %rdi
callq 0x12980
movq %rax, %rdi
callq 0x2a980
testb $0x1, %al
jne 0x3d9b8
jmp 0x3d9db
movl $0x4, %edi
callq 0x6160
movq %rax, %rdi
movl $0x10, (%rdi)
movq 0x165c6(%rip), %rsi     # 0x53f98
xorl %eax, %eax
movl %eax, %edx
callq 0x6430
movq -0x120(%rbp), %rdi
addq $0x70, %rdi
callq 0x12980
movq %rax, %rsi
leaq -0xe8(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x2a6e0
movq -0x180(%rbp), %rdi
callq 0x3ab30
movq %rax, %rsi
leaq -0xd8(%rbp), %rdi
callq 0x26ea0
jmp 0x3da1e
leaq -0xe8(%rbp), %rdi
callq 0x3a9d0
movq -0x120(%rbp), %rdi
addq $0x70, %rdi
callq 0x12980
movq %rax, %rdi
callq 0x2a920
movb %al, -0x181(%rbp)
jmp 0x3da4a
movb -0x181(%rbp), %al
testb $0x1, %al
jne 0x3da56
jmp 0x3daac
movl $0x4, %edi
callq 0x6160
movq %rax, %rdi
movl $0x2, (%rdi)
movq 0x16528(%rip), %rsi     # 0x53f98
xorl %eax, %eax
movl %eax, %edx
callq 0x6430
jmp 0x3dbff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x3a9d0
jmp 0x3dbf6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x3dbba
movq -0x120(%rbp), %rdi
addq $0x70, %rdi
callq 0x12980
movq %rax, %rsi
leaq -0xf8(%rbp), %rdi
callq 0x2a6e0
jmp 0x3dacd
leaq -0xf8(%rbp), %rdi
callq 0x3ab30
movq %rax, %rdi
callq 0x273f0
jmp 0x3dae3
leaq -0xf8(%rbp), %rdi
callq 0x3a9d0
movq -0x120(%rbp), %rdi
addq $0x70, %rdi
callq 0x12980
movq %rax, %rsi
leaq -0x108(%rbp), %rdi
callq 0x2a6b0
jmp 0x3db10
leaq -0x108(%rbp), %rdi
callq 0x12af0
movq %rax, -0x198(%rbp)
leaq -0x118(%rbp), %rdi
movq %rdi, -0x190(%rbp)
leaq -0xd8(%rbp), %rsi
callq 0x12c10
movq -0x198(%rbp), %rdi
movq -0x190(%rbp), %rsi
callq 0x3d2b0
jmp 0x3db52
leaq -0x118(%rbp), %rdi
callq 0x12d50
leaq -0x108(%rbp), %rdi
callq 0x12b30
jmp 0x3dbac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x3a9d0
jmp 0x3dbba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x118(%rbp), %rdi
callq 0x12d50
leaq -0x108(%rbp), %rdi
callq 0x12b30
jmp 0x3dbba
leaq -0xd8(%rbp), %rdi
callq 0x12d50
jmp 0x3dbc8
leaq -0xd8(%rbp), %rdi
callq 0x12d50
jmp 0x3dbf6
jmp 0x3dbed
movl $0x4, %edi
callq 0x6160
movq %rax, %rdi
movl $0xa, (%rdi)
movq 0x163b4(%rip), %rsi     # 0x53f98
xorl %eax, %eax
movl %eax, %edx
callq 0x6430
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0x6460
nop