// File: /workspace/github_cpp_makefile_star2_O3/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 %r12
pushq %rbx
subq $0x40, %rsp
movl %ecx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movaps %xmm0, -0x30(%rbp)
cmpq $0x2, %rdx
je 0x78cd
cmpq $0x1, %rdx
je 0x786d
testq %rdx, %rdx
jne 0x7922
movl $0x40, %edi
callq 0x4160
movq %rax, %r12
movq %rax, %rdi
movl %r15d, %esi
callq 0x83f8
movq %rbx, %rdi
movq %r12, %rsi
callq 0x83aa
movl $0x18, %edi
callq 0x4160
movq %rax, %r15
movq (%rbx), %rax
movq %rax, -0x60(%rbp)
movq 0x8(%rbx), %rax
movq %rax, -0x58(%rbp)
testq %rax, %rax
je 0x79b2
movq 0xf76c(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0x79ae
incl 0x8(%rax)
jmp 0x79b2
movl $0x40, %edi
callq 0x4160
movq %rax, %r12
movq %rax, %rdi
movl %r15d, %esi
callq 0x8644
movq %rbx, %rdi
movq %r12, %rsi
callq 0x85f6
movl $0x18, %edi
callq 0x4160
movq %rax, %r15
movq (%rbx), %rax
movq %rax, -0x50(%rbp)
movq 0x8(%rbx), %rax
movq %rax, -0x48(%rbp)
testq %rax, %rax
je 0x796e
movq 0xf70c(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0x796a
incl 0x8(%rax)
jmp 0x796e
movl $0x48, %edi
callq 0x4160
movq %rax, %r12
movq %rax, %rdi
movl %r15d, %esi
callq 0x8890
movq %rbx, %rdi
movq %r12, %rsi
callq 0x8842
movl $0x18, %edi
callq 0x4160
movq %rax, %r15
movq (%rbx), %rax
movq %rax, -0x40(%rbp)
movq 0x8(%rbx), %rax
movq %rax, -0x38(%rbp)
testq %rax, %rax
je 0x7990
movq 0xf6b0(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0x798c
incl 0x8(%rax)
jmp 0x7990
movq 0xf6a7(%rip), %r15      # 0x16fd0
leaq 0x88ac(%rip), %rsi      # 0x101dc
movl $0x21, %edx
movq %r15, %rdi
callq 0x4190
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x4150
movsbl %al, %esi
movq 0xf675(%rip), %rdi      # 0x16fd0
callq 0x4030
movq %rax, %rdi
callq 0x40f0
jmp 0x79de
lock
incl 0x8(%rax)
leaq -0x50(%rbp), %rsi
movq %r15, %rdi
callq 0x87c2
leaq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x8774
movq -0x48(%rbp), %rdi
jmp 0x79d4
lock
incl 0x8(%rax)
leaq -0x40(%rbp), %rsi
movq %r15, %rdi
callq 0x8a0e
leaq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x89c0
movq -0x38(%rbp), %rdi
jmp 0x79d4
lock
incl 0x8(%rax)
movb $0x1, %r12b
leaq -0x60(%rbp), %rsi
movq %r15, %rdi
callq 0x8576
xorl %r12d, %r12d
leaq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x8528
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0x79de
callq 0x57a8
addq $0x70, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0xb29a
leaq -0x28(%rbp), %r14
movq -0x8(%r14), %rcx
movq %rcx, (%rax)
addq $0x8, %rax
movq %rax, %rdi
movq %r14, %rsi
callq 0xac4a
movq (%r14), %rdi
testq %rdi, %rdi
je 0x7a14
callq 0x57a8
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0x38(%rbp), %rdi
jmp 0x7a34
movq %rax, %r14
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x7a81
callq 0x57a8
jmp 0x7a81
jmp 0x7a4c
movq %rax, %r14
movl $0x48, %esi
jmp 0x7a54
movq %rax, %r14
movl $0x40, %esi
movq %r12, %rdi
jmp 0x7a77
movq %rax, %r14
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0x7a6a
callq 0x57a8
testb %r12b, %r12b
je 0x7a81
movl $0x18, %esi
movq %r15, %rdi
callq 0x4170
jmp 0x7a81
movq %rax, %r14
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x7a8f
callq 0x57a8
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x7a9d
callq 0x57a8
movq %r14, %rdi
callq 0x4230
nop