// File: /workspace/github_cpp_makefile_star2_O3/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 0xb0c1
cmpl $0x1, %eax
je 0xaff8
testl %eax, %eax
jne 0xb19e
movl $0x68, %edi
callq 0x31a0
movq %rax, %rbx
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x19332(%rip), %rsi     # 0x2427c
leaq 0x19336(%rip), %rdx     # 0x24287
leaq 0x20(%rsp), %rdi
callq 0xae20
callq 0x18ddc
movl 0x8(%rsp), %ecx
leal (%rax,%rcx,4), %eax
movl %eax, 0x18(%rsp)
callq 0x18de8
addl 0x8(%rsp), %eax
movl %eax, 0x14(%rsp)
callq 0x18de8
movl 0x8(%rsp), %ecx
leal (%rax,%rcx,2), %eax
movl %eax, 0x10(%rsp)
callq 0x18df4
movl 0x8(%rsp), %ecx
leal (%rcx,%rcx,2), %ecx
addl %eax, %ecx
movl %ecx, 0xc(%rsp)
callq 0x18e00
leaq 0x8(%rsp), %rcx
movl (%rcx), %eax
cvtsi2sd %rax, %xmm1
cvtss2sd %xmm0, %xmm0
mulsd 0x192b1(%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 0x190b0
addq $0x10, %rsp
jmp 0xb185
movl $0x68, %edi
callq 0x31a0
movq %rax, %rbx
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x18ddc(%rip), %rsi     # 0x23df1
leaq 0x18ddb(%rip), %rdx     # 0x23df7
leaq 0x20(%rsp), %rdi
callq 0xae20
callq 0x18ddc
movl 0x8(%rsp), %ecx
leal (%rax,%rcx,4), %eax
movl %eax, 0x18(%rsp)
callq 0x18de8
addl 0x8(%rsp), %eax
movl %eax, 0x14(%rsp)
callq 0x18de8
movl 0x8(%rsp), %ecx
leal (%rax,%rcx,2), %eax
movl %eax, 0x10(%rsp)
callq 0x18df4
movl 0x8(%rsp), %ecx
leal (%rax,%rcx,2), %eax
movl %eax, 0xc(%rsp)
callq 0x18e00
leaq 0x8(%rsp), %rcx
movl (%rcx), %eax
cvtsi2sd %rax, %xmm1
cvtss2sd %xmm0, %xmm0
mulsd 0x191f0(%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 0x1906c
addq $0x10, %rsp
jmp 0xb185
movl $0x68, %edi
callq 0x31a0
movq %rax, %rbx
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x191aa(%rip), %rsi     # 0x24288
leaq 0x191a9(%rip), %rdx     # 0x2428e
leaq 0x20(%rsp), %rdi
callq 0xae20
callq 0x18ddc
movl 0x8(%rsp), %ecx
leal (%rax,%rcx,4), %eax
movl %eax, 0x18(%rsp)
callq 0x18de8
addl 0x8(%rsp), %eax
movl %eax, 0x14(%rsp)
callq 0x18de8
movl 0x8(%rsp), %ecx
leal (%rax,%rcx,2), %eax
movl %eax, 0x10(%rsp)
callq 0x18df4
movl 0x8(%rsp), %ecx
leal (%rax,%rcx,2), %eax
movl %eax, 0xc(%rsp)
callq 0x18e00
leaq 0x8(%rsp), %rcx
movl (%rcx), %eax
cvtsi2sd %rax, %xmm1
cvtss2sd %xmm0, %xmm0
mulsd 0x1911f(%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 0x19028
addq $0x10, %rsp
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0xb1a0
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x31b0
jmp 0xb1a0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0xb1d2
jmp 0xb1d2
jmp 0xb1d2
jmp 0xb1d2
jmp 0xb1d2
jmp 0xb1d2
jmp 0xb1d2
jmp 0xb1d2
jmp 0xb1d2
jmp 0xb1d2
jmp 0xb1d2
jmp 0xb1d2
jmp 0xb1c9
jmp 0xb1c9
movq %rax, %r14
jmp 0xb1ec
jmp 0xb1d2
jmp 0xb1d2
movq %rax, %r14
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0xb1ec
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x31b0
movl $0x68, %esi
movq %rbx, %rdi
callq 0x31b0
movq %r14, %rdi
callq 0x32f0
nop