// File: malcolmyeh[P]CC3K/player.cc
// Function: Player::dealDamage[abi:cxx11](Character*)
std::string Player::dealDamage(Character *opponent)
{
    double amount;
    std::string combatMsg;
    std::string defender = opponent->getRace();
    int attack = this->Atk;
    int defense = opponent->getDef();

    amount = ceil((100.0 / (100.0 + defense)) * attack);

    opponent->takeDamage((int)amount);

    combatMsg = "You deal " + std::to_string((int)amount) + " damage to " + defender + " (HP: " + std::to_string(opponent->getHP()) + "). ";

    if (opponent->getHP() == 0)
    {
        combatMsg += defender + " has been slain. You have earned " + std::to_string(opponent->getGold()) + " gold. ";
        this->updateGold(opponent->getGold());
    }

    return combatMsg;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movq %rdi, -0x1f8(%rbp)
movq %rdi, %rax
movq %rax, -0x1f0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movb $0x0, -0x21(%rbp)
callq 0x4280
movq -0x18(%rbp), %rsi
movq (%rsi), %rax
movq 0x28(%rax), %rax
leaq -0x48(%rbp), %rdi
callq *%rax
jmp 0x1178f
movq -0x1e8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x58(%rbp)
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movl %eax, -0x1fc(%rbp)
jmp 0x117b1
movl -0x1fc(%rbp), %eax
movl %eax, -0x5c(%rbp)
cvtsi2sdl -0x5c(%rbp), %xmm1
movsd 0xd0a1(%rip), %xmm0     # 0x1e868
addsd %xmm0, %xmm1
divsd %xmm1, %xmm0
cvtsi2sdl -0x58(%rbp), %xmm1
mulsd %xmm1, %xmm0
callq 0x4050
movsd %xmm0, -0x20(%rbp)
movq -0x18(%rbp), %rdi
cvttsd2si -0x20(%rbp), %esi
movq (%rdi), %rax
movq 0x48(%rax), %rax
callq *%rax
jmp 0x117f6
cvttsd2si -0x20(%rbp), %esi
leaq -0x140(%rbp), %rdi
callq 0xdbe0
jmp 0x11809
leaq 0xd11c(%rip), %rsi      # 0x1e92c
leaq -0x120(%rbp), %rdi
leaq -0x140(%rbp), %rdx
callq 0xdb90
jmp 0x11825
leaq 0xd044(%rip), %rdx      # 0x1e870
leaq -0x100(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0xdb40
jmp 0x11841
leaq -0xe0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x11e00
jmp 0x1185a
leaq 0xd331(%rip), %rdx      # 0x1eb92
leaq -0xc0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0xdb40
jmp 0x11876
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movl %eax, -0x200(%rbp)
jmp 0x1188b
movl -0x200(%rbp), %esi
leaq -0x160(%rbp), %rdi
callq 0xdbe0
jmp 0x1189f
leaq -0xa0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
leaq -0x160(%rbp), %rdx
callq 0x11d30
jmp 0x118bb
leaq 0xd24b(%rip), %rdx      # 0x1eb0d
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0xdb40
jmp 0x118d4
movq -0x1f8(%rbp), %rdi
leaq -0x80(%rbp), %rsi
movq %rsi, -0x210(%rbp)
callq 0x4220
movq -0x210(%rbp), %rdi
callq 0x4130
leaq -0xa0(%rbp), %rdi
callq 0x4130
leaq -0x160(%rbp), %rdi
callq 0x4130
leaq -0xc0(%rbp), %rdi
callq 0x4130
leaq -0xe0(%rbp), %rdi
callq 0x4130
leaq -0x100(%rbp), %rdi
callq 0x4130
leaq -0x120(%rbp), %rdi
callq 0x4130
leaq -0x140(%rbp), %rdi
callq 0x4130
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movl %eax, -0x204(%rbp)
jmp 0x11960
movl -0x204(%rbp), %eax
cmpl $0x0, %eax
jne 0x11ba5
leaq 0xcf06(%rip), %rdx      # 0x1e87c
leaq -0x1c0(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0xdac0
jmp 0x11988
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movl %eax, -0x214(%rbp)
jmp 0x1199d
movl -0x214(%rbp), %esi
leaq -0x1e0(%rbp), %rdi
callq 0xdbe0
jmp 0x119b1
leaq -0x1a0(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
leaq -0x1e0(%rbp), %rdx
callq 0x11d30
jmp 0x119cd
leaq 0xc8e2(%rip), %rdx      # 0x1e2b6
leaq -0x180(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0xdb40
jmp 0x119e9
movq -0x1f8(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x4240
jmp 0x119fe
leaq -0x180(%rbp), %rdi
callq 0x4130
leaq -0x1a0(%rbp), %rdi
callq 0x4130
leaq -0x1e0(%rbp), %rdi
callq 0x4130
leaq -0x1c0(%rbp), %rdi
callq 0x4130
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movl %eax, -0x218(%rbp)
jmp 0x11a43
movl -0x218(%rbp), %esi
movq -0x1e8(%rbp), %rdi
movq (%rdi), %rax
movq (%rax), %rax
callq *%rax
jmp 0x11a5a
jmp 0x11ba5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11be1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11bba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11b2f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11b23
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11b17
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11b0b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11aff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11af3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x4130
leaq -0x160(%rbp), %rdi
callq 0x4130
leaq -0xc0(%rbp), %rdi
callq 0x4130
leaq -0xe0(%rbp), %rdi
callq 0x4130
leaq -0x100(%rbp), %rdi
callq 0x4130
leaq -0x120(%rbp), %rdi
callq 0x4130
leaq -0x140(%rbp), %rdi
callq 0x4130
jmp 0x11bba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11b97
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11b8b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x11b7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x180(%rbp), %rdi
callq 0x4130
leaq -0x1a0(%rbp), %rdi
callq 0x4130
leaq -0x1e0(%rbp), %rdi
callq 0x4130
leaq -0x1c0(%rbp), %rdi
callq 0x4130
jmp 0x11bba
movb $0x1, -0x21(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x4130
testb $0x1, -0x21(%rbp)
jne 0x11bd1
jmp 0x11bc5
leaq -0x48(%rbp), %rdi
callq 0x4130
jmp 0x11be1
movq -0x1f8(%rbp), %rdi
callq 0x4130
movq -0x1f0(%rbp), %rax
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
movq -0x1f8(%rbp), %rdi
callq 0x4130
movq -0x50(%rbp), %rdi
callq 0x42f0
nopw %cs:(%rax,%rax)