// File: 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
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0xa8(%rbp)
movq %rdi, %rax
movq %rax, -0xa0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x98(%rbp)
movb $0x0, -0x1d(%rbp)
callq 0xd000
leaq -0x30(%rbp), %rdi
callq 0xd020
movq -0x18(%rbp), %rax
movq %rax, -0x90(%rbp)
testq %rax, %rax
je 0xcbb3
jmp 0xcb8a
movq -0x90(%rbp), %rax
subq $0x1, %rax
je 0xccb9
jmp 0xcb9d
movq -0x90(%rbp), %rax
subq $0x2, %rax
je 0xcdae
jmp 0xcea9
movl $0x40, %edi
callq 0x4190
movq %rax, -0xb0(%rbp)
jmp 0xcbc6
movq -0xb0(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xdae0
jmp 0xcbd7
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdi
callq 0xda90
jmp 0xcbec
movl $0x18, %edi
callq 0x4190
movq %rax, -0xb8(%rbp)
jmp 0xcbff
movq -0xa8(%rbp), %rsi
movb $0x1, -0x51(%rbp)
leaq -0x50(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x6390
movq -0xb8(%rbp), %rdi
movq -0xc0(%rbp), %rsi
callq 0xdc70
jmp 0xcc2f
movq -0xb8(%rbp), %rsi
movb $0x0, -0x51(%rbp)
leaq -0x30(%rbp), %rdi
callq 0xdc20
jmp 0xcc45
leaq -0x50(%rbp), %rdi
callq 0x63c0
jmp 0xcedc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xcf21
movq -0xb0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x40, %esi
callq 0x41a0
jmp 0xcf21
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x63c0
testb $0x1, -0x51(%rbp)
jne 0xcca3
jmp 0xccb4
movq -0xb8(%rbp), %rdi
movl $0x18, %esi
callq 0x41a0
jmp 0xcf21
movl $0x40, %edi
callq 0x4190
movq %rax, -0xc8(%rbp)
jmp 0xcccc
movq -0xc8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xdd40
jmp 0xccdd
movq -0xc8(%rbp), %rsi
movq -0xa8(%rbp), %rdi
callq 0xdcf0
jmp 0xccf2
movl $0x18, %edi
callq 0x4190
movq %rax, -0xd0(%rbp)
jmp 0xcd05
movq -0xa8(%rbp), %rsi
movb $0x1, -0x69(%rbp)
leaq -0x68(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x6390
movq -0xd0(%rbp), %rdi
movq -0xd8(%rbp), %rsi
callq 0xded0
jmp 0xcd35
movq -0xd0(%rbp), %rsi
movb $0x0, -0x69(%rbp)
leaq -0x30(%rbp), %rdi
callq 0xde80
jmp 0xcd4b
leaq -0x68(%rbp), %rdi
callq 0x63c0
jmp 0xcedc
movq -0xc8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x40, %esi
callq 0x41a0
jmp 0xcf21
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x63c0
testb $0x1, -0x69(%rbp)
jne 0xcd98
jmp 0xcda9
movq -0xd0(%rbp), %rdi
movl $0x18, %esi
callq 0x41a0
jmp 0xcf21
movl $0x48, %edi
callq 0x4190
movq %rax, -0xe0(%rbp)
jmp 0xcdc1
movq -0xe0(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xdf70
jmp 0xcdd2
movq -0xe0(%rbp), %rsi
movq -0xa8(%rbp), %rdi
callq 0xdf20
jmp 0xcde7
movl $0x18, %edi
callq 0x4190
movq %rax, -0xe8(%rbp)
jmp 0xcdfa
movq -0xa8(%rbp), %rsi
movb $0x1, -0x81(%rbp)
leaq -0x80(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x6390
movq -0xe8(%rbp), %rdi
movq -0xf0(%rbp), %rsi
callq 0xe100
jmp 0xce2d
movq -0xe8(%rbp), %rsi
movb $0x0, -0x81(%rbp)
leaq -0x30(%rbp), %rdi
callq 0xe0b0
jmp 0xce46
leaq -0x80(%rbp), %rdi
callq 0x63c0
jmp 0xcedc
movq -0xe0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x48, %esi
callq 0x41a0
jmp 0xcf21
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x63c0
testb $0x1, -0x81(%rbp)
jne 0xce96
jmp 0xcea7
movq -0xe8(%rbp), %rdi
movl $0x18, %esi
callq 0x41a0
jmp 0xcf21
movq 0x20120(%rip), %rdi     # 0x2cfd0
leaq 0x112d1(%rip), %rsi     # 0x1e188
callq 0x4180
movq %rax, -0xf8(%rbp)
jmp 0xcec5
movq -0xf8(%rbp), %rdi
movq 0x200e5(%rip), %rsi     # 0x2cfb8
callq 0x41c0
jmp 0xceda
jmp 0xcedc
movq -0xa8(%rbp), %rsi
movq -0x98(%rbp), %rdi
addq $0x70, %rdi
callq 0xe150
movq %rax, -0x100(%rbp)
jmp 0xcefc
movq -0x100(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xe180
movb $0x1, -0x1d(%rbp)
leaq -0x30(%rbp), %rdi
callq 0xda50
testb $0x1, -0x1d(%rbp)
jne 0xcf44
jmp 0xcf38
leaq -0x30(%rbp), %rdi
callq 0xda50
movq -0xa8(%rbp), %rdi
callq 0x63c0
jmp 0xcf54
movq -0xa8(%rbp), %rdi
callq 0x63c0
movq -0xa0(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x4300
nopl (%rax)