// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movl %edi, 0x8(%rsp)
callq 0x3060
cltq
imulq $0x55555556, %rax, %rcx # imm = 0x55555556
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
addl %edx, %ecx
leal (%rcx,%rcx,2), %ecx
subl %ecx, %eax
cmpl $0x2, %eax
je 0xb0d9
cmpl $0x1, %eax
je 0xb010
testl %eax, %eax
jne 0xb1b6
movl $0x68, %edi
callq 0x31a0
movq %rax, %rbx
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1931a(%rip), %rsi     # 0x2427c
leaq 0x1931e(%rip), %rdx     # 0x24287
leaq 0x20(%rsp), %rdi
callq 0xae3c
callq 0x18dac
movl 0x8(%rsp), %ecx
leal (%rax,%rcx,4), %eax
movl %eax, 0x18(%rsp)
callq 0x18db8
addl 0x8(%rsp), %eax
movl %eax, 0x14(%rsp)
callq 0x18db8
movl 0x8(%rsp), %ecx
leal (%rax,%rcx,2), %eax
movl %eax, 0x10(%rsp)
callq 0x18dc4
movl 0x8(%rsp), %ecx
leal (%rcx,%rcx,2), %ecx
addl %eax, %ecx
movl %ecx, 0xc(%rsp)
callq 0x18dd0
leaq 0x8(%rsp), %rcx
movl (%rcx), %eax
cvtsi2sd %rax, %xmm1
cvtss2sd %xmm0, %xmm0
mulsd 0x19299(%rip), %xmm1    # 0x24268
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
leaq 0x1c(%rsp), %rax
movss %xmm0, (%rax)
leaq 0xc(%rsp), %r10
leaq 0x20(%rsp), %rsi
leaq 0x18(%rsp), %rdx
leaq 0x14(%rsp), %r8
leaq 0x10(%rsp), %r9
movq %rbx, %rdi
pushq %rax
pushq %r10
callq 0x19080
addq $0x10, %rsp
jmp 0xb19d
movl $0x68, %edi
callq 0x31a0
movq %rax, %rbx
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x18dc4(%rip), %rsi     # 0x23df1
leaq 0x18dc3(%rip), %rdx     # 0x23df7
leaq 0x20(%rsp), %rdi
callq 0xae3c
callq 0x18dac
movl 0x8(%rsp), %ecx
leal (%rax,%rcx,4), %eax
movl %eax, 0x18(%rsp)
callq 0x18db8
addl 0x8(%rsp), %eax
movl %eax, 0x14(%rsp)
callq 0x18db8
movl 0x8(%rsp), %ecx
leal (%rax,%rcx,2), %eax
movl %eax, 0x10(%rsp)
callq 0x18dc4
movl 0x8(%rsp), %ecx
leal (%rax,%rcx,2), %eax
movl %eax, 0xc(%rsp)
callq 0x18dd0
leaq 0x8(%rsp), %rcx
movl (%rcx), %eax
cvtsi2sd %rax, %xmm1
cvtss2sd %xmm0, %xmm0
mulsd 0x191d8(%rip), %xmm1    # 0x24270
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
leaq 0x1c(%rsp), %rax
movss %xmm0, (%rax)
leaq 0xc(%rsp), %r10
leaq 0x20(%rsp), %rsi
leaq 0x18(%rsp), %rdx
leaq 0x14(%rsp), %r8
leaq 0x10(%rsp), %r9
movq %rbx, %rdi
pushq %rax
pushq %r10
callq 0x1903c
addq $0x10, %rsp
jmp 0xb19d
movl $0x68, %edi
callq 0x31a0
movq %rax, %rbx
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x19192(%rip), %rsi     # 0x24288
leaq 0x19191(%rip), %rdx     # 0x2428e
leaq 0x20(%rsp), %rdi
callq 0xae3c
callq 0x18dac
movl 0x8(%rsp), %ecx
leal (%rax,%rcx,4), %eax
movl %eax, 0x18(%rsp)
callq 0x18db8
addl 0x8(%rsp), %eax
movl %eax, 0x14(%rsp)
callq 0x18db8
movl 0x8(%rsp), %ecx
leal (%rax,%rcx,2), %eax
movl %eax, 0x10(%rsp)
callq 0x18dc4
movl 0x8(%rsp), %ecx
leal (%rax,%rcx,2), %eax
movl %eax, 0xc(%rsp)
callq 0x18dd0
leaq 0x8(%rsp), %rcx
movl (%rcx), %eax
cvtsi2sd %rax, %xmm1
cvtss2sd %xmm0, %xmm0
mulsd 0x19107(%rip), %xmm1    # 0x24268
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
leaq 0x1c(%rsp), %rax
movss %xmm0, (%rax)
leaq 0xc(%rsp), %r10
leaq 0x20(%rsp), %rsi
leaq 0x18(%rsp), %rdx
leaq 0x14(%rsp), %r8
leaq 0x10(%rsp), %r9
movq %rbx, %rdi
pushq %rax
pushq %r10
callq 0x18ff8
addq $0x10, %rsp
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0xb1b8
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x31b0
jmp 0xb1b8
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0xb1ea
jmp 0xb1ea
jmp 0xb1ea
jmp 0xb1ea
jmp 0xb1ea
jmp 0xb1ea
jmp 0xb1ea
jmp 0xb1ea
jmp 0xb1ea
jmp 0xb1ea
jmp 0xb1ea
jmp 0xb1ea
jmp 0xb1e1
jmp 0xb1e1
movq %rax, %r14
jmp 0xb204
jmp 0xb1ea
jmp 0xb1ea
movq %rax, %r14
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0xb204
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x31b0
movl $0x68, %esi
movq %rbx, %rdi
callq 0x31b0
movq %r14, %rdi
callq 0x32f0
nop