// File: /workspace/github_cpp_makefile_star2_O1/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 0x795b
cmpq $0x1, %rdx
je 0x78fb
testq %rdx, %rdx
jne 0x79b0
movl $0x40, %edi
callq 0x4160
movq %rax, %r12
movq %rax, %rdi
movl %r15d, %esi
callq 0x847c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x842e
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 0x7a40
movq 0xf6de(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0x7a3c
incl 0x8(%rax)
jmp 0x7a40
movl $0x40, %edi
callq 0x4160
movq %rax, %r12
movq %rax, %rdi
movl %r15d, %esi
callq 0x86c6
movq %rbx, %rdi
movq %r12, %rsi
callq 0x8678
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 0x79fc
movq 0xf67e(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0x79f8
incl 0x8(%rax)
jmp 0x79fc
movl $0x48, %edi
callq 0x4160
movq %rax, %r12
movq %rax, %rdi
movl %r15d, %esi
callq 0x8910
movq %rbx, %rdi
movq %r12, %rsi
callq 0x88c2
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 0x7a1e
movq 0xf622(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0x7a1a
incl 0x8(%rax)
jmp 0x7a1e
movq 0xf619(%rip), %r15      # 0x16fd0
leaq 0x881e(%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 0xf5e7(%rip), %rdi      # 0x16fd0
callq 0x4030
movq %rax, %rdi
callq 0x40f0
jmp 0x7a6c
lock
incl 0x8(%rax)
leaq -0x50(%rbp), %rsi
movq %r15, %rdi
callq 0x8844
leaq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x87f6
movq -0x48(%rbp), %rdi
jmp 0x7a62
lock
incl 0x8(%rax)
leaq -0x40(%rbp), %rsi
movq %r15, %rdi
callq 0x8a8e
leaq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x8a40
movq -0x38(%rbp), %rdi
jmp 0x7a62
lock
incl 0x8(%rax)
movb $0x1, %r12b
leaq -0x60(%rbp), %rsi
movq %r15, %rdi
callq 0x85fa
xorl %r12d, %r12d
leaq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x85ac
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0x7a6c
callq 0x57ba
addq $0x70, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0xb2d0
leaq -0x28(%rbp), %r14
movq -0x8(%r14), %rcx
movq %rcx, (%rax)
addq $0x8, %rax
movq %rax, %rdi
movq %r14, %rsi
callq 0xac46
movq (%r14), %rdi
testq %rdi, %rdi
je 0x7aa2
callq 0x57ba
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 0x7ac2
movq %rax, %r14
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0x7b0f
callq 0x57ba
jmp 0x7b0f
jmp 0x7ada
movq %rax, %r14
movl $0x48, %esi
jmp 0x7ae2
movq %rax, %r14
movl $0x40, %esi
movq %r12, %rdi
jmp 0x7b05
movq %rax, %r14
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0x7af8
callq 0x57ba
testb %r12b, %r12b
je 0x7b0f
movl $0x18, %esi
movq %r15, %rdi
callq 0x4170
jmp 0x7b0f
movq %rax, %r14
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0x7b1d
callq 0x57ba
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x7b2b
callq 0x57ba
movq %r14, %rdi
callq 0x4230
nop