// File: /workspace/github_cpp_makefile_star2_O2/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 0xaf70
pushq $0x60
popq %rdi
callq 0x4170
movq %rax, %r14
pushq $0x1
popq %rdx
pushq $0x14
popq %rcx
movsd 0x3702(%rip), %xmm0     # 0xe8b8
movq %rax, %rdi
xorl %esi, %esi
callq 0x737c
leaq -0x20(%rbp), %rdi
movq %r14, %rsi
callq 0xa2ea
pushq $0x60
popq %rdi
callq 0x4170
movq %rax, %r14
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
pushq $0x2
popq %rcx
movsd 0x36d8(%rip), %xmm0     # 0xe8c0
movq %rax, %rdi
callq 0x78c8
leaq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0xa92a
pushq $0x40
popq %rdi
callq 0x4170
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x7a18
leaq -0xa0(%rbp), %rdi
movq %r14, %rsi
callq 0xaaba
pushq $0x40
popq %rdi
callq 0x4170
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x7a18
leaq -0x90(%rbp), %rdi
movq %r14, %rsi
callq 0xaaba
pushq $0x40
popq %rdi
callq 0x4170
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x7bb4
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
callq 0xac4a
pushq $0x48
popq %rdi
callq 0x4170
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x7d4e
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0xadda
movq -0x20(%rbp), %rbx
leaq -0x80(%rbp), %r14
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x52c4
addq $0x40, %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x81d4
leaq -0x78(%rbp), %rdi
callq 0x5302
movq -0x20(%rbp), %rbx
leaq -0x70(%rbp), %r14
leaq -0x40(%rbp), %rsi
movq %r14, %rdi
callq 0x52c4
addq $0x40, %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x81d4
leaq -0x68(%rbp), %rdi
callq 0x5302
movq -0x30(%rbp), %rbx
leaq -0x60(%rbp), %r14
leaq -0x20(%rbp), %rsi
movq %r14, %rdi
callq 0x5392
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
callq *0x28(%rax)
leaq -0x58(%rbp), %rdi
callq 0x5302
leaq -0xe8(%rbp), %rbx
movq $0x2, (%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
movups %xmm0, 0x18(%rbx)
leaq -0xc0(%rbp), %r14
leaq -0x20(%rbp), %rsi
movq %r14, %rdi
callq 0x5392
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb60a
leaq -0xb8(%rbp), %rdi
callq 0x5302
leaq -0xb0(%rbp), %r14
leaq -0x30(%rbp), %rsi
movq %r14, %rdi
callq 0x5392
movq %rbx, %rdi
movq %r14, %rsi
callq 0xb60a
leaq -0xa8(%rbp), %rdi
callq 0x5302
movq %rbx, %rdi
callq 0x4558
leaq -0xe8(%rbp), %rdi
callq 0xb62a
leaq -0x38(%rbp), %rdi
callq 0x5302
leaq -0x48(%rbp), %rdi
callq 0x5302
leaq -0x88(%rbp), %rdi
callq 0x5302
leaq -0x98(%rbp), %rdi
callq 0x5302
leaq -0x28(%rbp), %rdi
callq 0x5302
leaq -0x18(%rbp), %rdi
callq 0x5302
addq $0xe0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq -0xe8(%rbp), %rdi
callq 0xb62a
jmp 0xb3ff
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
jmp 0xb3fa
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
jmp 0xb3fa
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x5302
leaq -0x38(%rbp), %rdi
callq 0x5302
jmp 0xb46d
movq %rax, %rbx
pushq $0x48
popq %rsi
movq %r14, %rdi
callq 0x4180
jmp 0xb46d
movq %rax, %rbx
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x4180
jmp 0xb47b
movq %rax, %rbx
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x4180
jmp 0xb487
movq %rax, %rbx
pushq $0x40
popq %rsi
movq %r14, %rdi
callq 0x4180
jmp 0xb493
movq %rax, %rbx
pushq $0x60
popq %rsi
movq %r14, %rdi
callq 0x4180
jmp 0xb49c
movq %rax, %rbx
pushq $0x60
popq %rsi
movq %r14, %rdi
callq 0x4180
jmp 0xb4a5
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x5302
jmp 0xb47b
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x5302
leaq -0x98(%rbp), %rdi
callq 0x5302
leaq -0x28(%rbp), %rdi
callq 0x5302
leaq -0x18(%rbp), %rdi
callq 0x5302
movq %rbx, %rdi
callq 0x4250
movq %rax, %rbx
jmp 0xb487
movq %rax, %rbx
jmp 0xb493
movq %rax, %rbx
jmp 0xb49c