// File: /workspace/github_cpp_makefile_star2_O2/MichaelXanth[P]RPG_Game/Battle/Battle.cpp
// Function: Battle::FindMonster(unsigned int)
Monster* Battle::FindMonster(unsigned int heroLvl) 
{
    short monChance = rand() % 3;
    Monster* newMon = NULL;

    switch(monChance)
    {
        case 0:
            newMon = new Exoskeleton("Exoskeleton",/*increased defence*/
                                     Monster::MonsterGetBaseHP() + heroLvl * 4 , heroLvl,
                                     Monster::MonsterGetBaseDamage() + heroLvl,
                                     Monster::MonsterGetBaseDamage() + heroLvl * 2,
                                     Monster::MonsterGetBaseDefence() + heroLvl * 3,
                                     Monster::MonsterGetBaseAvoidance() + heroLvl * 0.001);
            break;
        case 1:
            newMon = new Spirit("Spirit",/*increased avoidance*/
                                Monster::MonsterGetBaseHP() + heroLvl * 4 , heroLvl,
                                Monster::MonsterGetBaseDamage() + heroLvl,
                                Monster::MonsterGetBaseDamage() + heroLvl * 2,
                                Monster::MonsterGetBaseDefence() + heroLvl * 2,
                                Monster::MonsterGetBaseAvoidance() + heroLvl * 0.0015);
            break;
        case 2:
            newMon = new Dragon("Dragon",/*increased damage*/
                                Monster::MonsterGetBaseHP() + heroLvl * 4 , heroLvl,
                                Monster::MonsterGetBaseDamage() + heroLvl,
                                Monster::MonsterGetBaseDamage() + heroLvl * 2,
                                Monster::MonsterGetBaseDefence() + heroLvl * 2,
                                Monster::MonsterGetBaseAvoidance() + heroLvl * 0.001);
            break;
    }
    return newMon;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movl %edi, 0xc(%rsp)
callq 0x3060
pushq $0x3
popq %rcx
cltd
idivl %ecx
cmpl $0x2, %edx
je 0x92cc
cmpl $0x1, %edx
je 0x9215
testl %edx, %edx
jne 0x938a
pushq $0x68
popq %rdi
callq 0x31e0
movq %rax, %rbx
leaq 0x1210c(%rip), %rsi     # 0x1b27c
leaq 0x28(%rsp), %rdi
leaq 0x13(%rsp), %rdx
callq 0x8e3c
callq 0x127a6
movl 0xc(%rsp), %ecx
leal (%rax,%rcx,4), %eax
movl %eax, 0x20(%rsp)
callq 0x127b2
addl 0xc(%rsp), %eax
movl %eax, 0x1c(%rsp)
callq 0x127b2
movl 0xc(%rsp), %ecx
leal (%rax,%rcx,2), %eax
movl %eax, 0x18(%rsp)
callq 0x127be
imull $0x3, 0xc(%rsp), %ecx
addl %eax, %ecx
movl %ecx, 0x14(%rsp)
callq 0x127ca
leaq 0xc(%rsp), %rcx
movl (%rcx), %eax
cvtsi2sd %rax, %xmm1
cvtss2sd %xmm0, %xmm0
mulsd 0x1208f(%rip), %xmm1    # 0x1b268
addsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm0
leaq 0x24(%rsp), %rax
movss %xmm0, (%rax)
leaq 0x14(%rsp), %r10
leaq 0x28(%rsp), %rsi
leaq 0x20(%rsp), %rdx
leaq 0x1c(%rsp), %r8
leaq 0x18(%rsp), %r9
movq %rbx, %rdi
pushq %rax
pushq %r10
callq 0x12a60
popq %rax
popq %rcx
jmp 0x937e
pushq $0x68
popq %rdi
callq 0x31e0
movq %rax, %rbx
leaq 0x11bca(%rip), %rsi     # 0x1adf1
leaq 0x28(%rsp), %rdi
leaq 0x13(%rsp), %rdx
callq 0x8e3c
callq 0x127a6
movl 0xc(%rsp), %ecx
leal (%rax,%rcx,4), %eax
movl %eax, 0x20(%rsp)
callq 0x127b2
addl 0xc(%rsp), %eax
movl %eax, 0x1c(%rsp)
callq 0x127b2
movl 0xc(%rsp), %ecx
leal (%rax,%rcx,2), %eax
movl %eax, 0x18(%rsp)
callq 0x127be
movl 0xc(%rsp), %ecx
leal (%rax,%rcx,2), %eax
movl %eax, 0x14(%rsp)
callq 0x127ca
leaq 0xc(%rsp), %rcx
movl (%rcx), %eax
cvtsi2sd %rax, %xmm1
cvtss2sd %xmm0, %xmm0
mulsd 0x11fe0(%rip), %xmm1    # 0x1b270
addsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm0
leaq 0x24(%rsp), %rax
movss %xmm0, (%rax)
leaq 0x14(%rsp), %r10
leaq 0x28(%rsp), %rsi
leaq 0x20(%rsp), %rdx
leaq 0x1c(%rsp), %r8
leaq 0x18(%rsp), %r9
movq %rbx, %rdi
pushq %rax
pushq %r10
callq 0x12a1c
popq %rax
popq %rcx
jmp 0x937e
pushq $0x68
popq %rdi
callq 0x31e0
movq %rax, %rbx
leaq 0x11faa(%rip), %rsi     # 0x1b288
leaq 0x28(%rsp), %rdi
leaq 0x13(%rsp), %rdx
callq 0x8e3c
callq 0x127a6
movl 0xc(%rsp), %ecx
leal (%rax,%rcx,4), %eax
movl %eax, 0x20(%rsp)
callq 0x127b2
addl 0xc(%rsp), %eax
movl %eax, 0x1c(%rsp)
callq 0x127b2
movl 0xc(%rsp), %ecx
leal (%rax,%rcx,2), %eax
movl %eax, 0x18(%rsp)
callq 0x127be
movl 0xc(%rsp), %ecx
leal (%rax,%rcx,2), %eax
movl %eax, 0x14(%rsp)
callq 0x127ca
leaq 0xc(%rsp), %rcx
movl (%rcx), %eax
cvtsi2sd %rax, %xmm1
cvtss2sd %xmm0, %xmm0
mulsd 0x11f21(%rip), %xmm1    # 0x1b268
addsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm0
leaq 0x24(%rsp), %rax
movss %xmm0, (%rax)
leaq 0x14(%rsp), %r10
leaq 0x28(%rsp), %rsi
leaq 0x20(%rsp), %rdx
leaq 0x1c(%rsp), %r8
leaq 0x18(%rsp), %r9
movq %rbx, %rdi
pushq %rax
pushq %r10
callq 0x129d8
popq %rax
popq %rcx
leaq 0x28(%rsp), %rdi
callq 0x30c0
jmp 0x938c
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r14
retq
jmp 0x93bc
jmp 0x93bc
jmp 0x93bc
jmp 0x93bc
jmp 0x93bc
jmp 0x93bc
jmp 0x93bc
jmp 0x93bc
jmp 0x93bc
jmp 0x93bc
jmp 0x93bc
jmp 0x93bc
jmp 0x93b3
jmp 0x93b3
movq %rax, %r14
jmp 0x93c9
jmp 0x93bc
jmp 0x93bc
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x30c0
pushq $0x68
popq %rsi
movq %rbx, %rdi
callq 0x31f0
movq %r14, %rdi
callq 0x3330