// File: /workspace/github_cpp_makefile_star2_O1/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 0x4dee
movl %eax, %r12d
movq 0x1c1da(%rip), %rax     # 0x25290
movq (%rax), %rdi
callq 0x18724
movq %rax, %rdi
callq 0x18736
movl %eax, 0x14(%rsp)
movq 0x1c1bf(%rip), %rax     # 0x25290
movq (%rax), %rdi
callq 0x18724
movq %rax, %rdi
callq 0x18732
movl %eax, 0x10(%rsp)
movq 0x1c1ac(%rip), %rcx     # 0x25298
movq 0x1c19d(%rip), %rax     # 0x25290
xorl %r14d, %r14d
subq %rax, %rcx
je 0x912b
xorl %ebx, %ebx
movq (%rax,%rbx,8), %rdi
callq 0x18690
addl %eax, %r14d
incq %rbx
movq 0x1c185(%rip), %rcx     # 0x25298
movq 0x1c176(%rip), %rax     # 0x25290
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbx, %rcx
ja 0x90fd
movslq %r14d, %r14
jmp 0x912f
sarq $0x3, %rcx
movq %r14, %rax
xorl %edx, %edx
divq %rcx
testl %r12d, %r12d
je 0x94a3
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 0x122b8(%rip), %xmm2    # 0x1b428
mulsd %xmm1, %xmm2
movsd 0x12294(%rip), %xmm0    # 0x1b410
addsd %xmm0, %xmm2
movsd %xmm2, 0x20(%rsp)
movsd 0x122a2(%rip), %xmm2    # 0x1b430
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
movsd %xmm2, 0x18(%rsp)
movslq %r12d, %rbp
movsd 0x12271(%rip), %xmm2    # 0x1b418
mulsd %xmm1, %xmm2
addsd %xmm0, %xmm2
movsd %xmm2, 0xb8(%rsp)
mulsd %xmm0, %xmm1
addsd 0x1226c(%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 0x4dee
movl %eax, %r13d
movq 0x1c0be(%rip), %rsi     # 0x252b0
subq 0x1c0af(%rip), %rsi     # 0x252a8
shrq $0x5, %rsi
decl %esi
xorl %edi, %edi
callq 0x4dee
cltq
movq 0x1c099(%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 0x93bb
cmpl $0x1, %r13d
je 0x930b
testl %r13d, %r13d
jne 0x947e
movl $0x80, %edi
callq 0x4290
movq %rax, %r13
movq 0x1c2dc(%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 0x18f14
addq $0x20, %rsp
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x92f1
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %r13, %rdi
movl %r14d, %esi
callq 0x18890
movl $0x18, %edi
callq 0x4290
jmp 0x9464
movl $0x80, %edi
callq 0x4290
movq %rax, %r13
movq 0x1c221(%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 0x1904c
addq $0x10, %rsp
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x93a1
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %r13, %rdi
movl %r14d, %esi
callq 0x18890
movl $0x18, %edi
callq 0x4290
jmp 0x9464
movl $0x80, %edi
callq 0x4290
movq %rax, %r13
movq %rbx, %r15
movq 0x1c16e(%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 0x1919c
addq $0x10, %rsp
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x944f
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %r13, %rdi
movl %r14d, %esi
callq 0x18890
movl $0x18, %edi
callq 0x4290
movq %r13, 0x10(%rax)
movq %rax, %rdi
leaq 0x1beae(%rip), %rsi     # 0x25320
callq 0x4050
incq 0x1beb2(%rip)           # 0x25330
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x949a
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42a0
decq %rbp
jne 0x91dc
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9511
movq %rax, %r14
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x94e6
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x94e6
jmp 0x954a
movq %rax, %r14
jmp 0x9537
movq %rax, %r14
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x950d
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x9537
jmp 0x954a
movq %rax, %r14
jmp 0x9537
jmp 0x954a
movq %rax, %r14
movq 0x50(%rsp), %rdi
leaq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0x9537
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x42a0
movl $0x80, %esi
movq %r13, %rdi
callq 0x42a0
jmp 0x954d
jmp 0x954a
jmp 0x954a
movq %rax, %r14
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x9569
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %r14, %rdi
callq 0x4430