// File: /workspace/github_cpp_makefile_star2_O2/Worthy-Wang[P]Warcraft3-StartWar/Headquarters.cpp
// Function: warcraft::Headquarters::createWarrior(warcraft::WarriorType)
WarriorPtr Headquarters::createWarrior(WarriorType type)
{
    size_t hp = GameConfig::getInstance()->getInitWarriorHp(GameConfig::getInstance()->currentGroupId(), type);
    _baseHp -= hp;
    WarriorPtr warrior;
    WarriorViewPtr warriorView;
    WeaponPtr weapon;
    WeaponViewPtr weaponView;
    switch (type)
    {
    case DRAGON:
    {
        warrior.reset(new Dragon(getColor(), getWarriorId(), hp, getBaseHp()));
        warriorView.reset(new DragonView(warrior));
        weapon = createWeapon(getWarriorId() % 3, DRAGON);
        warrior->setWeapon(weapon);
        break;
    }
    case NINJA:
    {
        warrior.reset(new Ninja(getColor(), getWarriorId(), hp, getBaseHp()));
        warriorView.reset(new NinjaView(warrior));
        weapon = createWeapon(getWarriorId() % 3, NINJA);
        WeaponPtr weapon2 = createWeapon((getWarriorId() + 1) % 3, NINJA);
        warrior->setWeapon(weapon);
        warrior->setWeapon(weapon2);
        break;
    }
    case ICEMAN:
    {
        warrior.reset(new Iceman(getColor(), getWarriorId(), hp, getBaseHp()));
        warriorView.reset(new IcemanView(warrior));
        weapon = createWeapon(getWarriorId() % 3, ICEMAN);
        warrior->setWeapon(weapon);
        break;
    }
    case LION:
    {
        warrior.reset(new Lion(getColor(), getWarriorId(), hp, getBaseHp()));
        warriorView.reset(new LionView(warrior));
        weapon = createWeapon(getWarriorId() % 3, LION);
        warrior->setWeapon(weapon);
        break;
    }
    case WOLF:
    {
        warrior.reset(new Wolf(getColor(), getWarriorId(), hp, getBaseHp()));
        warriorView.reset(new WolfView(warrior));
        break;
    }
    default:
        cout << "Warrior Type ERROR!" << endl;
        break;
    }

    _warriorViews[warrior] = warriorView;

    return warrior;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movl %edx, %r13d
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xf690(%rip), %rax      # 0x16168
movq (%rax), %rdi
leaq 0xf67e(%rip), %rax      # 0x16160
movq (%rax), %rsi
callq 0x7306
movq 0x8(%r14), %r12
subq %rax, %r12
movq %r12, 0x8(%r14)
xorpd %xmm0, %xmm0
movupd %xmm0, (%rbx)
movapd %xmm0, -0x50(%rbp)
movapd %xmm0, -0x60(%rbp)
movapd %xmm0, -0x70(%rbp)
cmpl $0x4, %r13d
ja 0x6ff7
movq %rax, %r15
movl %r13d, %eax
leaq 0x75fd(%rip), %rcx      # 0xe120
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
pushq $0x60
popq %rdi
callq 0x4170
movq %rax, %r13
movl (%r14), %esi
movq %r12, %xmm1
punpckldq 0x75b9(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x75c1(%rip), %xmm1     # 0xe110
movq 0x18(%r14), %rdx
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rax, %rdi
movl %r15d, %ecx
callq 0x737c
movq %rbx, %rdi
movq %r13, %rsi
callq 0x7336
pushq $0x18
popq %rdi
callq 0x4170
movq %rax, %r15
leaq -0x110(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5392
movb $0x1, %r13b
movq %r15, %rdi
movq %r12, %rsi
callq 0x7444
xorl %r13d, %r13d
leaq -0x50(%rbp), %rdi
movq %r15, %rsi
callq 0x73fe
leaq -0x108(%rbp), %rdi
callq 0x5302
movq 0x18(%r14), %rax
pushq $0x3
popq %rcx
xorl %edx, %edx
divq %rcx
leaq -0x38(%rbp), %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x70f8
leaq -0x60(%rbp), %r15
leaq -0x38(%rbp), %rsi
movq %r15, %rdi
callq 0x547c
leaq -0x30(%rbp), %rdi
callq 0x5302
movq (%rbx), %r12
leaq -0x100(%rbp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x52c4
addq $0x40, %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x81d4
leaq -0xf8(%rbp), %rdi
jmp 0x6fa7
pushq $0x60
popq %rdi
callq 0x4170
movq %rax, %r13
movl (%r14), %esi
movq %r12, %xmm1
punpckldq 0x74c7(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x74cf(%rip), %xmm1     # 0xe110
movq 0x18(%r14), %rdx
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rax, %rdi
movl %r15d, %ecx
callq 0x78c8
movq %rbx, %rdi
movq %r13, %rsi
callq 0x7882
pushq $0x18
popq %rdi
callq 0x4170
movq %rax, %r15
leaq -0x80(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5392
movq %r15, %rdi
movq %r12, %rsi
callq 0x7990
leaq -0x50(%rbp), %rdi
movq %r15, %rsi
callq 0x794a
leaq -0x78(%rbp), %rdi
jmp 0x6fa7
pushq $0x60
popq %rdi
callq 0x4170
movq %rax, %r13
movl (%r14), %esi
movq %r12, %xmm1
punpckldq 0x7444(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x744c(%rip), %xmm1     # 0xe110
movq 0x18(%r14), %rdx
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rax, %rdi
movl %r15d, %ecx
callq 0x761c
movq %rbx, %rdi
movq %r13, %rsi
callq 0x75d6
pushq $0x18
popq %rdi
callq 0x4170
movq %rax, %r15
leaq -0xc0(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5392
movq %r15, %rdi
movq %r12, %rsi
callq 0x76e4
leaq -0x50(%rbp), %rdi
movq %r15, %rsi
callq 0x769e
leaq -0xb8(%rbp), %rdi
callq 0x5302
movq 0x18(%r14), %rax
pushq $0x3
popq %rcx
xorl %edx, %edx
divq %rcx
leaq -0x38(%rbp), %rdi
pushq $0x2
popq %rcx
movq %r14, %rsi
callq 0x70f8
leaq -0x60(%rbp), %r15
leaq -0x38(%rbp), %rsi
movq %r15, %rdi
callq 0x547c
leaq -0x30(%rbp), %rdi
callq 0x5302
movq (%rbx), %r12
leaq -0xb0(%rbp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x52c4
addq $0x40, %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x81d4
leaq -0xa8(%rbp), %rdi
jmp 0x6fa7
pushq $0x68
popq %rdi
callq 0x4170
movq %rax, %r13
movl (%r14), %esi
movq 0x18(%r14), %rdx
movq %rax, %rdi
movl %r15d, %ecx
movq %r12, %r8
callq 0x776c
movq %rbx, %rdi
movq %r13, %rsi
callq 0x7726
pushq $0x18
popq %rdi
callq 0x4170
movq %rax, %r15
leaq -0xa0(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5392
movq %r15, %rdi
movq %r12, %rsi
callq 0x7840
leaq -0x50(%rbp), %rdi
movq %r15, %rsi
callq 0x77fa
leaq -0x98(%rbp), %rdi
callq 0x5302
movq 0x18(%r14), %rax
pushq $0x3
popq %rcx
xorl %edx, %edx
divq %rcx
leaq -0x38(%rbp), %rdi
pushq $0x3
popq %rcx
movq %r14, %rsi
callq 0x70f8
leaq -0x60(%rbp), %r15
leaq -0x38(%rbp), %rsi
movq %r15, %rdi
callq 0x547c
leaq -0x30(%rbp), %rdi
callq 0x5302
movq (%rbx), %r12
leaq -0x90(%rbp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x52c4
addq $0x40, %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x81d4
leaq -0x88(%rbp), %rdi
jmp 0x6fa7
pushq $0x60
popq %rdi
callq 0x4170
movq %rax, %r13
movl (%r14), %esi
movq %r12, %xmm1
punpckldq 0x7288(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x7290(%rip), %xmm1     # 0xe110
movq 0x18(%r14), %rdx
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rax, %rdi
movl %r15d, %ecx
callq 0x74cc
movq %rbx, %rdi
movq %r13, %rsi
callq 0x7486
pushq $0x18
popq %rdi
callq 0x4170
movq %rax, %r15
leaq -0xf0(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5392
movq %r15, %rdi
movq %r12, %rsi
callq 0x7594
leaq -0x50(%rbp), %rdi
movq %r15, %rsi
callq 0x754e
leaq -0xe8(%rbp), %rdi
callq 0x5302
movq 0x18(%r14), %rax
pushq $0x3
popq %r15
xorl %edx, %edx
divq %r15
leaq -0x38(%rbp), %rdi
pushq $0x1
popq %rcx
movq %r14, %rsi
callq 0x70f8
leaq -0x60(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x547c
leaq -0x30(%rbp), %rdi
callq 0x5302
movq 0x18(%r14), %rax
incq %rax
xorl %edx, %edx
divq %r15
leaq -0x38(%rbp), %rdi
pushq $0x1
popq %rcx
movq %r14, %rsi
callq 0x70f8
leaq -0xd8(%rbp), %r15
movq (%rbx), %r12
leaq -0xe0(%rbp), %r13
leaq -0x60(%rbp), %rsi
movq %r13, %rdi
callq 0x52c4
addq $0x40, %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x81d4
leaq -0xc8(%rbp), %r15
leaq -0xd8(%rbp), %rdi
callq 0x5302
movq (%rbx), %r12
leaq -0xd0(%rbp), %r13
leaq -0x38(%rbp), %rsi
movq %r13, %rdi
callq 0x52c4
addq $0x40, %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x81d4
leaq -0xc8(%rbp), %rdi
callq 0x5302
leaq -0x30(%rbp), %rdi
callq 0x5302
addq $0x38, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x99a4
leaq -0x50(%rbp), %rsi
movq %rax, %rdi
callq 0x9708
leaq -0x68(%rbp), %rdi
callq 0x5302
leaq -0x58(%rbp), %rdi
callq 0x5302
leaq -0x48(%rbp), %rdi
callq 0x5302
movq %rbx, %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xefd2(%rip), %rdi      # 0x15fd0
leaq 0x716f(%rip), %rsi      # 0xe174
callq 0x4160
movq %rax, %rdi
callq 0x40b0
jmp 0x6fac
jmp 0x7016
movq %rax, %r14
movq %r15, %rdi
callq 0x5302
leaq -0x30(%rbp), %rdi
jmp 0x7086
movq %rax, %r14
leaq -0xf8(%rbp), %rdi
jmp 0x7086
jmp 0x70c6
jmp 0x70c6
movq %rax, %r14
leaq -0x88(%rbp), %rdi
jmp 0x7086
movq %rax, %r14
leaq -0xa8(%rbp), %rdi
jmp 0x7086
jmp 0x70c6
jmp 0x70c6
jmp 0x70c6
movq %rax, %r14
leaq -0xe8(%rbp), %rdi
jmp 0x7086
movq %rax, %r14
leaq -0x98(%rbp), %rdi
jmp 0x7086
movq %rax, %r14
leaq -0xb8(%rbp), %rdi
jmp 0x7086
movq %rax, %r14
leaq -0x78(%rbp), %rdi
callq 0x5302
jmp 0x70c9
jmp 0x709a
movq %rax, %r14
pushq $0x68
jmp 0x709f
jmp 0x709a
jmp 0x709a
movq %rax, %r14
pushq $0x60
popq %rsi
movq %r13, %rdi
callq 0x4180
jmp 0x70c9
movq %rax, %r14
leaq -0x108(%rbp), %rdi
callq 0x5302
testb %r13b, %r13b
je 0x70c9
pushq $0x18
popq %rsi
movq %r15, %rdi
jmp 0x70a3
movq %rax, %r14
leaq -0x68(%rbp), %rdi
callq 0x5302
leaq -0x58(%rbp), %rdi
callq 0x5302
leaq -0x48(%rbp), %rdi
callq 0x5302
addq $0x8, %rbx
movq %rbx, %rdi
callq 0x5302
movq %r14, %rdi
callq 0x4250