// File: /workspace/github_cpp_makefile_star2_O1/Worthy-Wang[P]Warcraft3-StartWar/TestWarcraft.cpp
// Function: test4()
void test4()
{
    test1();
    WarriorPtr warrior1(new Dragon(RED, 1, 20, 20));
    WarriorPtr warrior2(new Wolf(BLUE, 2, 2, 10));
    WeaponPtr weapon1(new Sword(DRAGON));
    WeaponPtr weapon11(new Sword(DRAGON));
    WeaponPtr weapon2(new Bomb(DRAGON));
    WeaponPtr weapon3(new Arrow(DRAGON));

    warrior1->setWeapon(weapon2);
    warrior1->setWeapon(weapon3);
    
    warrior2->stealWeapons(warrior1);

    City city(2);
    city.attach(warrior1);
    city.attach(warrior2);
    city.Battle();
 
    // vector<WeaponPtr>& weapons = warrior2->getWeapons();
    // for (auto &e : weapons)
    //     cout << e->getName() << ":" << e->getDurability() << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xe0, %rsp
callq 0xc1d4
movl $0x60, %edi
callq 0x4160
movq %rax, %r14
movsd 0x4350(%rip), %xmm0     # 0x10900
movl $0x1, %edx
movq %rax, %rdi
xorl %esi, %esi
movl $0x14, %ecx
callq 0x7b82
leaq -0x18(%rbp), %rdi
movq %r14, -0x8(%rdi)
movq %r14, %rsi
callq 0xb682
movl $0x60, %edi
callq 0x4160
movq %rax, %r14
movsd 0x431f(%rip), %xmm0     # 0x10908
movl $0x2, %edx
movq %rax, %rdi
movl $0x1, %esi
movl $0x2, %ecx
callq 0x82b2
leaq -0x28(%rbp), %rdi
movq %r14, -0x8(%rdi)
movq %r14, %rsi
callq 0xbc2e
movl $0x40, %edi
callq 0x4160
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x847c
leaq -0xe0(%rbp), %rdi
movq %r14, -0x8(%rdi)
movq %r14, %rsi
callq 0xbd96
movl $0x40, %edi
callq 0x4160
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x847c
leaq -0xd0(%rbp), %rdi
movq %r14, -0x8(%rdi)
movq %r14, %rsi
callq 0xbd96
movl $0x40, %edi
callq 0x4160
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x86c6
leaq -0x78(%rbp), %rdi
movq %r14, -0x8(%rdi)
movq %r14, %rsi
callq 0xbefe
movl $0x48, %edi
callq 0x4160
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x8910
leaq -0x68(%rbp), %rdi
movq %r14, -0x8(%rdi)
movq %r14, %rsi
callq 0xc066
movq -0x20(%rbp), %rdi
movq -0x80(%rbp), %rcx
movq -0x78(%rbp), %rax
movq %rcx, -0x60(%rbp)
movq %rax, -0x58(%rbp)
testq %rax, %rax
je 0xc6e0
movq 0xa8f6(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xc6dc
incl 0x8(%rax)
jmp 0xc6e0
lock
incl 0x8(%rax)
addq $0x40, %rdi
leaq -0x60(%rbp), %rsi
callq 0x8fd2
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0xc6fb
callq 0x57ba
movq -0x20(%rbp), %rdi
movq -0x70(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rcx, -0x50(%rbp)
movq %rax, -0x48(%rbp)
testq %rax, %rax
je 0xc729
movq 0xa8ad(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xc725
incl 0x8(%rax)
jmp 0xc729
lock
incl 0x8(%rax)
addq $0x40, %rdi
leaq -0x50(%rbp), %rsi
callq 0x8fd2
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0xc744
callq 0x57ba
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, -0x40(%rbp)
movq %rax, -0x38(%rbp)
testq %rax, %rax
je 0xc772
movq 0xa864(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xc76e
incl 0x8(%rax)
jmp 0xc772
lock
incl 0x8(%rax)
movq (%rdi), %rax
leaq -0x40(%rbp), %rsi
callq *0x28(%rax)
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0xc78a
callq 0x57ba
movq $0x2, -0xa8(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, -0xa0(%rbp)
movups %xmm0, -0x90(%rbp)
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, -0xc8(%rbp)
movq %rax, -0xc0(%rbp)
testq %rax, %rax
je 0xc7d6
movq 0xa800(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xc7d2
incl 0x8(%rax)
jmp 0xc7d6
lock
incl 0x8(%rax)
leaq -0xa8(%rbp), %rdi
leaq -0xc8(%rbp), %rbx
movq %rbx, %rsi
callq 0xcbea
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0xc7fa
callq 0x57ba
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, -0xb8(%rbp)
movq %rax, -0xb0(%rbp)
testq %rax, %rax
je 0xc82a
movq 0xa7ac(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xc826
incl 0x8(%rax)
jmp 0xc82a
lock
incl 0x8(%rax)
leaq -0xa8(%rbp), %rdi
leaq -0xb8(%rbp), %rbx
movq %rbx, %rsi
callq 0xcbea
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0xc84e
callq 0x57ba
leaq -0xa8(%rbp), %rdi
callq 0x4638
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0xc86b
callq 0x57ba
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0xc87c
callq 0x57ba
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0xc88a
callq 0x57ba
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0xc898
callq 0x57ba
movq -0xd0(%rbp), %rdi
testq %rdi, %rdi
je 0xc8a9
callq 0x57ba
movq -0xe0(%rbp), %rdi
testq %rdi, %rdi
je 0xc8ba
callq 0x57ba
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0xc8c8
callq 0x57ba
movq -0x18(%rbp), %rdi
testq %rdi, %rdi
je 0xc8d6
callq 0x57ba
addq $0xe0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
callq 0xcc12
jmp 0xc916
movq %rax, %rbx
movq -0x38(%rbp), %rdi
jmp 0xc90c
movq %rax, %rbx
movq -0x48(%rbp), %rdi
jmp 0xc90c
movq %rax, %rbx
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0xc916
callq 0x57ba
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0xc995
callq 0x57ba
jmp 0xc995
movq %rax, %rbx
movl $0x48, %esi
movq %r14, %rdi
callq 0x4170
jmp 0xc995
movq %rax, %rbx
movl $0x40, %esi
movq %r14, %rdi
callq 0x4170
jmp 0xc9a8
movq %rax, %rbx
movl $0x40, %esi
movq %r14, %rdi
callq 0x4170
jmp 0xc9be
movq %rax, %rbx
movl $0x40, %esi
movq %r14, %rdi
callq 0x4170
jmp 0xc9d4
movq %rax, %rbx
movl $0x60, %esi
movq %r14, %rdi
callq 0x4170
jmp 0xc9e7
movq %rax, %rbx
movl $0x60, %esi
movq %r14, %rdi
callq 0x4170
jmp 0xc9f5
movq %rax, %rbx
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0xc9a8
callq 0x57ba
jmp 0xc9a8
movq %rax, %rbx
movq -0xd0(%rbp), %rdi
testq %rdi, %rdi
je 0xc9be
callq 0x57ba
jmp 0xc9be
movq %rax, %rbx
movq -0xe0(%rbp), %rdi
testq %rdi, %rdi
je 0xc9d4
callq 0x57ba
jmp 0xc9d4
movq %rax, %rbx
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0xc9e7
callq 0x57ba
jmp 0xc9e7
movq %rax, %rbx
movq -0x18(%rbp), %rdi
testq %rdi, %rdi
je 0xc9f5
callq 0x57ba
movq %rbx, %rdi
callq 0x4230