// File: /workspace/github_cpp_makefile_star2_O2/Worthy-Wang[P]Warcraft3-StartWar/Headquarters.cpp
// Function: warcraft::Headquarters::createWeapon(unsigned long, warcraft::WarriorType)
WeaponPtr Headquarters::createWeapon(size_t number, WarriorType type)
{
    WeaponPtr weapon;
    WeaponViewPtr weaponView;
    switch (number)
    {
    case 0:
    {
        weapon.reset(new Sword(type));
        weaponView.reset(new SwordView(weapon));
        break;
    }
    case 1:
    {
        weapon.reset(new Bomb(type));
        weaponView.reset(new BombView(weapon));
        break;
    }
    case 2:
    {
        weapon.reset(new Arrow(type));
        weaponView.reset(new ArrowView(weapon));
        break;
    }
    default:
        cout << "Headquarters::createWeapon ERROR!" << endl;
        break;
    }
    _weaponViews[weapon] = weaponView;
    return weapon;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movaps %xmm0, -0x40(%rbp)
cmpq $0x2, %rdx
je 0x71ee
cmpq $0x1, %rdx
je 0x7196
testq %rdx, %rdx
jne 0x724b
pushq $0x40
popq %rdi
callq 0x4170
movq %rax, %r12
movq %rax, %rdi
movl %r15d, %esi
callq 0x7a18
movq %rbx, %rdi
movq %r12, %rsi
callq 0x79d2
pushq $0x18
popq %rdi
callq 0x4170
movq %rax, %r15
leaq -0x70(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x52c4
movb $0x1, %r13b
movq %r15, %rdi
movq %r12, %rsi
callq 0x7b2c
xorl %r13d, %r13d
leaq -0x40(%rbp), %rdi
movq %r15, %rsi
callq 0x7ae6
leaq -0x68(%rbp), %rdi
jmp 0x7244
pushq $0x40
popq %rdi
callq 0x4170
movq %rax, %r12
movq %rax, %rdi
movl %r15d, %esi
callq 0x7bb4
movq %rbx, %rdi
movq %r12, %rsi
callq 0x7b6e
pushq $0x18
popq %rdi
callq 0x4170
movq %rax, %r15
leaq -0x60(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x52c4
movq %r15, %rdi
movq %r12, %rsi
callq 0x7cc6
leaq -0x40(%rbp), %rdi
movq %r15, %rsi
callq 0x7c80
leaq -0x58(%rbp), %rdi
jmp 0x7244
pushq $0x48
popq %rdi
callq 0x4170
movq %rax, %r12
movq %rax, %rdi
movl %r15d, %esi
callq 0x7d4e
movq %rbx, %rdi
movq %r12, %rsi
callq 0x7d08
pushq $0x18
popq %rdi
callq 0x4170
movq %rax, %r15
leaq -0x50(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x52c4
movq %r15, %rdi
movq %r12, %rsi
callq 0x7e60
leaq -0x40(%rbp), %rdi
movq %r15, %rsi
callq 0x7e1a
leaq -0x48(%rbp), %rdi
callq 0x5302
jmp 0x7266
movq 0xed7e(%rip), %rdi      # 0x15fd0
leaq 0x6f2f(%rip), %rsi      # 0xe188
callq 0x4160
movq %rax, %rdi
callq 0x40b0
addq $0x70, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9e62
leaq -0x40(%rbp), %rsi
movq %rax, %rdi
callq 0x997e
leaq -0x38(%rbp), %rdi
callq 0x5302
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq -0x48(%rbp), %rdi
jmp 0x72ac
movq %rax, %r14
leaq -0x58(%rbp), %rdi
callq 0x5302
jmp 0x72e8
jmp 0x72bc
movq %rax, %r14
pushq $0x48
jmp 0x72c1
movq %rax, %r14
pushq $0x40
popq %rsi
movq %r12, %rdi
jmp 0x72de
movq %rax, %r14
leaq -0x68(%rbp), %rdi
callq 0x5302
testb %r13b, %r13b
je 0x72e8
pushq $0x18
popq %rsi
movq %r15, %rdi
callq 0x4180
jmp 0x72e8
movq %rax, %r14
leaq -0x38(%rbp), %rdi
callq 0x5302
addq $0x8, %rbx
movq %rbx, %rdi
callq 0x5302
movq %r14, %rdi
callq 0x4250
nop