// File: /workspace/github_cpp_makefile_star2_O1/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 0x9ea7
cmpl $0x4, 0x3c(%r13)
je 0x9ea7
movq 0x40(%r13), %r12
movq 0x48(%r13), %r15
movq %r15, %rax
subq %r12, %rax
je 0x9ea7
movq %rdi, %r14
movq %rsi, -0xb8(%rbp)
sarq $0x4, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x9f4e
movq %r12, %rdi
movq %r15, %rsi
callq 0xa001
movq 0x40(%r13), %r12
movq (%r12), %rax
movl 0x8(%rax), %eax
movl %eax, -0x2c(%rbp)
movq 0x48(%r13), %rbx
cmpq %rbx, %r12
je 0x9b2f
addq $0x10, %r12
xorl %r15d, %r15d
movl -0x2c(%rbp), %edx
movq -0x10(%r12), %rcx
movb $0x1, %al
cmpl 0x8(%rcx), %edx
jne 0x9b18
movq 0x48(%r14), %rdx
subq 0x40(%r14), %rdx
cmpq $0xa0, %rdx
ja 0x9b18
movq %rcx, -0xc8(%rbp)
movq -0x8(%r12), %rax
movq %rax, -0xc0(%rbp)
testq %rax, %rax
je 0x9af3
movq 0xd4e3(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0x9aef
incl 0x8(%rax)
jmp 0x9af3
lock
incl 0x8(%rax)
movq %r14, %rdi
leaq -0xc8(%rbp), %rsi
callq 0xd0de
movq -0xc0(%rbp), %rdi
testq %rdi, %rdi
je 0x9b13
callq 0x57ba
incq %r15
xorl %eax, %eax
testb %al, %al
jne 0x9b32
leaq 0x10(%r12), %rax
cmpq %rbx, %r12
movq %rax, %r12
jne 0x9aa6
jmp 0x9b32
xorl %r15d, %r15d
movl 0x8(%r14), %eax
leaq -0x80(%rbp), %rcx
movq %rcx, -0x10(%rcx)
cmpl $0x1, %eax
je 0x9b68
testl %eax, %eax
movq -0xb8(%rbp), %rbx
jne 0x9b87
movb $0x64, 0x2(%rcx)
movw $0x6572, (%rcx)         # imm = 0x6572
movq $0x3, -0x88(%rbp)
movb $0x0, -0x7d(%rbp)
jmp 0x9b96
movl $0x65756c62, -0x80(%rbp) # imm = 0x65756C62
movq $0x4, -0x88(%rbp)
movb $0x0, -0x7c(%rbp)
movq -0xb8(%rbp), %rbx
jmp 0x9b96
movq $0x0, -0x88(%rbp)
movb $0x0, -0x80(%rbp)
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdx
movq 0xd425(%rip), %rdi      # 0x16fd0
callq 0x4190
movq %rax, %r12
leaq 0x66a2(%rip), %rsi      # 0x1025c
movl $0x6, %edx
movq %rax, %rdi
callq 0x4190
movq 0x30(%r14), %rsi
movq %r12, %rdi
callq 0x40e0
movq %rax, %r14
leaq 0x6686(%rip), %rsi      # 0x10263
movl $0x6, %edx
movq %rax, %rdi
callq 0x4190
movq %r14, %rdi
movq %r15, %rsi
callq 0x40e0
movq %rax, %r14
leaq 0x6eac(%rip), %rsi      # 0x10aab
movl $0x1, %edx
movq %rax, %rdi
callq 0x4190
movl -0x2c(%rbp), %eax
leaq -0x60(%rbp), %rcx
movq %rcx, -0x10(%rcx)
cmpl $0x2, %eax
je 0x9c46
cmpl $0x1, %eax
je 0x9c31
testl %eax, %eax
jne 0x9c5e
movb $0x64, 0x4(%rcx)
movl $0x726f7773, (%rcx)     # imm = 0x726F7773
jmp 0x9c50
movl $0x626d6f62, -0x60(%rbp) # imm = 0x626D6F62
movq $0x4, -0x68(%rbp)
movb $0x0, -0x5c(%rbp)
jmp 0x9c6a
movb $0x77, 0x4(%rcx)
movl $0x6f727261, (%rcx)     # imm = 0x6F727261
movq $0x5, -0x68(%rbp)
movb $0x0, -0x5b(%rbp)
jmp 0x9c6a
movq $0x0, -0x68(%rbp)
movb $0x0, -0x60(%rbp)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq %r14, %rdi
callq 0x4190
movq %rax, %r14
leaq 0x65e6(%rip), %rsi      # 0x1026a
movl $0x6, %edx
movq %rax, %rdi
callq 0x4190
movq (%rbx), %rax
movl 0x8(%rax), %eax
leaq -0xa0(%rbp), %r12
movq %r12, -0x10(%r12)
cmpl $0x1, %eax
je 0x9ccd
testl %eax, %eax
jne 0x9ceb
movb $0x64, 0x2(%r12)
movw $0x6572, (%r12)         # imm = 0x6572
movq $0x3, -0xa8(%rbp)
movb $0x0, -0x9d(%rbp)
jmp 0x9cfd
movl $0x65756c62, -0xa0(%rbp) # imm = 0x65756C62
movq $0x4, -0xa8(%rbp)
movb $0x0, -0x9c(%rbp)
jmp 0x9cfd
movq $0x0, -0xa8(%rbp)
movb $0x0, -0xa0(%rbp)
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
movq %r14, %rdi
callq 0x4190
movq %rax, %r14
leaq 0x6d8e(%rip), %rsi      # 0x10aab
movl $0x1, %edx
movq %rax, %rdi
callq 0x4190
movq (%rbx), %rax
movl 0x3c(%rax), %eax
leaq -0x40(%rbp), %r15
movq %r15, -0x10(%r15)
cmpq $0x4, %rax
ja 0x9db2
leaq 0x645b(%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 0x9d75
movl $0x666c6f77, -0x40(%rbp) # imm = 0x666C6F77
jmp 0x9d8a
movw $0x6e61, 0x4(%r15)      # imm = 0x6E61
movl $0x6d656369, (%r15)     # imm = 0x6D656369
movq $0x6, -0x48(%rbp)
movb $0x0, -0x3a(%rbp)
jmp 0x9dbe
movl $0x6e6f696c, -0x40(%rbp) # imm = 0x6E6F696C
movq $0x4, -0x48(%rbp)
movb $0x0, -0x3c(%rbp)
jmp 0x9dbe
movb $0x61, 0x4(%r15)
movl $0x6a6e696e, (%r15)     # imm = 0x6A6E696E
movq $0x5, -0x48(%rbp)
movb $0x0, -0x3b(%rbp)
jmp 0x9dbe
movq $0x0, -0x48(%rbp)
movb $0x0, -0x40(%rbp)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %r14, %rdi
callq 0x4190
movq %rax, %r14
leaq 0x6cd3(%rip), %rsi      # 0x10aab
movl $0x1, %edx
movq %rax, %rdi
callq 0x4190
movq (%rbx), %rax
movq 0x30(%rax), %rsi
movq %r14, %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 -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x9e33
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0xb0(%rbp), %rdi
cmpq %r12, %rdi
je 0x9e4e
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x9e67
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x4170
leaq 0x40(%r13), %rbx
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x9e87
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x4170
movq 0x40(%r13), %rdi
movq 0x48(%r13), %rsi
leaq -0x2c(%rbp), %rdx
callq 0xa81a
movq 0x48(%r13), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x5826
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x9ef1
movq %rax, %rbx
jmp 0x9f0c
movq %rax, %rbx
movq -0xc0(%rbp), %rdi
testq %rdi, %rdi
je 0x9f46
callq 0x57ba
jmp 0x9f46
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x9ef1
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0xb0(%rbp), %rdi
cmpq %r12, %rdi
je 0x9f0c
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x9f2a
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x4170
jmp 0x9f2a
movq %rax, %rbx
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x9f46
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x4170
movq %rbx, %rdi
callq 0x4230