// File: /workspace/github_cpp_makefile_star2_O3/malcolmyeh[P]CC3K/werewolf.cc
// Function: Werewolf::dealDamage[abi:cxx11](Character*)
std::string Werewolf::dealDamage(Character *opponent)
{

    double amount;
    std::string combatMsg;
    std::string attacker = this->race;

    int attack = this->Atk;
    int defense = opponent->getDef();
    if (this->stunned)
    {
        this->stunned = false;
        combatMsg = attacker + " is stunned. ";
        return combatMsg;
    }

    if (rand() % 2 == 0)
    {
        combatMsg = attacker + "'s attack missed. ";
        return combatMsg;
    }

    if (this->HP <= 30)
    {
        combatMsg = attacker + "'s unstoppable rage increases its damage by 3. ";
        this->Atk += 3;
    }
    else if (this-> HP <= 60)
    {
        combatMsg = attacker + "'s blinding rage increases its damage by 2. ";
        this->Atk += 2;
    }
    else if (this-> HP <= 90)
    {
        combatMsg = attacker + "'s rage increases its damage by 1. ";
        this->Atk += 1;
    }

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

    opponent->takeDamage((int)amount);

    combatMsg += attacker + " deals " + std::to_string((int)amount) + " damage to you (HP: " + std::to_string(opponent->getHP()) + "). ";

    if (opponent->getHP() == 0)
    {
        combatMsg += "You have been slain.";
    }

    return combatMsg;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, -0x138(%rbp)
movq %rax, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
leaq -0x58(%rbp), %r13
movq %r13, -0x10(%r13)
movq 0x18(%rsi), %rsi
movq 0x20(%r15), %rdx
addq %rsi, %rdx
leaq -0x68(%rbp), %rdi
callq 0xa4be
movl 0x8(%r15), %r14d
movq (%r12), %rax
movq %r12, -0x90(%rbp)
movq %r12, %rdi
callq *0x10(%rax)
cmpb $0x1, 0x39(%r15)
jne 0x153e4
movb $0x0, 0x39(%r15)
leaq -0x38(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0xa4be
leaq 0x857d(%rip), %rsi      # 0x1d956
leaq -0x48(%rbp), %rdi
callq 0x4280
jmp 0x1541c
movl %eax, %r12d
callq 0x4060
testb $0x1, %al
jne 0x15448
leaq -0x38(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0xa4be
leaq 0x8551(%rip), %rsi      # 0x1d964
leaq -0x48(%rbp), %rdi
callq 0x4280
leaq -0x48(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x41c0
movq (%r14), %rdi
cmpq %r15, %rdi
je 0x15a6a
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x4170
jmp 0x15a6a
movl 0x10(%r15), %eax
cmpl $0x1e, %eax
jg 0x154af
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0xa4be
leaq 0x8885(%rip), %rsi      # 0x1dcf9
leaq -0x48(%rbp), %rdi
callq 0x4280
leaq -0x48(%rbp), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x41c0
movq (%r13), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x154a5
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x4170
movl $0x3, %eax
jmp 0x1556d
cmpl $0x3c, %eax
ja 0x1550f
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0xa4be
leaq 0x8852(%rip), %rsi      # 0x1dd29
leaq -0x48(%rbp), %rdi
callq 0x4280
leaq -0x48(%rbp), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x41c0
movq (%r13), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x15508
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x4170
movl $0x2, %eax
jmp 0x1556d
cmpl $0x5a, %eax
ja 0x15571
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0xa4be
leaq 0x881f(%rip), %rsi      # 0x1dd56
leaq -0x48(%rbp), %rdi
callq 0x4280
leaq -0x48(%rbp), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x41c0
movq (%r13), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x15568
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x4170
movl $0x1, %eax
addl %eax, 0x8(%r15)
cvtsi2sd %r12d, %xmm0
movsd 0x839a(%rip), %xmm1     # 0x1d918
addsd %xmm1, %xmm0
divsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
mulsd %xmm1, %xmm0
callq 0x4040
cvttsd2si %xmm0, %r15d
movq -0x90(%rbp), %rdi
movq (%rdi), %rax
movl %r15d, %esi
callq *0x48(%rax)
leaq -0x78(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq %rsi, %rdx
leaq -0x88(%rbp), %rdi
callq 0xa4be
leaq 0x83a5(%rip), %rsi      # 0x1d977
leaq -0x88(%rbp), %rdi
callq 0x4280
movl %r15d, %r12d
negl %r12d
cmovsl %r15d, %r12d
movl $0x1, %r13d
cmpl $0xa, %r12d
jb 0x1563e
movl $0x4, %r13d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r12d, %ecx
cmpl $0x63, %ecx
jbe 0x15635
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x1563b
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x1563e
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r13d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x15602
addl $-0x3, %r13d
jmp 0x1563e
addl $-0x2, %r13d
jmp 0x1563e
decl %r13d
shrl $0x1f, %r15d
leal (%r15,%r13), %esi
leaq -0xc0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq -0xd0(%rbp), %rdi
movl $0x2d, %edx
callq 0x41b0
movl %r15d, %edi
addq -0xd0(%rbp), %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0xa44c
movq -0x88(%rbp), %rcx
movq -0x80(%rbp), %r8
movq -0xc8(%rbp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %edi
leaq -0x78(%rbp), %rsi
cmpq %rsi, %rcx
je 0x1569f
movq -0x78(%rbp), %rdi
movq -0xd0(%rbp), %rsi
cmpq %rdi, %rax
movq -0x90(%rbp), %r14
jbe 0x156cf
movl $0xf, %edi
leaq -0xc0(%rbp), %r9
cmpq %r9, %rsi
je 0x156ca
movq -0xc0(%rbp), %rdi
cmpq %rdi, %rax
jbe 0x156dd
leaq -0x88(%rbp), %rdi
callq 0x4080
jmp 0x156ed
leaq -0xd0(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4190
leaq -0x100(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x15717
movq %rsi, -0x110(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x100(%rbp)
jmp 0x1571f
movupd (%rcx), %xmm0
movupd %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x108(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x823a(%rip), %rsi      # 0x1d97f
leaq -0x110(%rbp), %rdi
callq 0x4280
leaq -0xe0(%rbp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1577e
movq %rdx, -0xf0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xe0(%rbp)
jmp 0x15786
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0xe8(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%r14), %rax
movq %r14, %rdi
callq *0x18(%rax)
movl %eax, %r12d
movl %eax, %r15d
negl %r15d
cmovsl %eax, %r15d
movl $0x1, %r13d
cmpl $0xa, %r15d
jb 0x1580c
movl $0x4, %r13d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r15d, %ecx
cmpl $0x63, %ecx
jbe 0x15803
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x15809
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x1580c
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r13d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x157d0
addl $-0x3, %r13d
jmp 0x1580c
addl $-0x2, %r13d
jmp 0x1580c
decl %r13d
shrl $0x1f, %r12d
leal (%r12,%r13), %esi
leaq -0xa0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq -0xb0(%rbp), %rdi
movl $0x2d, %edx
callq 0x41b0
movl %r12d, %edi
addq -0xb0(%rbp), %rdi
movl %r13d, %esi
movl %r15d, %edx
callq 0xa44c
movq -0xf0(%rbp), %rcx
movq -0xe8(%rbp), %r8
movq -0xa8(%rbp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %edi
leaq -0xe0(%rbp), %r12
cmpq %r12, %rcx
je 0x15876
movq -0xe0(%rbp), %rdi
movq -0xb0(%rbp), %rsi
cmpq %rdi, %rax
leaq -0x58(%rbp), %r13
movq -0x90(%rbp), %r14
jbe 0x158aa
movl $0xf, %edi
leaq -0xa0(%rbp), %r9
cmpq %r9, %rsi
je 0x158a5
movq -0xa0(%rbp), %rdi
cmpq %rdi, %rax
jbe 0x158b8
leaq -0xf0(%rbp), %rdi
callq 0x4080
jmp 0x158c8
leaq -0xb0(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4190
leaq -0x120(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x158f2
movq %rsi, -0x130(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x120(%rbp)
jmp 0x158fa
movupd (%rcx), %xmm0
movupd %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x128(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x82d5(%rip), %rsi      # 0x1dbf5
leaq -0x130(%rbp), %rdi
callq 0x4280
leaq -0x38(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x15950
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x15959
movupd (%rcx), %xmm0
movupd %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, -0x40(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq %rbx, %rdi
callq 0x4080
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x15995
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x4170
leaq -0x120(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x159b4
movq -0x120(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x159d6
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0xf0(%rbp), %rdi
cmpq %r12, %rdi
je 0x159f1
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x4170
leaq -0x100(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x15a10
movq -0x100(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x15a32
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x15a4e
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x4170
movq (%r14), %rax
movq %r14, %rdi
callq *0x18(%rax)
testl %eax, %eax
jne 0x15a6a
leaq 0x7f32(%rip), %rsi      # 0x1d994
movq %rbx, %rdi
callq 0x4280
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0x15a7f
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x4170
movq %rbx, %rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x15aa2
jmp 0x15be2
jmp 0x15aa2
jmp 0x15be2
movq %rax, %r14
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
jne 0x15bcd
jmp 0x15be5
jmp 0x15be2
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x15add
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x4170
jmp 0x15add
movq %rax, %r14
leaq -0x120(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x15b01
movq -0x120(%rbp), %rsi
incq %rsi
callq 0x4170
jmp 0x15b01
movq %rax, %r14
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x15b48
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x4170
jmp 0x15b48
movq %rax, %r14
jmp 0x15b6a
movq %rax, %r14
jmp 0x15b89
jmp 0x15b31
movq %rax, %r14
jmp 0x15bab
jmp 0x15be2
jmp 0x15bc1
jmp 0x15be2
movq %rax, %r14
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x15b6a
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x4170
leaq -0x100(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x15b89
movq -0x100(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x15bab
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x15be5
movq -0x78(%rbp), %rsi
jmp 0x15bd1
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x15be5
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x4170
jmp 0x15be5
jmp 0x15be2
movq %rax, %r14
jmp 0x15bfe
movq %rax, %r14
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x15bfe
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x4170
movq (%rbx), %rdi
cmpq -0x138(%rbp), %rdi
je 0x15c1c
movq -0x138(%rbp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x4170
movq %r14, %rdi
callq 0x4250