// File: /workspace/github_cpp_makefile_star2_O3/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 0xc154
movl $0x60, %edi
callq 0x4160
movq %rax, %r14
movsd 0x43d0(%rip), %xmm0     # 0x10900
movl $0x1, %edx
movq %rax, %rdi
xorl %esi, %esi
movl $0x14, %ecx
callq 0x7af4
leaq -0x18(%rbp), %rdi
movq %r14, -0x8(%rdi)
movq %r14, %rsi
callq 0xb60e
movl $0x60, %edi
callq 0x4160
movq %rax, %r14
movsd 0x439f(%rip), %xmm0     # 0x10908
movl $0x2, %edx
movq %rax, %rdi
movl $0x1, %esi
movl $0x2, %ecx
callq 0x822c
leaq -0x28(%rbp), %rdi
movq %r14, -0x8(%rdi)
movq %r14, %rsi
callq 0xbbae
movl $0x40, %edi
callq 0x4160
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x83f8
leaq -0xe0(%rbp), %rdi
movq %r14, -0x8(%rdi)
movq %r14, %rsi
callq 0xbd16
movl $0x40, %edi
callq 0x4160
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x83f8
leaq -0xd0(%rbp), %rdi
movq %r14, -0x8(%rdi)
movq %r14, %rsi
callq 0xbd16
movl $0x40, %edi
callq 0x4160
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x8644
leaq -0x78(%rbp), %rdi
movq %r14, -0x8(%rdi)
movq %r14, %rsi
callq 0xbe7e
movl $0x48, %edi
callq 0x4160
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x8890
leaq -0x68(%rbp), %rdi
movq %r14, -0x8(%rdi)
movq %r14, %rsi
callq 0xbfe6
movq -0x20(%rbp), %rdi
movq -0x80(%rbp), %rcx
movq -0x78(%rbp), %rax
movq %rcx, -0x60(%rbp)
movq %rax, -0x58(%rbp)
testq %rax, %rax
je 0xc660
movq 0xa976(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xc65c
incl 0x8(%rax)
jmp 0xc660
lock
incl 0x8(%rax)
addq $0x40, %rdi
leaq -0x60(%rbp), %rsi
callq 0x8f74
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0xc67b
callq 0x57a8
movq -0x20(%rbp), %rdi
movq -0x70(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rcx, -0x50(%rbp)
movq %rax, -0x48(%rbp)
testq %rax, %rax
je 0xc6a9
movq 0xa92d(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xc6a5
incl 0x8(%rax)
jmp 0xc6a9
lock
incl 0x8(%rax)
addq $0x40, %rdi
leaq -0x50(%rbp), %rsi
callq 0x8f74
movq -0x48(%rbp), %rdi
testq %rdi, %rdi
je 0xc6c4
callq 0x57a8
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, -0x40(%rbp)
movq %rax, -0x38(%rbp)
testq %rax, %rax
je 0xc6f2
movq 0xa8e4(%rip), %rcx      # 0x16fc8
cmpb $0x0, (%rcx)
je 0xc6ee
incl 0x8(%rax)
jmp 0xc6f2
lock
incl 0x8(%rax)
movq (%rdi), %rax
leaq -0x40(%rbp), %rsi
callq *0x28(%rax)
movq -0x38(%rbp), %rdi
testq %rdi, %rdi
je 0xc70a
callq 0x57a8
movq $0x2, -0xa8(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, -0xa0(%rbp)
movups %xmm0, -0x90(%rbp)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
leaq -0xc0(%rbp), %rsi
movq %rax, -0x8(%rsi)
movq %rcx, (%rsi)
testq %rcx, %rcx
je 0xc75d
movq 0xa880(%rip), %rdx      # 0x16fc8
cmpb $0x0, (%rdx)
je 0xc752
incl 0x8(%rcx)
jmp 0xc75d
lock
incl 0x8(%rcx)
movq -0xc8(%rbp), %rax
xorl %ecx, %ecx
cmpl $0x0, 0x8(%rax)
setne %cl
leaq -0x98(%rbp), %r14
leaq -0x88(%rbp), %rbx
movq %rbx, %rdi
cmoveq %r14, %rdi
shll $0x4, %ecx
movq %rax, -0xa0(%rbp,%rcx)
callq 0xac4a
movq -0xc0(%rbp), %rdi
testq %rdi, %rdi
je 0xc79c
callq 0x57a8
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
leaq -0xb0(%rbp), %rsi
movq %rax, -0x8(%rsi)
movq %rcx, (%rsi)
testq %rcx, %rcx
je 0xc7d3
movq 0xa80a(%rip), %rdx      # 0x16fc8
cmpb $0x0, (%rdx)
je 0xc7c8
incl 0x8(%rcx)
jmp 0xc7d3
lock
incl 0x8(%rcx)
movq -0xb8(%rbp), %rax
xorl %ecx, %ecx
cmpl $0x0, 0x8(%rax)
setne %cl
cmoveq %r14, %rbx
shll $0x4, %ecx
movq %rax, -0xa0(%rbp,%rcx)
movq %rbx, %rdi
callq 0xac4a
movq -0xb0(%rbp), %rdi
testq %rdi, %rdi
je 0xc804
callq 0x57a8
leaq -0xa8(%rbp), %rdi
callq 0x4618
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0xc821
callq 0x57a8
movq -0x98(%rbp), %rdi
testq %rdi, %rdi
je 0xc832
callq 0x57a8
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0xc840
callq 0x57a8
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0xc84e
callq 0x57a8
movq -0xd0(%rbp), %rdi
testq %rdi, %rdi
je 0xc85f
callq 0x57a8
movq -0xe0(%rbp), %rdi
testq %rdi, %rdi
je 0xc870
callq 0x57a8
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0xc87e
callq 0x57a8
movq -0x18(%rbp), %rdi
testq %rdi, %rdi
je 0xc88c
callq 0x57a8
addq $0xe0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
callq 0xcb92
jmp 0xc8cc
movq %rax, %rbx
movq -0x38(%rbp), %rdi
jmp 0xc8c2
movq %rax, %rbx
movq -0x48(%rbp), %rdi
jmp 0xc8c2
movq %rax, %rbx
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0xc8cc
callq 0x57a8
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
je 0xc94b
callq 0x57a8
jmp 0xc94b
movq %rax, %rbx
movl $0x48, %esi
movq %r14, %rdi
callq 0x4170
jmp 0xc94b
movq %rax, %rbx
movl $0x40, %esi
movq %r14, %rdi
callq 0x4170
jmp 0xc95e
movq %rax, %rbx
movl $0x40, %esi
movq %r14, %rdi
callq 0x4170
jmp 0xc974
movq %rax, %rbx
movl $0x40, %esi
movq %r14, %rdi
callq 0x4170
jmp 0xc98a
movq %rax, %rbx
movl $0x60, %esi
movq %r14, %rdi
callq 0x4170
jmp 0xc99d
movq %rax, %rbx
movl $0x60, %esi
movq %r14, %rdi
callq 0x4170
jmp 0xc9ab
movq %rax, %rbx
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0xc95e
callq 0x57a8
jmp 0xc95e
movq %rax, %rbx
movq -0xd0(%rbp), %rdi
testq %rdi, %rdi
je 0xc974
callq 0x57a8
jmp 0xc974
movq %rax, %rbx
movq -0xe0(%rbp), %rdi
testq %rdi, %rdi
je 0xc98a
callq 0x57a8
jmp 0xc98a
movq %rax, %rbx
movq -0x28(%rbp), %rdi
testq %rdi, %rdi
je 0xc99d
callq 0x57a8
jmp 0xc99d
movq %rax, %rbx
movq -0x18(%rbp), %rdi
testq %rdi, %rdi
je 0xc9ab
callq 0x57a8
movq %rbx, %rdi
callq 0x4230