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

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

    int chance = rand() % 8;
    if (chance == 0)
    {
        //BESERK
        amount *= 1.5;
        lifesteal = amount * 0.25;
        this->heal((int)lifesteal);
        opponent->takeDamage((int)amount);
        combatMsg = "BESERK! You deal " + std::to_string((int)amount) + " damage to " + defender + " (HP: " + std::to_string(opponent->getHP()) + "). You lifesteal for " + std::to_string((int)lifesteal) + " HP (HP: " + std::to_string(this->HP) + "). ";

    }
    else if (chance == 1 || chance == 2)
    {
        //lifesteal
        lifesteal = amount * 0.25;
        this->heal((int)lifesteal);
        opponent->takeDamage((int)amount);
        combatMsg = "You deal " + std::to_string((int)amount) + " damage to " + defender + " (HP: " + std::to_string(opponent->getHP()) + "). You lifesteal for " + std::to_string((int)lifesteal) + " HP (HP: " + std::to_string(this->HP) + "). ";
    }
    else if (chance == 3 || chance == 4)
    {
        //critical hit
        amount *= 1.5;
        opponent->takeDamage((int)amount);
        combatMsg = "You deal " + std::to_string((int)amount) + " damage to " + defender + " (HP: " + std::to_string(opponent->getHP()) + "). ";
    }
    else
    {
        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 %r13
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
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 -0x210(%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 0x6f04(%rip), %xmm1     # 0x108e8
addsd %xmm1, %xmm0
divsd %xmm0, %xmm1
cvtsi2sd %r12d, %xmm0
mulsd %xmm1, %xmm0
callq 0x4030
movsd %xmm0, -0x30(%rbp)
callq 0x4070
pushq $0x8
popq %rcx
cltd
idivl %ecx
testl %edx, %edx
je 0x9b90
movsd -0x30(%rbp), %xmm1
cmpl $0x2, %edx
ja 0x9dbd
movsd 0x6f70(%rip), %xmm0     # 0x10998
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %r12d
movq %r14, %rdi
movl %r12d, %esi
callq 0x9152
cvttsd2si -0x30(%rbp), %r13d
movq (%r15), %rax
movq %r15, %rdi
movl %r13d, %esi
callq *0x48(%rax)
leaq -0x1b0(%rbp), %rdi
movl %r13d, %esi
callq 0x851e
leaq 0x6f48(%rip), %rsi      # 0x109ac
leaq -0x1d0(%rbp), %rdi
leaq -0x1b0(%rbp), %rdx
callq 0x84f0
leaq 0x6e72(%rip), %rdx      # 0x108f0
leaq -0x1f0(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x84c7
leaq -0xb0(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
leaq -0x210(%rbp), %rdx
callq 0x9201
leaq 0x71b0(%rip), %rdx      # 0x10c62
leaq -0xd0(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x84c7
movq (%r15), %rax
movq %r15, %rdi
callq *0x18(%rax)
leaq -0x190(%rbp), %rdi
movl %eax, %esi
callq 0x851e
leaq -0xf0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
leaq -0x190(%rbp), %rdx
callq 0x9190
leaq 0x6eb9(%rip), %rdx      # 0x109b6
leaq -0x110(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x84c7
leaq -0x170(%rbp), %rdi
movl %r12d, %esi
callq 0x851e
leaq -0x50(%rbp), %rdi
leaq -0x110(%rbp), %rsi
leaq -0x170(%rbp), %rdx
callq 0x9190
leaq 0x6a9b(%rip), %rdx      # 0x105d8
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x84c7
movl 0x10(%r14), %esi
leaq -0x150(%rbp), %rdi
callq 0x851e
leaq -0x90(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x150(%rbp), %rdx
callq 0x9190
leaq 0x704d(%rip), %rdx      # 0x10bc5
leaq -0x130(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x84c7
jmp 0x9d0d
movsd -0x30(%rbp), %xmm1
mulsd 0x6df3(%rip), %xmm1     # 0x10990
movsd 0x6df3(%rip), %xmm0     # 0x10998
movsd %xmm1, -0x30(%rbp)
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %r12d
movq %r14, %rdi
movl %r12d, %esi
callq 0x9152
cvttsd2si -0x30(%rbp), %r13d
movq (%r15), %rax
movq %r15, %rdi
movl %r13d, %esi
callq *0x48(%rax)
leaq -0x1b0(%rbp), %rdi
movl %r13d, %esi
callq 0x851e
leaq 0x6dbe(%rip), %rsi      # 0x109a4
leaq -0x1d0(%rbp), %rdi
leaq -0x1b0(%rbp), %rdx
callq 0x84f0
leaq 0x6cf0(%rip), %rdx      # 0x108f0
leaq -0x1f0(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x84c7
leaq -0xb0(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
leaq -0x210(%rbp), %rdx
callq 0x9201
leaq 0x702e(%rip), %rdx      # 0x10c62
leaq -0xd0(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x84c7
movq (%r15), %rax
movq %r15, %rdi
callq *0x18(%rax)
leaq -0x190(%rbp), %rdi
movl %eax, %esi
callq 0x851e
leaq -0xf0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
leaq -0x190(%rbp), %rdx
callq 0x9190
leaq 0x6d37(%rip), %rdx      # 0x109b6
leaq -0x110(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x84c7
leaq -0x170(%rbp), %rdi
movl %r12d, %esi
callq 0x851e
leaq -0x50(%rbp), %rdi
leaq -0x110(%rbp), %rsi
leaq -0x170(%rbp), %rdx
callq 0x9190
leaq 0x6919(%rip), %rdx      # 0x105d8
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x84c7
movl 0x10(%r14), %esi
leaq -0x150(%rbp), %rdi
callq 0x851e
leaq -0x90(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x150(%rbp), %rdx
callq 0x9190
leaq 0x6ecb(%rip), %rdx      # 0x10bc5
leaq -0x130(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x84c7
leaq -0x130(%rbp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x41d0
movq %r12, %rdi
callq 0x40e0
leaq -0x90(%rbp), %rdi
callq 0x40e0
leaq -0x150(%rbp), %rdi
callq 0x40e0
leaq -0x70(%rbp), %rdi
callq 0x40e0
leaq -0x50(%rbp), %rdi
callq 0x40e0
leaq -0x170(%rbp), %rdi
callq 0x40e0
leaq -0x110(%rbp), %rdi
callq 0x40e0
leaq -0xf0(%rbp), %rdi
callq 0x40e0
leaq -0x190(%rbp), %rdi
callq 0x40e0
leaq -0xd0(%rbp), %rdi
callq 0x40e0
leaq -0xb0(%rbp), %rdi
callq 0x40e0
leaq -0x1f0(%rbp), %rdi
callq 0x40e0
leaq -0x1d0(%rbp), %rdi
callq 0x40e0
leaq -0x1b0(%rbp), %rdi
jmp 0x9fc7
addl $-0x3, %edx
cmpl $0x1, %edx
ja 0x9e9d
mulsd 0x6bbf(%rip), %xmm1     # 0x10990
cvttsd2si %xmm1, %r12d
movq (%r15), %rax
movq %r15, %rdi
movl %r12d, %esi
callq *0x48(%rax)
leaq -0xd0(%rbp), %rdi
movl %r12d, %esi
callq 0x851e
leaq 0x6bb4(%rip), %rsi      # 0x109ac
leaq -0xf0(%rbp), %rdi
leaq -0xd0(%rbp), %rdx
callq 0x84f0
leaq 0x6ade(%rip), %rdx      # 0x108f0
leaq -0x110(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x84c7
leaq -0x50(%rbp), %rdi
leaq -0x110(%rbp), %rsi
leaq -0x210(%rbp), %rdx
callq 0x9201
leaq 0x6e1f(%rip), %rdx      # 0x10c62
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x84c7
movq (%r15), %rax
movq %r15, %rdi
callq *0x18(%rax)
leaq -0xb0(%rbp), %rdi
movl %eax, %esi
callq 0x851e
leaq -0x90(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
callq 0x9190
leaq 0x6d40(%rip), %rdx      # 0x10bc5
leaq -0x130(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x84c7
jmp 0x9f64
cvttsd2si %xmm1, %r12d
movq (%r15), %rax
movq %r15, %rdi
movl %r12d, %esi
callq *0x48(%rax)
leaq -0xd0(%rbp), %rdi
movl %r12d, %esi
callq 0x851e
leaq 0x6ae8(%rip), %rsi      # 0x109ac
leaq -0xf0(%rbp), %rdi
leaq -0xd0(%rbp), %rdx
callq 0x84f0
leaq 0x6a12(%rip), %rdx      # 0x108f0
leaq -0x110(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x84c7
leaq -0x50(%rbp), %rdi
leaq -0x110(%rbp), %rsi
leaq -0x210(%rbp), %rdx
callq 0x9201
leaq 0x6d53(%rip), %rdx      # 0x10c62
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x84c7
movq (%r15), %rax
movq %r15, %rdi
callq *0x18(%rax)
leaq -0xb0(%rbp), %rdi
movl %eax, %esi
callq 0x851e
leaq -0x90(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
callq 0x9190
leaq 0x6c74(%rip), %rdx      # 0x10bc5
leaq -0x130(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x84c7
leaq -0x130(%rbp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x41d0
movq %r12, %rdi
callq 0x40e0
leaq -0x90(%rbp), %rdi
callq 0x40e0
leaq -0xb0(%rbp), %rdi
callq 0x40e0
leaq -0x70(%rbp), %rdi
callq 0x40e0
leaq -0x50(%rbp), %rdi
callq 0x40e0
leaq -0x110(%rbp), %rdi
callq 0x40e0
leaq -0xf0(%rbp), %rdi
callq 0x40e0
leaq -0xd0(%rbp), %rdi
callq 0x40e0
movq (%r15), %rax
movq %r15, %rdi
callq *0x18(%rax)
testl %eax, %eax
jne 0xa082
leaq 0x6918(%rip), %rdx      # 0x108fc
leaq -0x70(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x848f
movq (%r15), %rax
movq %r15, %rdi
callq *0x20(%rax)
leaq -0x50(%rbp), %rdi
movl %eax, %esi
callq 0x851e
leaq -0x90(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x9190
leaq 0x6313(%rip), %rdx      # 0x10336
leaq -0x130(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x84c7
leaq -0x130(%rbp), %rsi
movq %rbx, %rdi
callq 0x42b0
leaq -0x130(%rbp), %rdi
callq 0x40e0
leaq -0x90(%rbp), %rdi
callq 0x40e0
leaq -0x50(%rbp), %rdi
callq 0x40e0
leaq -0x70(%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 -0x210(%rbp), %rdi
callq 0x40e0
movq %rbx, %rax
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa0a5
movq %rax, %r14
leaq -0x90(%rbp), %rdi
callq 0x40e0
jmp 0xa0bb
jmp 0xa0b8
movq %rax, %r14
leaq -0xb0(%rbp), %rdi
callq 0x40e0
jmp 0xa11c
jmp 0xa0cb
movq %rax, %r14
jmp 0xa125
jmp 0xa0d2
movq %rax, %r14
jmp 0xa12e
jmp 0xa0d9
movq %rax, %r14
jmp 0xa13a
jmp 0xa0e0
movq %rax, %r14
jmp 0xa146
jmp 0xa28e
jmp 0xa28e
jmp 0xa19e
jmp 0xa1b4
jmp 0xa1c5
jmp 0xa1d3
jmp 0xa1e1
jmp 0xa216
jmp 0xa21b
jmp 0xa220
jmp 0xa119
movq %rax, %r14
leaq -0x70(%rbp), %rdi
callq 0x40e0
leaq -0x50(%rbp), %rdi
callq 0x40e0
leaq -0x110(%rbp), %rdi
callq 0x40e0
leaq -0xf0(%rbp), %rdi
callq 0x40e0
leaq -0xd0(%rbp), %rdi
jmp 0xa280
jmp 0xa225
jmp 0xa22a
jmp 0xa22f
jmp 0xa234
jmp 0xa28e
movq %rax, %r14
leaq -0x130(%rbp), %rdi
callq 0x40e0
jmp 0xa17f
movq %rax, %r14
leaq -0x90(%rbp), %rdi
callq 0x40e0
jmp 0xa190
movq %rax, %r14
leaq -0x50(%rbp), %rdi
callq 0x40e0
jmp 0xa240
movq %rax, %r14
leaq -0x90(%rbp), %rdi
callq 0x40e0
jmp 0xa1b7
jmp 0xa28e
movq %rax, %r14
leaq -0x150(%rbp), %rdi
callq 0x40e0
jmp 0xa1c8
movq %rax, %r14
leaq -0x70(%rbp), %rdi
callq 0x40e0
jmp 0xa1d6
movq %rax, %r14
leaq -0x50(%rbp), %rdi
callq 0x40e0
jmp 0xa1e4
movq %rax, %r14
leaq -0x170(%rbp), %rdi
callq 0x40e0
leaq -0x110(%rbp), %rdi
callq 0x40e0
leaq -0xf0(%rbp), %rdi
callq 0x40e0
leaq -0x190(%rbp), %rdi
callq 0x40e0
jmp 0xa249
movq %rax, %r14
jmp 0xa1f0
movq %rax, %r14
jmp 0xa1fc
movq %rax, %r14
jmp 0xa208
movq %rax, %r14
jmp 0xa255
movq %rax, %r14
jmp 0xa261
movq %rax, %r14
jmp 0xa26d
movq %rax, %r14
jmp 0xa279
jmp 0xa28e
jmp 0xa246
movq %rax, %r14
leaq -0x70(%rbp), %rdi
jmp 0xa280
movq %rax, %r14
leaq -0xd0(%rbp), %rdi
callq 0x40e0
leaq -0xb0(%rbp), %rdi
callq 0x40e0
leaq -0x1f0(%rbp), %rdi
callq 0x40e0
leaq -0x1d0(%rbp), %rdi
callq 0x40e0
leaq -0x1b0(%rbp), %rdi
callq 0x40e0
jmp 0xa291
jmp 0xa28e
movq %rax, %r14
jmp 0xa29d
movq %rax, %r14
leaq -0x210(%rbp), %rdi
callq 0x40e0
movq %rbx, %rdi
callq 0x40e0
movq %r14, %rdi
callq 0x4280
nopl (%rax)