// File: /workspace/github_cpp_makefile_star2_O2/Worthy-Wang[P]Warcraft3-StartWar/./Warrior.h
// Function: warcraft::Wolf::stealWeapons(std::shared_ptr<warcraft::Warrior>)
void stealWeapons(WarriorPtr enemy) override
    {
        if (!enemy.get())
            return;
        vector<WeaponPtr> &enemyWeapons = enemy->getWeapons();
        if (WOLF == enemy->getType() || 0 == enemyWeapons.size())
            return;
        //抢敌人编号最小的武器
        std::sort(enemyWeapons.begin(), enemyWeapons.end(), [](WeaponPtr lhs, WeaponPtr rhs) {
            if (lhs->getType() < rhs->getType())
                return true;
            else if (lhs->getType() == ARROW && lhs->getType() == rhs->getType() && lhs->getDurability() > rhs->getDurability())
                return true;
            else
                return false;
        });
        WeaponType type = enemyWeapons[0]->getType();
        size_t cnt = 0;
        for (auto &e : enemyWeapons)
        {
            if (type != e->getType() || _weapons.size() > MAX_WEAPON_SIZE)
                break;
            getNewWeapon(e);
            cnt++;
        }
        cout << toString(_color) << " wolf " << _id << " took " << cnt << " " << toString(type) << " from " << toString(enemy->getColor()) << " " << toString(enemy->getType()) << " " << enemy->getId() << endl;
        auto it = std::remove_if(enemyWeapons.begin(), enemyWeapons.end(), [&](WeaponPtr weapon) { return type == weapon->getType(); });
        enemyWeapons.erase(it, enemyWeapons.end());
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq (%rsi), %rbx
testq %rbx, %rbx
je 0x8a10
cmpl $0x4, 0x3c(%rbx)
je 0x8a10
movq %rsi, %rax
movq %rdi, %r12
movq 0x40(%rbx), %rdi
movq 0x48(%rbx), %rsi
cmpq %rdi, %rsi
je 0x8a10
movq %rax, -0x40(%rbp)
leaq 0x40(%rbx), %rax
movq %rax, -0x38(%rbp)
callq 0x8add
movq 0x40(%rbx), %r14
movq (%r14), %rax
movl 0x8(%rax), %eax
movl %eax, -0x2c(%rbp)
movl %eax, -0x30(%rbp)
movq %rbx, -0x48(%rbp)
movq 0x48(%rbx), %r15
xorl %r13d, %r13d
leaq -0x58(%rbp), %rbx
cmpq %r15, %r14
je 0x88ab
movq (%r14), %rax
movl -0x2c(%rbp), %ecx
cmpl 0x8(%rax), %ecx
jne 0x88ab
movq 0x48(%r12), %rax
subq 0x40(%r12), %rax
cmpq $0xa0, %rax
ja 0x88ab
movq %rbx, %rdi
movq %r14, %rsi
callq 0x52c4
movq %r12, %rdi
movq %rbx, %rsi
callq 0xbb0a
leaq -0x50(%rbp), %rdi
callq 0x5302
incq %r13
addq $0x10, %r14
jmp 0x8861
movl 0x8(%r12), %esi
leaq -0xd8(%rbp), %rbx
movq %rbx, %rdi
callq 0x503f
movq 0xd70a(%rip), %rdi      # 0x15fd0
movq %rbx, %rsi
callq 0x4150
leaq 0x593d(%rip), %rsi      # 0xe212
movq %rax, %rdi
callq 0x4160
movq 0x30(%r12), %rsi
movq %rax, %rdi
callq 0x40f0
leaq 0x5928(%rip), %rsi      # 0xe219
movq %rax, %rdi
callq 0x4160
movq %rax, %rdi
movq %r13, %rsi
callq 0x40f0
leaq 0x6158(%rip), %rsi      # 0xea63
movq %rax, %rdi
callq 0x4160
movq %rax, %rbx
leaq -0xb8(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x8a7d
movq -0x48(%rbp), %r14
movq -0x40(%rbp), %r15
leaq -0xb8(%rbp), %rsi
movq %rbx, %rdi
callq 0x4150
leaq 0x58dd(%rip), %rsi      # 0xe220
movq %rax, %rdi
callq 0x4160
movq %rax, %rbx
movq (%r15), %rax
movl 0x8(%rax), %esi
leaq -0x98(%rbp), %rdi
callq 0x503f
leaq -0x98(%rbp), %rsi
movq %rbx, %rdi
callq 0x4150
leaq 0x60ed(%rip), %rsi      # 0xea63
movq %rax, %rdi
callq 0x4160
movq %rax, %rbx
movq (%r15), %rax
movl 0x3c(%rax), %esi
leaq -0x78(%rbp), %rdi
callq 0x8150
leaq -0x78(%rbp), %rsi
movq %rbx, %rdi
callq 0x4150
leaq 0x60c0(%rip), %rsi      # 0xea63
movq %rax, %rdi
callq 0x4160
movq (%r15), %rcx
movq 0x30(%rcx), %rsi
movq %rax, %rdi
callq 0x40f0
movq %rax, %rdi
callq 0x40b0
leaq -0x78(%rbp), %rdi
callq 0x40a0
leaq -0x98(%rbp), %rdi
callq 0x40a0
leaq -0xb8(%rbp), %rdi
callq 0x40a0
leaq -0xd8(%rbp), %rdi
callq 0x40a0
movq 0x40(%r14), %rdi
movq 0x48(%r14), %rsi
leaq -0x30(%rbp), %rdx
callq 0x945a
movq 0x48(%r14), %rdx
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x508e
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8a28
jmp 0x8a2d
jmp 0x8a58
movq %rax, %r14
jmp 0x8a3e
movq %rax, %r14
jmp 0x8a4a
movq %rax, %r14
leaq -0x78(%rbp), %rdi
callq 0x40a0
leaq -0x98(%rbp), %rdi
callq 0x40a0
leaq -0xb8(%rbp), %rdi
callq 0x40a0
jmp 0x8a5b
movq %rax, %r14
leaq -0xd8(%rbp), %rdi
callq 0x40a0
jmp 0x8a75
movq %rax, %r14
leaq -0x50(%rbp), %rdi
callq 0x5302
movq %r14, %rdi
callq 0x4250