// File: /workspace/github_cpp_makefile_star2_O3/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 $0xc8, %rsp
movl $0x1, %edi
movl $0x2, %esi
callq 0x4df6
movl %eax, %r12d
movq 0x1c190(%rip), %rax     # 0x25290
movq (%rax), %rdi
callq 0x187a8
movq %rax, %rdi
callq 0x187ba
movl %eax, 0x14(%rsp)
movq 0x1c175(%rip), %rax     # 0x25290
movq (%rax), %rdi
callq 0x187a8
movq %rax, %rdi
callq 0x187b6
movl %eax, 0x10(%rsp)
movq 0x1c162(%rip), %rcx     # 0x25298
movq 0x1c153(%rip), %rax     # 0x25290
xorl %r14d, %r14d
subq %rax, %rcx
je 0x9175
xorl %ebx, %ebx
movq (%rax,%rbx,8), %rdi
callq 0x186f8
addl %eax, %r14d
incq %rbx
movq 0x1c13b(%rip), %rcx     # 0x25298
movq 0x1c12c(%rip), %rax     # 0x25290
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbx, %rcx
ja 0x9147
movslq %r14d, %r14
jmp 0x9179
sarq $0x3, %rcx
movq %r14, %rax
xorl %edx, %edx
divq %rcx
testl %r12d, %r12d
je 0x94ed
movq %rax, %r14
imull $0x32, %r14d, %eax
addl $0x1f4, %eax            # imm = 0x1F4
movl %eax, 0xc(%rsp)
leal (%r14,%r14,4), %eax
leal (%rax,%rax,2), %ecx
addl $0xa, %ecx
movq %rcx, 0x28(%rsp)
leal 0x14(%rax,%rax,2), %ebx
cvtsi2sd %r14d, %xmm1
movsd 0x1226e(%rip), %xmm2    # 0x1b428
mulsd %xmm1, %xmm2
movsd 0x1224a(%rip), %xmm0    # 0x1b410
addsd %xmm0, %xmm2
movsd %xmm2, 0x20(%rsp)
movsd 0x12258(%rip), %xmm2    # 0x1b430
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
movsd %xmm2, 0x18(%rsp)
movslq %r12d, %rbp
movsd 0x12227(%rip), %xmm2    # 0x1b418
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
movsd %xmm2, 0xb8(%rsp)
mulsd %xmm0, %xmm1
addsd 0x12222(%rip), %xmm1    # 0x1b430
movsd %xmm1, 0xc0(%rsp)
leal (%r14,%r14,4), %eax
addl $0x5, %eax
movq %rax, 0xb0(%rsp)
xorl %edi, %edi
movl $0x2, %esi
callq 0x4df6
movl %eax, %r13d
movq 0x1c074(%rip), %rsi     # 0x252b0
subq 0x1c065(%rip), %rsi     # 0x252a8
shrq $0x5, %rsi
decl %esi
xorl %edi, %edi
callq 0x4df6
cltq
movq 0x1c04f(%rip), %rcx     # 0x252a8
shlq $0x5, %rax
leaq 0x40(%rsp), %rdx
movq %rdx, 0x30(%rsp)
movq (%rcx,%rax), %rsi
movq 0x8(%rcx,%rax), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0x4cf0
cmpl $0x2, %r13d
je 0x9405
cmpl $0x1, %r13d
je 0x9355
testl %r13d, %r13d
jne 0x94c8
movl $0x80, %edi
callq 0x4290
movq %rax, %r13
movq 0x1c292(%rip), %r12     # 0x25540
leaq 0xa0(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x90(%rsp), %r15
movq %r15, %rdi
callq 0x4cf0
subq $0x8, %rsp
movq %r13, %rdi
movq %r12, %rsi
movl 0x1c(%rsp), %edx
movl 0x18(%rsp), %ecx
movq %r15, %r8
movl 0x14(%rsp), %r9d
movsd 0x28(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
pushq 0xb8(%rsp)
pushq %rbx
pushq 0x40(%rsp)
callq 0x18f7c
addq $0x20, %rsp
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x933b
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %r13, %rdi
movl %r14d, %esi
callq 0x18914
movl $0x18, %edi
callq 0x4290
jmp 0x94ae
movl $0x80, %edi
callq 0x4290
movq %rax, %r13
movq 0x1c1d7(%rip), %r12     # 0x25540
leaq 0x80(%rsp), %rax
movq %rax, 0x70(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x70(%rsp), %r15
movq %r15, %rdi
callq 0x4cf0
movq %r13, %rdi
movq %r12, %rsi
movl 0x14(%rsp), %edx
movl 0x10(%rsp), %ecx
movq %r15, %r8
movl 0xc(%rsp), %r9d
movsd 0x20(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movsd 0xc0(%rsp), %xmm2
pushq %rbx
pushq 0x30(%rsp)
callq 0x190c8
addq $0x10, %rsp
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x93eb
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %r13, %rdi
movl %r14d, %esi
callq 0x18914
movl $0x18, %edi
callq 0x4290
jmp 0x94ae
movl $0x80, %edi
callq 0x4290
movq %rax, %r13
movq %rbx, %r15
movq 0x1c124(%rip), %r12     # 0x25540
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
addq %rsi, %rdx
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
callq 0x4cf0
movq %r13, %rdi
movq %r12, %rsi
movl 0x14(%rsp), %edx
movl 0x10(%rsp), %ecx
movq %rbx, %r8
movl 0xc(%rsp), %r9d
movsd 0x20(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movsd 0xb8(%rsp), %xmm2
movq %r15, %rbx
pushq %r15
pushq 0x30(%rsp)
callq 0x19218
addq $0x10, %rsp
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x9499
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %r13, %rdi
movl %r14d, %esi
callq 0x18914
movl $0x18, %edi
callq 0x4290
movq %r13, 0x10(%rax)
movq %rax, %rdi
leaq 0x1be64(%rip), %rsi     # 0x25320
callq 0x4050
incq 0x1be68(%rip)           # 0x25330
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x94e4
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42a0
decq %rbp
jne 0x9226
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x955b
movq %rax, %r14
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x9530
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x9530
jmp 0x9594
movq %rax, %r14
jmp 0x9581
movq %rax, %r14
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x9557
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x9581
jmp 0x9594
movq %rax, %r14
jmp 0x9581
jmp 0x9594
movq %rax, %r14
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x9581
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x42a0
movl $0x80, %esi
movq %r13, %rdi
callq 0x42a0
jmp 0x9597
jmp 0x9594
jmp 0x9594
movq %rax, %r14
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x95b3
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %r14, %rdi
callq 0x4430