// File: /workspace/github_cpp_makefile_star2_O2/arisKoutsou[P]oopproj/./src/game_utils.cpp
// Function: createMonsters()
void createMonsters(void) {
  int numberOfMonsters = rng.fromMintoMax(1, 2);
  int heroY = heroes[0]->getPosition().getY();
  int heroX = heroes[0]->getPosition().getX();
  int averageLevel = 0;
  for (int i = 0; i < heroes.size(); i++) {
    averageLevel += heroes[i]->getLevel();
  }
  averageLevel /= heroes.size();

  int healthPower = 500 + 50*averageLevel;
  int minDamage = 10 + 15*averageLevel;
  int maxDamage = 20 + 15*averageLevel;
  double armor = 0.1 + 0.2*averageLevel;
  double dodge = 0.1 + 0.15*averageLevel;
  for (size_t i = 0U; i != numberOfMonsters; ++i) {
    int kind = rng.fromMintoMax(0, 2);
    string name = names[rng.fromMintoMax(0, names.size() - 1)];
    switch (kind) {
    case 0: {
      double damageBonus = 5 + 5*averageLevel;
      Dragon* dragon = new Dragon(gameGrid, heroY, heroX, name,
				  healthPower, minDamage, maxDamage,
				  armor, dodge, damageBonus);
      dragon->setLevel(averageLevel);
      monsters.push_back(dragon);
      break;
    }
    case 1: {
      double armorBonus = 0.15 + 0.1*averageLevel;
      Exoskeleton* ex = new Exoskeleton(gameGrid, heroY, heroX, name,
					healthPower, minDamage, maxDamage,
					armor, dodge, armorBonus);
      ex->setLevel(averageLevel);      
      monsters.push_back(ex);
      break;
    }
    case 2: {
      double dodgeBonus = 0.1 + 0.05*averageLevel;
      Spirit* spirit = new Spirit(gameGrid, heroY, heroX, name,
				  healthPower, minDamage, maxDamage,
				  armor, dodge, dodgeBonus);
      spirit->setLevel(averageLevel);
      monsters.push_back(spirit);
      break;
    }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
pushq $0x1
popq %rdi
pushq $0x2
popq %rsi
callq 0x4b2c
movl %eax, %r12d
movq 0x196f7(%rip), %rax     # 0x21280
movq (%rax), %rdi
callq 0x12af8
movq %rax, %rdi
callq 0x12b0a
movl %eax, 0x14(%rsp)
movq 0x196dc(%rip), %rax     # 0x21280
movq (%rax), %rdi
callq 0x12af8
movq %rax, %rdi
callq 0x12b06
movl %eax, 0x10(%rsp)
xorl %ebx, %ebx
xorl %ebp, %ebp
movq 0x196c5(%rip), %rcx     # 0x21288
movq 0x196b6(%rip), %rax     # 0x21280
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbx, %rcx
jbe 0x7be6
movq (%rax,%rbx,8), %rdi
callq 0x12a60
addl %eax, %ebp
incq %rbx
jmp 0x7bbc
movslq %ebp, %rax
xorl %edx, %edx
divq %rcx
movq %rax, %rbp
imull $0x32, %ebp, %eax
addl $0x1f4, %eax            # imm = 0x1F4
movl %eax, 0xc(%rsp)
imull $0xf, %ebp, %ecx
leal 0xa(%rcx), %eax
movq %rax, 0x38(%rsp)
addl $0x14, %ecx
movq %rcx, 0x20(%rsp)
cvtsi2sd %ebp, %xmm2
movsd 0xd7fc(%rip), %xmm1     # 0x15418
mulsd %xmm2, %xmm1
movsd 0xd7d8(%rip), %xmm0     # 0x15400
addsd %xmm0, %xmm1
movsd %xmm1, 0x30(%rsp)
movsd 0xd7e6(%rip), %xmm1     # 0x15420
movapd %xmm2, %xmm3
mulsd %xmm1, %xmm3
addsd %xmm0, %xmm3
movsd %xmm3, 0x28(%rsp)
movslq %r12d, %r15
movsd 0xd7b1(%rip), %xmm3     # 0x15408
mulsd %xmm2, %xmm3
addsd %xmm0, %xmm3
movsd %xmm3, 0x48(%rsp)
mulsd %xmm0, %xmm2
addsd %xmm1, %xmm2
movsd %xmm2, 0x50(%rsp)
leal 0x5(%rbp,%rbp,4), %eax
movq %rax, 0x40(%rsp)
leaq 0xb8(%rsp), %r13
subq $0x1, %r15
jb 0x7e9c
xorl %edi, %edi
pushq $0x2
popq %rsi
callq 0x4b2c
movl %eax, %r12d
movq 0x195fe(%rip), %rsi     # 0x212a0
subq 0x195ef(%rip), %rsi     # 0x21298
shrq $0x5, %rsi
decl %esi
xorl %edi, %edi
callq 0x4b2c
movslq %eax, %rsi
shlq $0x5, %rsi
addq 0x195d4(%rip), %rsi     # 0x21298
movq %r13, %rdi
callq 0x4330
cmpl $0x2, %r12d
je 0x7e00
cmpl $0x1, %r12d
je 0x7d78
testl %r12d, %r12d
jne 0x7e8f
movl $0x80, %edi
callq 0x4260
movq %rax, %r12
movq 0x19833(%rip), %rbx     # 0x21530
leaq 0x98(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x4330
subq $0x8, %rsp
movq %r12, %rdi
movq %rbx, %rsi
movl 0x1c(%rsp), %edx
movl 0x18(%rsp), %ecx
movq %r14, %r8
movl 0x14(%rsp), %r9d
movsd 0x38(%rsp), %xmm0
movsd 0x30(%rsp), %xmm1
pushq 0x48(%rsp)
pushq 0x30(%rsp)
pushq 0x50(%rsp)
callq 0x13244
addq $0x20, %rsp
movq %r14, %rdi
callq 0x4470
movq %r12, %rdi
movl %ebp, %esi
callq 0x12c2c
movq %r12, 0x18(%rsp)
leaq 0x195a7(%rip), %rdi     # 0x21310
leaq 0x18(%rsp), %rsi
callq 0x9ec2
jmp 0x7e8f
movl $0x80, %edi
callq 0x4260
movq %rax, %r12
movq 0x197a4(%rip), %rbx     # 0x21530
leaq 0x78(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x4330
movq %r12, %rdi
movq %rbx, %rsi
movl 0x14(%rsp), %edx
movl 0x10(%rsp), %ecx
movq %r14, %r8
movl 0xc(%rsp), %r9d
movsd 0x30(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x50(%rsp), %xmm2
pushq 0x20(%rsp)
pushq 0x40(%rsp)
callq 0x13320
popq %rax
popq %rcx
movq %r14, %rdi
callq 0x4470
movq %r12, %rdi
movl %ebp, %esi
callq 0x12c2c
movq %r12, 0x18(%rsp)
leaq 0x1951f(%rip), %rdi     # 0x21310
leaq 0x18(%rsp), %rsi
callq 0x9ec2
jmp 0x7e8f
movq %r13, %r14
movl $0x80, %edi
callq 0x4260
movq %rax, %r12
movq %rbp, %r13
movq 0x19716(%rip), %rbx     # 0x21530
leaq 0x58(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x4330
movq %r12, %rdi
movq %rbx, %rsi
movl 0x14(%rsp), %edx
movl 0x10(%rsp), %ecx
movq %rbp, %r8
movl 0xc(%rsp), %r9d
movsd 0x30(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x48(%rsp), %xmm2
pushq 0x20(%rsp)
pushq 0x40(%rsp)
callq 0x13400
popq %rax
popq %rcx
movq %rbp, %rdi
callq 0x4470
movq %r12, %rdi
movq %r13, %rbp
movl %ebp, %esi
callq 0x12c2c
movq %r12, 0x18(%rsp)
leaq 0x1948e(%rip), %rdi     # 0x21310
leaq 0x18(%rsp), %rsi
callq 0x9ec2
movq %r14, %r13
movq %r13, %rdi
callq 0x4470
jmp 0x7c84
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7ed5
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x4470
jmp 0x7ec7
jmp 0x7efc
movq %rax, %rbx
jmp 0x7ee9
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
jmp 0x7ee4
jmp 0x7efc
movq %rax, %rbx
jmp 0x7ee9
jmp 0x7efc
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x4470
movl $0x80, %esi
movq %r12, %rdi
callq 0x4270
jmp 0x7eff
jmp 0x7efc
jmp 0x7efc
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x4470
movq %rbx, %rdi
callq 0x4410