// File: /workspace/github_cpp_makefile_star2_O3/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 $0xa8, %rsp
movq (%rsi), %r13
testq %r13, %r13
je 0x9e94
cmpl $0x4, 0x3c(%r13)
je 0x9e94
movq 0x40(%r13), %r12
movq 0x48(%r13), %rbx
movq %rbx, %rax
subq %r12, %rax
je 0x9e94
movq %rdi, %r15
movq %rsi, -0x38(%rbp)
sarq $0x4, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x9f3a
movq %r12, %rdi
movq %rbx, %rsi
callq 0x9fed
movq 0x40(%r13), %r14
movq (%r14), %rax
movl 0x8(%rax), %eax
movl %eax, -0x2c(%rbp)
movq %r13, -0x40(%rbp)
movq 0x48(%r13), %r13
xorl %r12d, %r12d
cmpq %r13, %r14
je 0x9afb
leaq -0x90(%rbp), %rbx
movl -0x2c(%rbp), %ecx
movq (%r14), %rax
cmpl 0x8(%rax), %ecx
jne 0x9afb
movq 0x48(%r15), %rcx
subq 0x40(%r15), %rcx
cmpq $0xa0, %rcx
ja 0x9afb
movq %rax, -0x90(%rbp)
movq 0x8(%r14), %rax
movq %rax, -0x88(%rbp)
testq %rax, %rax
je 0x9ad3
movq 0xd503(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0x9acf
incl 0x8(%rax)
jmp 0x9ad3
lock
incl 0x8(%rax)
movq %r15, %rdi
movq %rbx, %rsi
callq 0xd056
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x9aef
callq 0x57a8
incq %r12
addq $0x10, %r14
cmpq %r13, %r14
jne 0x9a8b
movl 0x8(%r15), %eax
leaq -0x70(%rbp), %rsi
movq %rsi, -0x10(%rsi)
cmpl $0x1, %eax
je 0x9b30
testl %eax, %eax
movq -0x40(%rbp), %r14
jne 0x9b4e
movb $0x64, 0x2(%rsi)
movw $0x6572, (%rsi)         # imm = 0x6572
leaq -0x6d(%rbp), %rax
movq $0x3, -0xb(%rax)
movl $0x3, %edx
jmp 0x9b5b
leaq -0x6c(%rbp), %rax
movl $0x65756c62, -0x4(%rax) # imm = 0x65756C62
movq $0x4, -0xc(%rax)
movl $0x4, %edx
movq -0x40(%rbp), %r14
jmp 0x9b5b
movq $0x0, -0x78(%rbp)
xorl %edx, %edx
movq %rsi, %rax
movb $0x0, (%rax)
movq 0xd46b(%rip), %rdi      # 0x16fd0
callq 0x4190
movq %rax, %rbx
leaq 0x66e8(%rip), %rsi      # 0x1025c
movl $0x6, %edx
movq %rax, %rdi
callq 0x4190
movq 0x30(%r15), %rsi
movq %rbx, %rdi
callq 0x40e0
movq %rax, %rbx
leaq 0x66cc(%rip), %rsi      # 0x10263
movl $0x6, %edx
movq %rax, %rdi
callq 0x4190
movq %rbx, %rdi
movq %r12, %rsi
callq 0x40e0
movq %rax, %rbx
leaq 0x6ef2(%rip), %rsi      # 0x10aab
movl $0x1, %edx
movq %rax, %rdi
callq 0x4190
movl -0x2c(%rbp), %eax
leaq -0xa0(%rbp), %r13
movq %r13, -0x10(%r13)
cmpl $0x2, %eax
je 0x9c0e
cmpl $0x1, %eax
je 0x9bf1
testl %eax, %eax
jne 0x9c31
movb $0x64, 0x4(%r13)
movl $0x726f7773, (%r13)     # imm = 0x726F7773
jmp 0x9c1b
leaq -0x9c(%rbp), %rax
movl $0x626d6f62, -0x4(%rax) # imm = 0x626D6F62
movq $0x4, -0xc(%rax)
movl $0x4, %edx
jmp 0x9c41
movb $0x77, 0x4(%r13)
movl $0x6f727261, (%r13)     # imm = 0x6F727261
leaq -0x9b(%rbp), %rax
movq $0x5, -0xd(%rax)
movl $0x5, %edx
jmp 0x9c41
movq $0x0, -0xa8(%rbp)
xorl %edx, %edx
movq %r13, %rax
movb $0x0, (%rax)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4190
movq %rax, %rbx
leaq 0x6611(%rip), %rsi      # 0x1026a
movl $0x6, %edx
movq %rax, %rdi
callq 0x4190
movq -0x38(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %eax
leaq -0xc0(%rbp), %r12
movq %r12, -0x10(%r12)
cmpl $0x1, %eax
je 0x9ca8
testl %eax, %eax
jne 0x9cc5
movb $0x64, 0x2(%r12)
movw $0x6572, (%r12)         # imm = 0x6572
leaq -0xbd(%rbp), %rax
movq $0x3, -0xb(%rax)
movl $0x3, %edx
jmp 0x9cd5
leaq -0xbc(%rbp), %rax
movl $0x65756c62, -0x4(%rax) # imm = 0x65756C62
movq $0x4, -0xc(%rax)
movl $0x4, %edx
jmp 0x9cd5
movq $0x0, -0xc8(%rbp)
xorl %edx, %edx
movq %r12, %rax
movb $0x0, (%rax)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4190
movq %rax, %rbx
leaq 0x6dbe(%rip), %rsi      # 0x10aab
movl $0x1, %edx
movq %rax, %rdi
callq 0x4190
movq -0x38(%rbp), %rax
movq (%rax), %rax
movl 0x3c(%rax), %eax
leaq -0x50(%rbp), %r15
movq %r15, -0x10(%r15)
cmpq $0x4, %rax
ja 0x9d9d
leaq 0x6483(%rip), %rcx      # 0x101a0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movw $0x6e6f, 0x4(%r15)      # imm = 0x6E6F
movl $0x67617264, (%r15)     # imm = 0x67617264
jmp 0x9d51
leaq -0x4c(%rbp), %rax
movl $0x666c6f77, -0x4(%rax) # imm = 0x666C6F77
jmp 0x9d6f
movw $0x6e61, 0x4(%r15)      # imm = 0x6E61
movl $0x6d656369, (%r15)     # imm = 0x6D656369
leaq -0x4a(%rbp), %rax
movq $0x6, -0xe(%rax)
movl $0x6, %edx
jmp 0x9daa
leaq -0x4c(%rbp), %rax
movl $0x6e6f696c, -0x4(%rax) # imm = 0x6E6F696C
movq $0x4, -0xc(%rax)
movl $0x4, %edx
jmp 0x9daa
movb $0x61, 0x4(%r15)
movl $0x6a6e696e, (%r15)     # imm = 0x6A6E696E
leaq -0x4b(%rbp), %rax
movq $0x5, -0xd(%rax)
movl $0x5, %edx
jmp 0x9daa
movq $0x0, -0x58(%rbp)
xorl %edx, %edx
movq %r15, %rax
movb $0x0, (%rax)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4190
movq %rax, %rbx
leaq 0x6ce9(%rip), %rsi      # 0x10aab
movl $0x1, %edx
movq %rax, %rdi
callq 0x4190
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %rsi
movq %rbx, %rdi
callq 0x40e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4150
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x40f0
movq -0x60(%rbp), %rdi
cmpq %r15, %rdi
je 0x9e21
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0xd0(%rbp), %rdi
cmpq %r12, %rdi
je 0x9e3c
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0xb0(%rbp), %rdi
cmpq %r13, %rdi
je 0x9e57
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x4170
leaq 0x40(%r14), %rbx
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x9e74
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x4170
movq 0x40(%r14), %rdi
movq 0x48(%r14), %rsi
leaq -0x2c(%rbp), %rdx
callq 0xa7f0
movq 0x48(%r14), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x5814
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x9ec8
movq %rax, %r14
jmp 0x9ee3
movq %rax, %r14
movq -0x60(%rbp), %rdi
cmpq %r15, %rdi
je 0x9ec8
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0xd0(%rbp), %rdi
cmpq %r12, %rdi
je 0x9ee3
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0xb0(%rbp), %rdi
cmpq %r13, %rdi
je 0x9f03
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x4170
jmp 0x9f03
movq %rax, %r14
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x9f32
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x4170
jmp 0x9f32
movq %rax, %r14
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x9f32
callq 0x57a8
movq %r14, %rdi
callq 0x4230