// File: /workspace/github_cpp_makefile_star2_O1/malcolmyeh[P]CC3K/goblin.cc
// Function: Goblin::dealDamage[abi:cxx11](Character*)
std::string Goblin::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;
    }
    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 (rand() % 2 == 0 && opponent->getGold() >= 1)
    {
        opponent->updateGold(-1);
        combatMsg += attacker + " swipes 1 gold from you. (Gold: " + std::to_string(opponent->getGold()) + ")";
    }

    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 $0x108, %rsp            # imm = 0x108
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, -0x130(%rbp)
movq %rax, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
leaq -0xd8(%rbp), %rax
movq %rax, -0x10(%rax)
movq 0x18(%rsi), %rsi
movq 0x20(%r15), %rdx
addq %rsi, %rdx
leaq -0xe8(%rbp), %rdi
callq 0xa582
movl 0x8(%r15), %r13d
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
cmpb $0x1, 0x39(%r15)
jne 0x10ce4
movb $0x0, 0x39(%r15)
leaq -0x38(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0xa582
leaq 0xcc7d(%rip), %rsi      # 0x1d956
leaq -0x48(%rbp), %rdi
callq 0x4280
jmp 0x10d22
movl %eax, %r12d
callq 0x4060
testb $0x1, %al
jne 0x10d4e
leaq -0x38(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0xa582
leaq 0xcc4b(%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 0x1149c
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x4170
jmp 0x1149c
cvtsi2sd %r12d, %xmm0
movsd 0xcbbd(%rip), %xmm1     # 0x1d918
addsd %xmm1, %xmm0
divsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
mulsd %xmm1, %xmm0
callq 0x4040
cvttsd2si %xmm0, %r15d
movq (%r14), %rax
movq %r14, %rdi
movl %r15d, %esi
callq *0x48(%rax)
leaq -0xb8(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
addq %rsi, %rdx
leaq -0xc8(%rbp), %rdi
callq 0xa582
leaq 0xcbc3(%rip), %rsi      # 0x1d977
leaq -0xc8(%rbp), %rdi
callq 0x4280
movl %r15d, %r12d
negl %r12d
cmovsl %r15d, %r12d
movl $0x1, %r13d
cmpl $0xa, %r12d
jb 0x10e20
movl $0x4, %r13d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r12d, %ecx
cmpl $0x63, %ecx
jbe 0x10e17
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x10e1d
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x10e20
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r13d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x10de4
addl $-0x3, %r13d
jmp 0x10e20
addl $-0x2, %r13d
jmp 0x10e20
decl %r13d
shrl $0x1f, %r15d
leal (%r15,%r13), %esi
leaq -0x118(%rbp), %rax
movq %rax, -0x10(%rax)
leaq -0x128(%rbp), %rdi
movl $0x2d, %edx
callq 0x41b0
movl %r15d, %edi
addq -0x128(%rbp), %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0xa510
movq -0xc8(%rbp), %rcx
movq -0xc0(%rbp), %r8
movq -0x120(%rbp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
leaq -0xb8(%rbp), %rdi
cmpq %rdi, %rcx
je 0x10e8a
movq -0xb8(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x10eb0
movl $0xf, %esi
leaq -0x118(%rbp), %rdi
cmpq %rdi, -0x128(%rbp)
je 0x10eab
movq -0x118(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x10ec5
movq -0x128(%rbp), %rsi
leaq -0xc8(%rbp), %rdi
callq 0x4080
jmp 0x10ed5
leaq -0x128(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4190
leaq -0x78(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x10ef9
movq %rsi, -0x88(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x78(%rbp)
jmp 0x10f01
movupd (%rcx), %xmm0
movupd %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0x80(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0xca5b(%rip), %rsi      # 0x1d97f
leaq -0x88(%rbp), %rdi
callq 0x4280
leaq -0x58(%rbp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x10f54
movq %rdx, -0x68(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x58(%rbp)
jmp 0x10f5c
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x60(%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 0x10fdf
movl $0x4, %r13d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r15d, %ecx
cmpl $0x63, %ecx
jbe 0x10fd6
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x10fdc
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x10fdf
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r13d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x10fa3
addl $-0x3, %r13d
jmp 0x10fdf
addl $-0x2, %r13d
jmp 0x10fdf
decl %r13d
shrl $0x1f, %r12d
leal (%r12,%r13), %esi
leaq -0xf8(%rbp), %rax
movq %rax, -0x10(%rax)
leaq -0x108(%rbp), %rdi
movl $0x2d, %edx
callq 0x41b0
movl %r12d, %edi
addq -0x108(%rbp), %rdi
movl %r13d, %esi
movl %r15d, %edx
callq 0xa510
movq -0x68(%rbp), %rcx
movq -0x60(%rbp), %r8
movq -0x100(%rbp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
leaq -0x58(%rbp), %r12
cmpq %r12, %rcx
je 0x1103d
movq -0x58(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x11063
movl $0xf, %esi
leaq -0xf8(%rbp), %rdi
cmpq %rdi, -0x108(%rbp)
je 0x1105e
movq -0xf8(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x11075
movq -0x108(%rbp), %rsi
leaq -0x68(%rbp), %rdi
callq 0x4080
jmp 0x11085
leaq -0x108(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4190
leaq -0x98(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x110af
movq %rsi, -0xa8(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x98(%rbp)
jmp 0x110b7
movupd (%rcx), %xmm0
movupd %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0xa0(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0xcb18(%rip), %rsi      # 0x1dbf5
leaq -0xa8(%rbp), %rdi
callq 0x4280
leaq -0x38(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x1110d
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x11117
movupd (%rcx), %xmm0
movupd %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq -0x48(%rbp), %r15
movq %rdx, 0x8(%r15)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x41c0
movq (%r15), %rdi
cmpq %r13, %rdi
je 0x11151
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x4170
leaq -0x98(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11170
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x11192
movq -0xf8(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x111a7
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x4170
leaq -0x78(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x111c0
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0x128(%rbp), %rdi
leaq -0x118(%rbp), %rax
cmpq %rax, %rdi
je 0x111e2
movq -0x118(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x11204
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x4170
callq 0x4060
testb $0x1, %al
jne 0x11480
movq (%r14), %rax
movq %r14, %rdi
callq *0x20(%rax)
testl %eax, %eax
jle 0x11480
movq (%r14), %rax
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq *(%rax)
leaq -0x68(%rbp), %rdi
movq %r12, (%rdi)
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
addq %rsi, %rdx
callq 0xa582
leaq 0xc904(%rip), %rsi      # 0x1db57
leaq -0x68(%rbp), %rdi
callq 0x4280
movq (%r14), %rax
movq %r14, %rdi
callq *0x20(%rax)
movl %eax, %r12d
movl %eax, %r15d
negl %r15d
cmovsl %eax, %r15d
movl $0x1, %r13d
cmpl $0xa, %r15d
jb 0x112c8
movl $0x4, %r13d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r15d, %ecx
cmpl $0x63, %ecx
jbe 0x112bf
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x112c5
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x112c8
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r13d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x1128c
addl $-0x3, %r13d
jmp 0x112c8
addl $-0x2, %r13d
jmp 0x112c8
decl %r13d
shrl $0x1f, %r12d
leal (%r12,%r13), %esi
leaq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
movq %rax, (%rdi)
movl $0x2d, %edx
callq 0x41b0
movl %r12d, %edi
addq -0x88(%rbp), %rdi
movl %r13d, %esi
movl %r15d, %edx
callq 0xa510
movq -0x68(%rbp), %rcx
movq -0x60(%rbp), %r8
movq -0x80(%rbp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
leaq -0x58(%rbp), %r15
cmpq %r15, %rcx
je 0x1131f
movq -0x58(%rbp), %rsi
cmpq %rsi, %rax
leaq -0x38(%rbp), %r12
leaq -0x98(%rbp), %r13
jbe 0x1134a
movl $0xf, %esi
leaq -0x78(%rbp), %rdi
cmpq %rdi, -0x88(%rbp)
je 0x11345
movq -0x78(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x1135c
movq -0x88(%rbp), %rsi
leaq -0x68(%rbp), %rdi
callq 0x4080
jmp 0x1136c
leaq -0x88(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4190
movq %r13, -0xa8(%rbp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x11392
movq %rdx, -0xa8(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x98(%rbp)
jmp 0x1139c
movupd (%rcx), %xmm0
movupd %xmm0, (%r13)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0xa0(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0xc455(%rip), %rsi      # 0x1d817
leaq -0xa8(%rbp), %rdi
callq 0x4280
movq %r12, -0x48(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x113ee
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x113f8
movupd (%rcx), %xmm0
movupd %xmm0, (%r12)
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 %r12, %rdi
je 0x11434
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0xa8(%rbp), %rdi
cmpq %r13, %rdi
je 0x1144f
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x1146b
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0x68(%rbp), %rdi
cmpq %r15, %rdi
je 0x11480
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x4170
movq (%r14), %rax
movq %r14, %rdi
callq *0x18(%rax)
testl %eax, %eax
jne 0x1149c
leaq 0xc500(%rip), %rsi      # 0x1d994
movq %rbx, %rdi
callq 0x4280
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x114be
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x4170
movq %rbx, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x114f0
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x4170
jmp 0x114f0
movq %rax, %r14
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x11517
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x4170
jmp 0x11517
movq %rax, %r14
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x1153f
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x4170
jmp 0x1153f
jmp 0x1153c
jmp 0x11655
movq %rax, %r14
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x11658
movq -0x58(%rbp), %rsi
jmp 0x11644
movq %rax, %r14
leaq -0x98(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x11580
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x4170
jmp 0x11580
movq %rax, %r14
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x115c4
movq -0xf8(%rbp), %rsi
incq %rsi
callq 0x4170
jmp 0x115c4
movq %rax, %r14
jmp 0x115dd
movq %rax, %r14
jmp 0x115f6
jmp 0x115b0
movq %rax, %r14
jmp 0x11618
jmp 0x11655
jmp 0x11634
jmp 0x11655
movq %rax, %r14
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x115dd
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x4170
leaq -0x78(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x115f6
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0x128(%rbp), %rdi
leaq -0x118(%rbp), %rax
cmpq %rax, %rdi
je 0x11618
movq -0x118(%rbp), %rsi
incq %rsi
callq 0x4170
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x11658
movq -0xb8(%rbp), %rsi
jmp 0x11644
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x11658
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x4170
jmp 0x11658
jmp 0x11655
movq %rax, %r14
jmp 0x1167a
movq %rax, %r14
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x1167a
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x4170
movq (%rbx), %rdi
cmpq -0x130(%rbp), %rdi
je 0x11698
movq -0x130(%rbp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x4170
movq %r14, %rdi
callq 0x4250