// File: /workspace/github_cpp_makefile_star2_O3/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 $0xd8, %rsp
movl %edx, %ebx
movq %rsi, %r12
movq %rdi, %r14
leaq 0x10279(%rip), %rax     # 0x17158
movq (%rax), %rax
leaq 0x10267(%rip), %rcx     # 0x17150
movq (%rcx), %rcx
leaq -0x60(%rbp), %r15
movl %edx, (%r15)
movq 0x18(%rax), %rax
shlq $0x7, %rcx
leaq (%rax,%rcx), %rdi
addq $-0x60, %rdi
movq %r15, %rsi
callq 0x681a
movq (%rax), %rax
movq 0x8(%r12), %r13
subq %rax, %r13
movq %r12, -0x48(%rbp)
movq %r13, 0x8(%r12)
xorpd %xmm0, %xmm0
movq %r14, -0x30(%rbp)
movupd %xmm0, (%r14)
movapd %xmm0, (%r15)
cmpl $0x4, %ebx
ja 0x724b
movq %rax, %r12
movl %ebx, %eax
leaq 0x91ca(%rip), %rcx      # 0x10110
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %r15d, %r15d
movl $0x60, %edi
callq 0x4160
movq -0x48(%rbp), %r14
movq %rax, %rbx
movl (%r14), %esi
movq %r13, %xmm1
punpckldq 0x917d(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x9185(%rip), %xmm1     # 0x10100
movq 0x18(%r14), %rdx
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rax, %rdi
movl %r12d, %ecx
callq 0x7af4
xorl %r15d, %r15d
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
callq 0x7aa6
xorl %r15d, %r15d
movl $0x18, %edi
callq 0x4160
movq %rax, %r12
movq -0x30(%rbp), %rcx
movq (%rcx), %rax
movq %rax, -0x100(%rbp)
movq 0x8(%rcx), %rax
movq %rax, -0xf8(%rbp)
testq %rax, %rax
je 0x7418
movq 0xffea(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0x7414
incl 0x8(%rax)
jmp 0x7418
xorl %r15d, %r15d
movl $0x60, %edi
callq 0x4160
movq -0x48(%rbp), %r14
movq %rax, %rbx
movl (%r14), %esi
movq %r13, %xmm1
punpckldq 0x90dd(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x90e5(%rip), %xmm1     # 0x10100
movq 0x18(%r14), %rdx
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rax, %rdi
movl %r12d, %ecx
callq 0x822c
xorl %r15d, %r15d
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
callq 0x81de
xorl %r15d, %r15d
movl $0x18, %edi
callq 0x4160
movq %rax, %rbx
movq -0x30(%rbp), %rcx
movq (%rcx), %rax
movq %rax, -0x70(%rbp)
movq 0x8(%rcx), %rax
movq %rax, -0x68(%rbp)
testq %rax, %rax
je 0x72aa
movq 0xff50(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0x72a6
incl 0x8(%rax)
jmp 0x72aa
xorl %r15d, %r15d
movl $0x60, %edi
callq 0x4160
movq -0x48(%rbp), %r14
movq %rax, %rbx
movl (%r14), %esi
movq %r13, %xmm1
punpckldq 0x9043(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x904b(%rip), %xmm1     # 0x10100
movq 0x18(%r14), %rdx
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rax, %rdi
movl %r12d, %ecx
callq 0x7e88
xorl %r15d, %r15d
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
callq 0x7e3a
xorl %r15d, %r15d
movl $0x18, %edi
callq 0x4160
movq %rax, %rbx
movq -0x30(%rbp), %rcx
movq (%rcx), %rax
movq %rax, -0xb0(%rbp)
movq 0x8(%rcx), %rax
movq %rax, -0xa8(%rbp)
testq %rax, %rax
je 0x72dc
movq 0xfeb0(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0x72d8
incl 0x8(%rax)
jmp 0x72dc
xorl %r15d, %r15d
movl $0x68, %edi
callq 0x4160
movq -0x48(%rbp), %r14
movq %rax, %rbx
movl (%r14), %esi
movq 0x18(%r14), %rdx
movq %rax, %rdi
movl %r12d, %ecx
movq %r13, %r8
callq 0x8054
xorl %r15d, %r15d
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
callq 0x8006
xorl %r15d, %r15d
movl $0x18, %edi
callq 0x4160
movq %rax, %rbx
movq -0x30(%rbp), %rcx
movq (%rcx), %rax
movq %rax, -0x90(%rbp)
movq 0x8(%rcx), %rax
movq %rax, -0x88(%rbp)
testq %rax, %rax
je 0x737d
movq 0xfe2e(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0x7379
incl 0x8(%rax)
jmp 0x737d
xorl %r15d, %r15d
movl $0x60, %edi
callq 0x4160
movq -0x48(%rbp), %r14
movq %rax, %rbx
movl (%r14), %esi
movq %r13, %xmm1
punpckldq 0x8f21(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x8f29(%rip), %xmm1     # 0x10100
movq 0x18(%r14), %rdx
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rax, %rdi
movl %r12d, %ecx
callq 0x7cbc
xorl %r15d, %r15d
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
callq 0x7c6e
xorl %r15d, %r15d
movl $0x18, %edi
callq 0x4160
movq %rax, %rbx
movq -0x30(%rbp), %rcx
movq (%rcx), %rax
movq %rax, -0xe0(%rbp)
movq 0x8(%rcx), %rax
movq %rax, -0xd8(%rbp)
testq %rax, %rax
je 0x74ba
movq 0xfd8e(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0x74b6
incl 0x8(%rax)
jmp 0x74ba
xorl %r15d, %r15d
movq 0xfd7b(%rip), %rbx      # 0x16fd0
leaq 0x8f6c(%rip), %rsi      # 0x101c8
movl $0x13, %edx
movq %rbx, %rdi
callq 0x4190
movq -0x48(%rbp), %r14
movq (%rbx), %rax
addq -0x18(%rax), %rbx
xorl %r15d, %r15d
movq %rbx, %rdi
movl $0xa, %esi
callq 0x4150
xorl %r15d, %r15d
movsbl %al, %esi
movq 0xfd3f(%rip), %rdi      # 0x16fd0
callq 0x4030
xorl %r15d, %r15d
movq %rax, %rdi
callq 0x40f0
jmp 0x7661
lock
incl 0x8(%rax)
leaq -0x70(%rbp), %rsi
movq %rbx, %rdi
callq 0x832a
leaq -0x60(%rbp), %rdi
movq %rbx, %rsi
callq 0x82dc
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0x72d0
callq 0x57a8
xorl %r15d, %r15d
jmp 0x7661
lock
incl 0x8(%rax)
leaq -0xb0(%rbp), %rsi
movq %rbx, %rdi
callq 0x7f86
leaq -0x60(%rbp), %rdi
movq %rbx, %rsi
callq 0x7f38
movq -0xa8(%rbp), %rdi
testq %rdi, %rdi
je 0x7308
callq 0x57a8
movq 0x18(%r14), %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
movq %rcx, %rax
mulq %rdx
shrq %rdx
leaq (%rdx,%rdx,2), %rax
subq %rax, %rcx
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
movq %rcx, %rdx
movl $0x2, %ecx
callq 0x77d2
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %r15
movq -0x30(%rbp), %rcx
movq (%rcx), %rdi
movq %rax, -0xa0(%rbp)
movq %r15, -0x98(%rbp)
testq %r15, %r15
je 0x757d
movq 0xfc61(%rip), %rax      # 0x16fc8
cmpb $0x0, (%rax)
je 0x7578
incl 0x8(%r15)
jmp 0x757d
lock
incl 0x8(%rax)
leaq -0x90(%rbp), %rsi
movq %rbx, %rdi
callq 0x815e
leaq -0x60(%rbp), %rdi
movq %rbx, %rsi
callq 0x8110
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x73a9
callq 0x57a8
movq 0x18(%r14), %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
movq %rcx, %rax
mulq %rdx
shrq %rdx
leaq (%rdx,%rdx,2), %rax
subq %rax, %rcx
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
movq %rcx, %rdx
movl $0x3, %ecx
callq 0x77d2
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %r15
movq -0x30(%rbp), %rcx
movq (%rcx), %rdi
movq %rax, -0x80(%rbp)
movq %r15, -0x78(%rbp)
testq %r15, %r15
je 0x759e
movq 0xfbc6(%rip), %rax      # 0x16fc8
cmpb $0x0, (%rax)
je 0x7599
incl 0x8(%r15)
jmp 0x759e
lock
incl 0x8(%rax)
movb $0x1, %bl
leaq -0x100(%rbp), %rsi
movq %r12, %rdi
callq 0x7bee
xorl %ebx, %ebx
leaq -0x60(%rbp), %rdi
movq %r12, %rsi
callq 0x7ba0
movq -0xf8(%rbp), %rdi
testq %rdi, %rdi
je 0x7448
callq 0x57a8
movq 0x18(%r14), %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
movq %rcx, %rax
mulq %rdx
shrq %rdx
leaq (%rdx,%rdx,2), %rax
subq %rax, %rcx
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
movq %rcx, %rdx
xorl %ecx, %ecx
callq 0x77d2
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %r15
movq -0x30(%rbp), %rcx
movq (%rcx), %rdi
movq %rax, -0xf0(%rbp)
movq %r15, -0xe8(%rbp)
testq %r15, %r15
je 0x75b9
movq 0xfb24(%rip), %rax      # 0x16fc8
cmpb $0x0, (%rax)
je 0x75b4
incl 0x8(%r15)
jmp 0x75b9
lock
incl 0x8(%rax)
leaq -0xe0(%rbp), %rsi
movq %rbx, %rdi
callq 0x7dba
leaq -0x60(%rbp), %rdi
movq %rbx, %rsi
callq 0x7d6c
movq -0xd8(%rbp), %rdi
testq %rdi, %rdi
je 0x74e6
callq 0x57a8
movq 0x18(%r14), %rcx
movabsq $-0x5555555555555555, %rbx # imm = 0xAAAAAAAAAAAAAAAB
movq %rcx, %rax
mulq %rbx
shrq %rdx
leaq (%rdx,%rdx,2), %rax
subq %rax, %rcx
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
movq %rcx, %rdx
movl $0x1, %ecx
callq 0x77d2
leaq -0x40(%rbp), %rdi
movq (%rdi), %r12
movq 0x8(%rdi), %r15
movq 0x18(%r14), %rcx
leaq 0x1(%rcx), %rax
mulq %rbx
shrq %rdx
leaq (%rdx,%rdx,2), %rax
negq %rax
leaq (%rcx,%rax), %rdx
incq %rdx
movq %r14, %rsi
movl $0x1, %ecx
callq 0x77d2
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movq %r12, -0xd0(%rbp)
movq %r15, -0xc8(%rbp)
testq %r15, %r15
je 0x75da
movq 0xfa5b(%rip), %rax      # 0x16fc8
cmpb $0x0, (%rax)
je 0x75d5
incl 0x8(%r15)
jmp 0x75da
lock
incl 0x8(%r15)
addq $0x40, %rdi
leaq -0xa0(%rbp), %rsi
callq 0x8f74
movq -0x98(%rbp), %rdi
jmp 0x7657
lock
incl 0x8(%r15)
addq $0x40, %rdi
leaq -0x80(%rbp), %rsi
callq 0x8f74
movq -0x78(%rbp), %rdi
jmp 0x7657
lock
incl 0x8(%r15)
addq $0x40, %rdi
leaq -0xf0(%rbp), %rsi
callq 0x8f74
movq -0xe8(%rbp), %rdi
jmp 0x7657
lock
incl 0x8(%r15)
addq $0x40, %rdi
leaq -0xd0(%rbp), %rsi
callq 0x8f74
movq -0xc8(%rbp), %rdi
testq %rdi, %rdi
je 0x75fb
callq 0x57a8
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, -0xc0(%rbp)
movq %rax, -0xb8(%rbp)
testq %rax, %rax
je 0x7632
movq 0xf9a4(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0x762e
incl 0x8(%rax)
jmp 0x7632
lock
incl 0x8(%rax)
addq $0x40, %rdi
leaq -0xc0(%rbp), %rsi
callq 0x8f74
movq -0xb8(%rbp), %rdi
testq %rdi, %rdi
je 0x7653
callq 0x57a8
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0x7661
callq 0x57a8
addq $0x38, %r14
movq %r14, %rdi
movq -0x30(%rbp), %rsi
callq 0xaf08
leaq -0x58(%rbp), %rsi
movq -0x8(%rsi), %rcx
movq %rcx, (%rax)
addq $0x8, %rax
movq %rax, %rdi
callq 0xac4a
testq %r15, %r15
je 0x7695
movq %r15, %rdi
callq 0x57a8
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0x76a3
callq 0x57a8
movq -0x30(%rbp), %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0xb8(%rbp), %rdi
jmp 0x76cf
movq %rax, %r14
movq -0xc8(%rbp), %rdi
testq %rdi, %rdi
je 0x76d9
callq 0x57a8
movq -0x38(%rbp), %rdi
jmp 0x7705
movq %rax, %r14
movq -0xe8(%rbp), %rdi
jmp 0x7705
jmp 0x779a
jmp 0x771c
movq %rax, %r14
movq -0x78(%rbp), %rdi
jmp 0x7705
movq %rax, %r14
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0x779d
callq 0x57a8
jmp 0x779d
jmp 0x771c
jmp 0x771c
movq %rax, %r14
jmp 0x77aa
movq %rax, %r14
movq -0xd8(%rbp), %rdi
jmp 0x774f
movq %rax, %r14
movq -0x88(%rbp), %rdi
jmp 0x774f
movq %rax, %r14
movq -0xa8(%rbp), %rdi
jmp 0x774f
movq %rax, %r14
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
jne 0x77a5
jmp 0x77aa
jmp 0x7766
movq %rax, %r14
movl $0x68, %esi
jmp 0x776e
jmp 0x7766
jmp 0x7766
movq %rax, %r14
movl $0x60, %esi
movq %rbx, %rdi
callq 0x4170
jmp 0x77aa
movq %rax, %r14
movq -0xf8(%rbp), %rdi
testq %rdi, %rdi
je 0x778c
callq 0x57a8
testb %bl, %bl
je 0x77aa
movl $0x18, %esi
movq %r12, %rdi
jmp 0x7771
movq %rax, %r14
testq %r15, %r15
je 0x77aa
movq %r15, %rdi
callq 0x57a8
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0x77b8
callq 0x57a8
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
testq %rdi, %rdi
je 0x77ca
callq 0x57a8
movq %r14, %rdi
callq 0x4230