// File: /workspace/github_cpp_makefile_star2_O1/Worthy-Wang[P]Warcraft3-StartWar/warcraftWorld.cpp
// Function: warcraft::WarcraftWorld::createAndShow(warcraft::Headquarters*)
bool WarcraftWorld::createAndShow(Headquarters *head)
{
    //基地生命元少于当前创造的勇士生命值时 返回false
    while (head->getBaseHp() < GameConfig::getInstance()->getInitWarriorHp(_caseNum, head->getWarriorType()))
        return false;
    //创建勇士
    WarriorPtr warrior = head->createWarrior(head->getWarriorType());
    WarriorViewPtr warriorView;

    //设置武器
    switch (head->getWarriorType())
    {
    case DRAGON:
    {
        WeaponPtr weapon = head->createWeapon(head->getWarriorId() % 3, DRAGON);
        warrior->setWeapon(weapon);
        warriorView.reset(new DragonView(warrior));
        HeadquartersView headView(head);
        //show
        warriorView->show();
        cout << "It has a " << weapon->getName() << endl;
        break;
    }
    case ICEMAN:
    {
        WeaponPtr weapon = head->createWeapon(head->getWarriorId() % 3, ICEMAN);
        warrior->setWeapon(weapon);
        warriorView.reset(new IcemanView(warrior));
        HeadquartersView headView(head);
        //show
        warriorView->show();
        cout << "It has a " << weapon->getName() << endl;
        break;
    }
    case LION:
    {
        WeaponPtr weapon = head->createWeapon(head->getWarriorId() % 3, LION);
        warrior->setWeapon(weapon);
        warriorView.reset(new LionView(warrior));
        HeadquartersView headView(head);
        //show
        warriorView->show();
        break;
    }
    case NINJA:
    {
        WeaponPtr weapon1 = head->createWeapon(head->getWarriorId() % 3, NINJA);
        WeaponPtr weapon2 = head->createWeapon((head->getWarriorId() + 1) % 3, NINJA);
        warrior->setWeapon(weapon1);
        warrior->setWeapon(weapon2);
        warriorView.reset(new NinjaView(warrior));
        HeadquartersView headView(head);
        //show
        warriorView->show();
        cout << "It has a " << weapon1->getName() << " and a " << weapon2->getName() << endl;
        break;
    }
    case WOLF:
    {
        warriorView.reset(new WolfView(warrior));
        HeadquartersView headView(head);
        //show
        warriorView->show();
        break;
    }
    }
    if (head->getColor() == RED)
        _citys[0]->attach(warrior);
    else
        _citys[GameConfig::getInstance()->getCityNum(_caseNum) + 1]->attach(warrior);
    head->nextWarriorType();
    head->nextWarriorId();
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rsi), %r12
movq 0x10(%rsi), %rax
leaq 0x9d47(%rip), %rcx      # 0x17158
movq (%rcx), %rcx
movq 0x28(%rdi), %rdx
movq 0x20(%rsi), %rsi
movl (%rsi,%rax,4), %eax
leaq -0x58(%rbp), %rsi
movl %eax, (%rsi)
movq 0x18(%rcx), %rax
shlq $0x7, %rdx
leaq (%rax,%rdx), %rdi
addq $-0x60, %rdi
callq 0x6838
movq (%rax), %r13
cmpq %r13, %r12
jb 0xdd53
movq 0x10(%rbx), %rax
movq 0x20(%rbx), %rcx
movl (%rcx,%rax,4), %edx
leaq -0x38(%rbp), %rdi
movq %rbx, %rsi
callq 0x6ee8
xorps %xmm0, %xmm0
movaps %xmm0, -0x70(%rbp)
movq 0x10(%rbx), %rax
movq 0x20(%rbx), %rcx
movl (%rcx,%rax,4), %eax
cmpq $0x4, %rax
ja 0xdc51
leaq 0x34e4(%rip), %rcx      # 0x10964
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x18(%rbx), %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
movq %rcx, %rax
mulq %rdx
shrq %rdx
leaq (%rdx,%rdx,2), %rax
subq %rax, %rcx
leaq -0x90(%rbp), %rdi
movq %rbx, %rsi
movq %rcx, %rdx
xorl %ecx, %ecx
callq 0x7860
movq -0x38(%rbp), %rdi
movq -0x90(%rbp), %rcx
movq -0x88(%rbp), %rax
movq %rcx, -0x170(%rbp)
movq %rax, -0x168(%rbp)
testq %rax, %rax
je 0xd7de
movq 0x9add(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xd7da
incl 0x8(%rax)
jmp 0xd7de
movl $0x18, %edi
callq 0x4160
movq %rax, %r15
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, -0xe0(%rbp)
movq %rax, -0xd8(%rbp)
testq %rax, %rax
je 0xd6cd
movq 0x9a99(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xd6c9
incl 0x8(%rax)
jmp 0xd6cd
movq 0x18(%rbx), %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
movq %rcx, %rax
mulq %rdx
shrq %rdx
leaq (%rdx,%rdx,2), %rax
subq %rax, %rcx
leaq -0x90(%rbp), %rdi
movq %rbx, %rsi
movq %rcx, %rdx
movl $0x2, %ecx
callq 0x7860
movq -0x38(%rbp), %rdi
movq -0x90(%rbp), %rcx
movq -0x88(%rbp), %rax
movq %rcx, -0x150(%rbp)
movq %rax, -0x148(%rbp)
testq %rax, %rax
je 0xd70c
movq 0x9a23(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xd708
incl 0x8(%rax)
jmp 0xd70c
movq 0x18(%rbx), %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
movq %rcx, %rax
mulq %rdx
shrq %rdx
leaq (%rdx,%rdx,2), %rax
subq %rax, %rcx
leaq -0x58(%rbp), %rdi
movq %rbx, %rsi
movq %rcx, %rdx
movl $0x3, %ecx
callq 0x7860
movq -0x38(%rbp), %rdi
movq -0x58(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, -0x130(%rbp)
movq %rax, -0x128(%rbp)
testq %rax, %rax
je 0xd775
movq 0x99b6(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xd771
incl 0x8(%rax)
jmp 0xd775
movq 0x18(%rbx), %rcx
movabsq $-0x5555555555555555, %r15 # imm = 0xAAAAAAAAAAAAAAAB
movq %rcx, %rax
mulq %r15
shrq %rdx
leaq (%rdx,%rdx,2), %rax
subq %rax, %rcx
leaq -0xb0(%rbp), %rdi
movq %rbx, %rsi
movq %rcx, %rdx
movl $0x1, %ecx
callq 0x7860
movq 0x18(%rbx), %rcx
leaq 0x1(%rcx), %rax
mulq %r15
shrq %rdx
leaq (%rdx,%rdx,2), %rax
negq %rax
leaq (%rcx,%rax), %rdx
incq %rdx
leaq -0xa0(%rbp), %rdi
movq %rbx, %rsi
movl $0x1, %ecx
callq 0x7860
movq -0x38(%rbp), %rdi
movq -0xb0(%rbp), %rcx
movq -0xa8(%rbp), %rax
movq %rcx, -0x110(%rbp)
movq %rax, -0x108(%rbp)
testq %rax, %rax
je 0xd847
movq 0x9910(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xd843
incl 0x8(%rax)
jmp 0xd847
lock
incl 0x8(%rax)
leaq -0xe0(%rbp), %rsi
movq %r15, %rdi
callq 0x83b0
leaq -0x70(%rbp), %rdi
movq %r15, %rsi
callq 0x8362
movq -0xd8(%rbp), %rdi
testq %rdi, %rdi
je 0xd6f9
callq 0x57ba
movq -0x70(%rbp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
jmp 0xdc51
lock
incl 0x8(%rax)
addq $0x40, %rdi
leaq -0x150(%rbp), %rsi
callq 0x8fd2
movq -0x148(%rbp), %rdi
testq %rdi, %rdi
je 0xd72d
callq 0x57ba
movl $0x18, %edi
callq 0x4160
movq %rax, %r15
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, -0x140(%rbp)
movq %rax, -0x138(%rbp)
testq %rax, %rax
je 0xd8ad
movq 0x9868(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xd8a9
incl 0x8(%rax)
jmp 0xd8ad
lock
incl 0x8(%rax)
addq $0x40, %rdi
leaq -0x130(%rbp), %rsi
callq 0x8fd2
movq -0x128(%rbp), %rdi
testq %rdi, %rdi
je 0xd796
callq 0x57ba
movl $0x18, %edi
callq 0x4160
movq %rax, %r15
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, -0x120(%rbp)
movq %rax, -0x118(%rbp)
testq %rax, %rax
je 0xd965
movq 0x97ff(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xd961
incl 0x8(%rax)
jmp 0xd965
lock
incl 0x8(%rax)
addq $0x40, %rdi
leaq -0x170(%rbp), %rsi
callq 0x8fd2
movq -0x168(%rbp), %rdi
testq %rdi, %rdi
je 0xd7ff
callq 0x57ba
movl $0x18, %edi
callq 0x4160
movq %rax, %r15
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, -0x160(%rbp)
movq %rax, -0x158(%rbp)
testq %rax, %rax
je 0xd9a8
movq 0x9796(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xd9a4
incl 0x8(%rax)
jmp 0xd9a8
lock
incl 0x8(%rax)
addq $0x40, %rdi
leaq -0x110(%rbp), %rsi
callq 0x8fd2
movq -0x108(%rbp), %rdi
testq %rdi, %rdi
je 0xd868
callq 0x57ba
movq -0x38(%rbp), %rdi
movq -0xa0(%rbp), %rcx
movq -0x98(%rbp), %rax
movq %rcx, -0x100(%rbp)
movq %rax, -0xf8(%rbp)
testq %rax, %rax
je 0xda9a
movq 0x9730(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xda96
incl 0x8(%rax)
jmp 0xda9a
lock
incl 0x8(%rax)
leaq -0x140(%rbp), %rsi
movq %r15, %rdi
callq 0x8010
leaq -0x70(%rbp), %rdi
movq %r15, %rsi
callq 0x7fc2
movq -0x138(%rbp), %rdi
testq %rdi, %rdi
je 0xd8d9
callq 0x57ba
movq -0x70(%rbp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq 0x96e6(%rip), %rdi      # 0x16fd0
leaq 0x31aa(%rip), %rsi      # 0x10a9b
movl $0x9, %edx
callq 0x4190
movq -0x90(%rbp), %rax
leaq -0x48(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
leaq -0x58(%rbp), %rdi
callq 0x5720
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq 0x96a3(%rip), %rdi      # 0x16fd0
callq 0x4190
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4150
movsbl %al, %esi
movq %r15, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x40f0
jmp 0xda71
lock
incl 0x8(%rax)
leaq -0x120(%rbp), %rsi
movq %r15, %rdi
callq 0x81e6
leaq -0x70(%rbp), %rdi
movq %r15, %rsi
callq 0x8198
movq -0x118(%rbp), %rdi
testq %rdi, %rdi
je 0xd991
callq 0x57ba
movq -0x70(%rbp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq -0x50(%rbp), %rdi
jmp 0xdc47
lock
incl 0x8(%rax)
movq %r13, -0x178(%rbp)
movq %r12, %r13
movb $0x1, %r12b
leaq -0x160(%rbp), %rsi
movq %r15, %rdi
callq 0x7c7c
xorl %r12d, %r12d
leaq -0x70(%rbp), %rdi
movq %r15, %rsi
callq 0x7c2e
movq -0x158(%rbp), %rdi
testq %rdi, %rdi
je 0xd9e4
callq 0x57ba
movq -0x70(%rbp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq %r13, %r12
movq 0x95d8(%rip), %rdi      # 0x16fd0
leaq 0x309c(%rip), %rsi      # 0x10a9b
movl $0x9, %edx
callq 0x4190
movq -0x90(%rbp), %rax
leaq -0x48(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
leaq -0x58(%rbp), %rdi
callq 0x5720
movq -0x178(%rbp), %r13
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq 0x958e(%rip), %rdi      # 0x16fd0
callq 0x4190
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4150
movsbl %al, %esi
movq %r15, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x40f0
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xda8a
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0x88(%rbp), %rdi
jmp 0xdc47
lock
incl 0x8(%rax)
addq $0x40, %rdi
leaq -0x100(%rbp), %rsi
callq 0x8fd2
movq -0xf8(%rbp), %rdi
testq %rdi, %rdi
je 0xdabb
callq 0x57ba
movl $0x18, %edi
callq 0x4160
movq %rax, %r15
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, -0xf0(%rbp)
movq %rax, -0xe8(%rbp)
testq %rax, %rax
je 0xdaf8
movq 0x94de(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xdaf4
incl 0x8(%rax)
jmp 0xdaf8
lock
incl 0x8(%rax)
leaq -0xf0(%rbp), %rsi
movq %r15, %rdi
callq 0x7e46
leaq -0x70(%rbp), %rdi
movq %r15, %rsi
callq 0x7df8
movq -0xe8(%rbp), %rdi
testq %rdi, %rdi
je 0xdb24
callq 0x57ba
movq -0x70(%rbp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq 0x949b(%rip), %rdi      # 0x16fd0
leaq 0x2f5f(%rip), %rsi      # 0x10a9b
movl $0x9, %edx
callq 0x4190
movq -0xb0(%rbp), %rax
leaq -0x48(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
leaq -0x58(%rbp), %rdi
callq 0x5720
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq 0x9458(%rip), %rdi      # 0x16fd0
callq 0x4190
movq %rax, %r15
leaq 0x2f1e(%rip), %rsi      # 0x10aa5
movl $0x7, %edx
movq %rax, %rdi
callq 0x4190
movq -0xa0(%rbp), %rax
leaq -0x80(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
leaq -0x90(%rbp), %rdi
callq 0x5720
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdx
movq %r15, %rdi
callq 0x4190
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4150
movsbl %al, %esi
movq %r15, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x40f0
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0xdc16
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xdc2f
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0xdc40
callq 0x57ba
movq -0xa8(%rbp), %rdi
testq %rdi, %rdi
je 0xdc51
callq 0x57ba
cmpl $0x0, (%rbx)
je 0xdcaa
leaq 0x94fb(%rip), %rax      # 0x17158
movq (%rax), %rax
movq 0x10(%r14), %rcx
movq 0x28(%r14), %rdx
movq 0x18(%rax), %rax
shlq $0x7, %rdx
movq -0x78(%rax,%rdx), %rax
shlq $0x4, %rax
movq 0x10(%rcx,%rax), %rdi
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, -0xc0(%rbp)
movq %rax, -0xb8(%rbp)
testq %rax, %rax
je 0xdce1
movq 0x9328(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xdcdd
incl 0x8(%rax)
jmp 0xdce1
movq 0x10(%r14), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, -0xd0(%rbp)
movq %rax, -0xc8(%rbp)
testq %rax, %rax
je 0xdcfa
movq 0x92f5(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xdcf6
incl 0x8(%rax)
jmp 0xdcfa
lock
incl 0x8(%rax)
leaq -0xc0(%rbp), %rsi
callq 0xcbea
movq -0xb8(%rbp), %rdi
jmp 0xdd0d
lock
incl 0x8(%rax)
leaq -0xd0(%rbp), %rsi
callq 0xcbea
movq -0xc8(%rbp), %rdi
testq %rdi, %rdi
je 0xdd17
callq 0x57ba
movq 0x10(%rbx), %rax
movq 0x28(%rbx), %rcx
incq %rax
subq 0x20(%rbx), %rcx
sarq $0x2, %rcx
xorl %edx, %edx
divq %rcx
movq %rdx, 0x10(%rbx)
incq 0x18(%rbx)
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0xdd45
callq 0x57ba
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0xdd53
callq 0x57ba
cmpq %r13, %r12
setae %al
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xde4e
jmp 0xde53
jmp 0xde5d
jmp 0xde5d
movq %rax, %rbx
movq -0xe8(%rbp), %rdi
jmp 0xddc0
jmp 0xde53
jmp 0xddd8
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
jmp 0xddc0
movq %rax, %rbx
movq -0x118(%rbp), %rdi
jmp 0xddf7
movq %rax, %rbx
movq -0x138(%rbp), %rdi
jmp 0xde1c
movq %rax, %rbx
movq -0x108(%rbp), %rdi
testq %rdi, %rdi
je 0xdee2
callq 0x57ba
jmp 0xdee2
jmp 0xde5d
movq %rax, %rbx
jmp 0xde01
jmp 0xde5d
jmp 0xde46
movq %rax, %rbx
movq -0x168(%rbp), %rdi
jmp 0xde1c
movq %rax, %rbx
movq -0x128(%rbp), %rdi
testq %rdi, %rdi
je 0xde01
callq 0x57ba
movq -0x50(%rbp), %rdi
jmp 0xdf21
movq %rax, %rbx
jmp 0xdef3
movq %rax, %rbx
movq -0x148(%rbp), %rdi
testq %rdi, %rdi
je 0xdf1a
callq 0x57ba
jmp 0xdf1a
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
jmp 0xdf21
jmp 0xde46
jmp 0xde46
jmp 0xde46
jmp 0xde46
movq %rax, %rbx
jmp 0xdf2b
movq %rax, %rbx
jmp 0xdec9
movq %rax, %rbx
jmp 0xdee2
jmp 0xde5d
movq %rax, %rbx
jmp 0xdf1a
movq %rax, %rbx
movq -0x158(%rbp), %rdi
testq %rdi, %rdi
je 0xde79
callq 0x57ba
testb %r12b, %r12b
je 0xdf1a
movl $0x18, %esi
movq %r15, %rdi
jmp 0xdf15
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
jmp 0xdf21
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
jmp 0xdf21
movq %rax, %rbx
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0xdec9
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xdee2
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0xdef3
callq 0x57ba
movq -0xa8(%rbp), %rdi
jmp 0xdf21
jmp 0xdefe
movq %rax, %rbx
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0xdf1a
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0xdf2b
callq 0x57ba
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0xdf39
callq 0x57ba
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0xdf47
callq 0x57ba
movq %rbx, %rdi
callq 0x4230
nop