// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x120, %rsp            # imm = 0x120
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movq %rdx, %r15
movq %rsi, %r14
movb $0x0, 0x10(%rdi)
movq (%rdx), %rax
leaq -0xc0(%rbp), %rdi
movq %rdx, %rsi
callq *0x28(%rax)
movl 0x8(%r14), %r12d
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
cvtsi2sd %eax, %xmm0
movsd 0x7a96(%rip), %xmm1     # 0x108e8
addsd %xmm1, %xmm0
divsd %xmm0, %xmm1
cvtsi2sd %r12d, %xmm0
mulsd %xmm1, %xmm0
callq 0x4030
cvttsd2si %xmm0, %r12d
movq (%r15), %rax
movq %r15, %rdi
movl %r12d, %esi
callq *0x48(%rax)
leaq -0x100(%rbp), %rdi
movl %r12d, %esi
callq 0x851e
leaq 0x7b1d(%rip), %rsi      # 0x109ac
leaq -0x120(%rbp), %rdi
leaq -0x100(%rbp), %rdx
callq 0x84f0
leaq 0x7a47(%rip), %rdx      # 0x108f0
leaq -0x140(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x84c7
leaq -0x40(%rbp), %rdi
leaq -0x140(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
callq 0x9201
leaq 0x7d88(%rip), %rdx      # 0x10c62
leaq -0x60(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x84c7
movq (%r15), %rax
movq %r15, %rdi
callq *0x18(%rax)
leaq -0xe0(%rbp), %rdi
movl %eax, %esi
callq 0x851e
leaq -0x80(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
callq 0x9190
leaq 0x7cac(%rip), %rdx      # 0x10bc5
leaq -0xa0(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x84c7
leaq -0xa0(%rbp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x41d0
movq %r12, %rdi
callq 0x40e0
leaq -0x80(%rbp), %rdi
callq 0x40e0
leaq -0xe0(%rbp), %rdi
callq 0x40e0
leaq -0x60(%rbp), %rdi
callq 0x40e0
leaq -0x40(%rbp), %rdi
callq 0x40e0
leaq -0x140(%rbp), %rdi
callq 0x40e0
leaq -0x120(%rbp), %rdi
callq 0x40e0
leaq -0x100(%rbp), %rdi
callq 0x40e0
movq (%r15), %rax
movq %r15, %rdi
callq *0x18(%rax)
testl %eax, %eax
jne 0x903b
leaq 0x7956(%rip), %rdx      # 0x108fc
leaq -0x60(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x848f
movq (%r15), %rax
movq %r15, %rdi
callq *0x20(%rax)
leaq -0x40(%rbp), %rdi
movl %eax, %esi
callq 0x851e
leaq -0x80(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x9190
leaq 0x7354(%rip), %rdx      # 0x10336
leaq -0xa0(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x84c7
leaq -0xa0(%rbp), %rsi
movq %rbx, %rdi
callq 0x42b0
leaq -0xa0(%rbp), %rdi
callq 0x40e0
leaq -0x80(%rbp), %rdi
callq 0x40e0
leaq -0x40(%rbp), %rdi
callq 0x40e0
leaq -0x60(%rbp), %rdi
callq 0x40e0
movq (%r15), %rax
movq %r15, %rdi
callq *0x20(%rax)
movq (%r14), %rcx
movq %r14, %rdi
movl %eax, %esi
callq *(%rcx)
leaq -0xc0(%rbp), %rdi
callq 0x40e0
movq %rbx, %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq -0xa0(%rbp), %rdi
callq 0x40e0
jmp 0x906e
movq %rax, %r14
leaq -0x80(%rbp), %rdi
callq 0x40e0
jmp 0x907c
movq %rax, %r14
leaq -0x40(%rbp), %rdi
callq 0x40e0
jmp 0x908c
jmp 0x9107
movq %rax, %r14
leaq -0x60(%rbp), %rdi
jmp 0x9100
movq %rax, %r14
leaq -0x80(%rbp), %rdi
callq 0x40e0
jmp 0x90a3
movq %rax, %r14
leaq -0xe0(%rbp), %rdi
callq 0x40e0
jmp 0x90cf
movq %rax, %r14
jmp 0x90d8
movq %rax, %r14
jmp 0x90e1
movq %rax, %r14
jmp 0x90ed
movq %rax, %r14
jmp 0x90f9
jmp 0x9107
movq %rax, %r14
jmp 0x9116
movq %rax, %r14
leaq -0x60(%rbp), %rdi
callq 0x40e0
leaq -0x40(%rbp), %rdi
callq 0x40e0
leaq -0x140(%rbp), %rdi
callq 0x40e0
leaq -0x120(%rbp), %rdi
callq 0x40e0
leaq -0x100(%rbp), %rdi
callq 0x40e0
jmp 0x910a
movq %rax, %r14
leaq -0xc0(%rbp), %rdi
callq 0x40e0
movq %rbx, %rdi
callq 0x40e0
movq %r14, %rdi
callq 0x4280