// File: 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
subq $0x160, %rsp            # imm = 0x160
callq 0x16fd0
movl $0x60, %edi
callq 0x4190
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xf0(%rbp)
xorl %esi, %esi
movl $0x1, %edx
movl $0x14, %ecx
movsd 0x74ad(%rip), %xmm0     # 0x1e8b8
callq 0xd0e0
jmp 0x17412
movq -0xf0(%rbp), %rsi
leaq -0x10(%rbp), %rdi
callq 0x17c80
movl $0x60, %edi
callq 0x4190
movq %rax, -0xf8(%rbp)
jmp 0x17435
movq -0xf8(%rbp), %rdi
movl $0x1, %esi
movl $0x2, %edx
movl $0x2, %ecx
movsd 0x746d(%rip), %xmm0     # 0x1e8c0
callq 0xd870
jmp 0x1745a
movq -0xf8(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x17cb0
jmp 0x1746c
movl $0x40, %edi
callq 0x4190
movq %rax, -0x100(%rbp)
jmp 0x1747f
movq -0x100(%rbp), %rdi
xorl %esi, %esi
callq 0xdae0
jmp 0x1748f
movq -0x100(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x17ce0
jmp 0x174a1
movl $0x40, %edi
callq 0x4190
movq %rax, -0x108(%rbp)
jmp 0x174b4
movq -0x108(%rbp), %rdi
xorl %esi, %esi
callq 0xdae0
jmp 0x174c4
movq -0x108(%rbp), %rsi
leaq -0x50(%rbp), %rdi
callq 0x17ce0
jmp 0x174d6
movl $0x40, %edi
callq 0x4190
movq %rax, -0x110(%rbp)
jmp 0x174e9
movq -0x110(%rbp), %rdi
xorl %esi, %esi
callq 0xdd40
jmp 0x174f9
movq -0x110(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x17d10
jmp 0x1750b
movl $0x48, %edi
callq 0x4190
movq %rax, -0x118(%rbp)
jmp 0x1751e
movq -0x118(%rbp), %rdi
xorl %esi, %esi
callq 0xdf70
jmp 0x1752e
movq -0x118(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x17be0
jmp 0x17540
leaq -0x10(%rbp), %rdi
callq 0x5db0
movq %rax, -0x128(%rbp)
leaq -0x80(%rbp), %rdi
movq %rdi, -0x120(%rbp)
leaq -0x60(%rbp), %rsi
callq 0x6390
movq -0x128(%rbp), %rdi
movq -0x120(%rbp), %rsi
callq 0xd280
jmp 0x17579
leaq -0x80(%rbp), %rdi
callq 0x63c0
leaq -0x10(%rbp), %rdi
callq 0x5db0
movq %rax, -0x138(%rbp)
leaq -0x90(%rbp), %rdi
movq %rdi, -0x130(%rbp)
leaq -0x70(%rbp), %rsi
callq 0x6390
movq -0x138(%rbp), %rdi
movq -0x130(%rbp), %rsi
callq 0xd280
jmp 0x175be
leaq -0x90(%rbp), %rdi
callq 0x63c0
leaq -0x30(%rbp), %rdi
callq 0x5db0
movq %rax, -0x148(%rbp)
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x140(%rbp)
leaq -0x10(%rbp), %rsi
callq 0x6640
movq -0x148(%rbp), %rdi
movq -0x140(%rbp), %rsi
movq (%rdi), %rax
movq 0x28(%rax), %rax
callq *%rax
jmp 0x1760a
leaq -0xa0(%rbp), %rdi
callq 0x6670
leaq -0xc8(%rbp), %rdi
movl $0x2, %esi
callq 0x17d40
jmp 0x17629
leaq -0xd8(%rbp), %rdi
movq %rdi, -0x150(%rbp)
leaq -0x10(%rbp), %rsi
callq 0x6640
movq -0x150(%rbp), %rsi
leaq -0xc8(%rbp), %rdi
callq 0x17d80
jmp 0x17655
leaq -0xd8(%rbp), %rdi
callq 0x6670
leaq -0xe8(%rbp), %rdi
movq %rdi, -0x158(%rbp)
leaq -0x30(%rbp), %rsi
callq 0x6640
movq -0x158(%rbp), %rsi
leaq -0xc8(%rbp), %rdi
callq 0x17d80
jmp 0x1768d
leaq -0xe8(%rbp), %rdi
callq 0x6670
leaq -0xc8(%rbp), %rdi
callq 0x4880
jmp 0x176a7
leaq -0xc8(%rbp), %rdi
callq 0x17df0
leaq -0x70(%rbp), %rdi
callq 0x63c0
leaq -0x60(%rbp), %rdi
callq 0x63c0
leaq -0x50(%rbp), %rdi
callq 0x63c0
leaq -0x40(%rbp), %rdi
callq 0x63c0
leaq -0x30(%rbp), %rdi
callq 0x6670
leaq -0x10(%rbp), %rdi
callq 0x6670
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
movq -0xf0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x60, %esi
callq 0x41a0
jmp 0x178f1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x178e8
movq -0xf8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x60, %esi
callq 0x41a0
jmp 0x178e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x178df
movq -0x100(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x40, %esi
callq 0x41a0
jmp 0x178df
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x178d6
movq -0x108(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x40, %esi
callq 0x41a0
jmp 0x178d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x178cd
movq -0x110(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x40, %esi
callq 0x41a0
jmp 0x178cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x178c4
movq -0x118(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x48, %esi
callq 0x41a0
jmp 0x178c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x63c0
jmp 0x178bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x63c0
jmp 0x178bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x6670
jmp 0x178bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x178bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x6670
jmp 0x178af
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x6670
jmp 0x178af
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x17df0
leaq -0x70(%rbp), %rdi
callq 0x63c0
leaq -0x60(%rbp), %rdi
callq 0x63c0
leaq -0x50(%rbp), %rdi
callq 0x63c0
leaq -0x40(%rbp), %rdi
callq 0x63c0
leaq -0x30(%rbp), %rdi
callq 0x6670
leaq -0x10(%rbp), %rdi
callq 0x6670
movq -0x18(%rbp), %rdi
callq 0x4300
nopw (%rax,%rax)