// File: 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
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movl $0x1, %edi
movl $0x2, %esi
callq 0x6040
movl %eax, -0x4(%rbp)
leaq 0x31a9c(%rip), %rdi     # 0x40330
xorl %eax, %eax
movl %eax, %esi
callq 0x133d0
movq (%rax), %rdi
callq 0x29a80
movq %rax, %rdi
callq 0x29ae0
movl %eax, -0x8(%rbp)
leaq 0x31a79(%rip), %rdi     # 0x40330
xorl %eax, %eax
movl %eax, %esi
callq 0x133d0
movq (%rax), %rdi
callq 0x29a80
movq %rax, %rdi
callq 0x29ad0
movl %eax, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rax
movq %rax, -0x138(%rbp)
leaq 0x31a3d(%rip), %rdi     # 0x40330
callq 0x133f0
movq %rax, %rcx
movq -0x138(%rbp), %rax
cmpq %rcx, %rax
jae 0xe930
movslq -0x14(%rbp), %rsi
leaq 0x31a1e(%rip), %rdi     # 0x40330
callq 0x133d0
movq (%rax), %rdi
callq 0x298e0
addl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xe8e1
leaq 0x319f9(%rip), %rdi     # 0x40330
callq 0x133f0
movq %rax, %rcx
movslq -0x10(%rbp), %rax
xorl %edx, %edx
divq %rcx
movl %eax, -0x10(%rbp)
imull $0x32, -0x10(%rbp), %eax
addl $0x1f4, %eax            # imm = 0x1F4
movl %eax, -0x18(%rbp)
imull $0xf, -0x10(%rbp), %eax
addl $0xa, %eax
movl %eax, -0x1c(%rbp)
imull $0xf, -0x10(%rbp), %eax
addl $0x14, %eax
movl %eax, -0x20(%rbp)
cvtsi2sdl -0x10(%rbp), %xmm0
movsd 0x1fa90(%rip), %xmm1    # 0x2e408
mulsd %xmm1, %xmm0
movsd 0x1fa6c(%rip), %xmm1    # 0x2e3f0
addsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
cvtsi2sdl -0x10(%rbp), %xmm0
movsd 0x1fa76(%rip), %xmm1    # 0x2e410
mulsd %xmm1, %xmm0
movsd 0x1fa4a(%rip), %xmm1    # 0x2e3f0
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movslq -0x4(%rbp), %rcx
cmpq %rcx, %rax
je 0xee8a
xorl %edi, %edi
movl %edi, -0x14c(%rbp)
movl $0x2, %esi
callq 0x6040
movl %eax, -0x3c(%rbp)
leaq 0x31964(%rip), %rdi     # 0x40348
movq %rdi, -0x148(%rbp)
callq 0x6390
movl -0x14c(%rbp), %edi
movl %eax, %esi
decl %esi
callq 0x6040
movq -0x148(%rbp), %rdi
movslq %eax, %rsi
callq 0x132f0
movq %rax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x5120
movl -0x3c(%rbp), %eax
movl %eax, -0x13c(%rbp)
testl %eax, %eax
je 0xea4e
jmp 0xea29
movl -0x13c(%rbp), %eax
subl $0x1, %eax
je 0xeba7
jmp 0xea3a
movl -0x13c(%rbp), %eax
subl $0x2, %eax
je 0xed09
jmp 0xee65
movl -0x10(%rbp), %ecx
movl %ecx, %eax
leal 0x5(%rax,%rax,4), %eax
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x68(%rbp)
movl $0x80, %edi
callq 0x5300
movq %rax, -0x158(%rbp)
jmp 0xea73
movb $0x1, -0xa1(%rbp)
movq 0x31b5f(%rip), %rax     # 0x405e0
movq %rax, -0x168(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x160(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x15c(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x5120
jmp 0xeaac
movl -0x15c(%rbp), %ecx
movl -0x160(%rbp), %edx
movq -0x168(%rbp), %rsi
movq -0x158(%rbp), %rdi
movl -0x18(%rbp), %r9d
movl -0x1c(%rbp), %r8d
movl -0x20(%rbp), %r10d
movsd -0x28(%rbp), %xmm0
movsd -0x30(%rbp), %xmm1
cvttsd2si -0x68(%rbp), %r11d
movq %rsp, %rax
movl %r11d, 0x10(%rax)
movl %r10d, 0x8(%rax)
movl %r8d, (%rax)
leaq -0xa0(%rbp), %r8
callq 0x2afa0
jmp 0xeafe
movb $0x0, -0xa1(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x55d0
movq -0x158(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
movl -0x10(%rbp), %esi
callq 0x29de0
jmp 0xeb2a
movq -0x70(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq 0x31884(%rip), %rdi     # 0x403c0
leaq -0xb0(%rbp), %rsi
callq 0x134b0
jmp 0xeb4a
jmp 0xee65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xee7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xeb86
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x55d0
testb $0x1, -0xa1(%rbp)
jne 0xeb91
jmp 0xeba2
movq -0x158(%rbp), %rdi
movl $0x80, %esi
callq 0x5310
jmp 0xee7f
cvtsi2sdl -0x10(%rbp), %xmm0
movsd 0x1f83c(%rip), %xmm1    # 0x2e3f0
mulsd %xmm1, %xmm0
movsd 0x1f850(%rip), %xmm1    # 0x2e410
addsd %xmm1, %xmm0
movsd %xmm0, -0xb8(%rbp)
movl $0x80, %edi
callq 0x5300
movq %rax, -0x170(%rbp)
jmp 0xebdf
movb $0x1, -0xe1(%rbp)
movq 0x319f3(%rip), %rax     # 0x405e0
movq %rax, -0x180(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x178(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x174(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x5120
jmp 0xec18
movl -0x174(%rbp), %ecx
movl -0x178(%rbp), %edx
movq -0x180(%rbp), %rsi
movq -0x170(%rbp), %rdi
movl -0x18(%rbp), %r9d
movl -0x1c(%rbp), %r8d
movl -0x20(%rbp), %r10d
movsd -0x28(%rbp), %xmm0
movsd -0x30(%rbp), %xmm1
movsd -0xb8(%rbp), %xmm2
movq %rsp, %rax
movl %r10d, 0x8(%rax)
movl %r8d, (%rax)
leaq -0xe0(%rbp), %r8
callq 0x2b100
jmp 0xec68
movb $0x0, -0xe1(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x55d0
movq -0x170(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rdi
movl -0x10(%rbp), %esi
callq 0x29de0
jmp 0xec9a
movq -0xc0(%rbp), %rax
movq %rax, -0xf0(%rbp)
leaq 0x31711(%rip), %rdi     # 0x403c0
leaq -0xf0(%rbp), %rsi
callq 0x134b0
jmp 0xecbd
jmp 0xee65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xece8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x55d0
testb $0x1, -0xe1(%rbp)
jne 0xecf3
jmp 0xed04
movq -0x170(%rbp), %rdi
movl $0x80, %esi
callq 0x5310
jmp 0xee7f
cvtsi2sdl -0x10(%rbp), %xmm0
movsd 0x1f6e2(%rip), %xmm1    # 0x2e3f8
mulsd %xmm1, %xmm0
movsd 0x1f6ce(%rip), %xmm1    # 0x2e3f0
addsd %xmm1, %xmm0
movsd %xmm0, -0xf8(%rbp)
movl $0x80, %edi
callq 0x5300
movq %rax, -0x188(%rbp)
jmp 0xed41
movb $0x1, -0x121(%rbp)
movq 0x31891(%rip), %rax     # 0x405e0
movq %rax, -0x198(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x190(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x18c(%rbp)
leaq -0x120(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x5120
jmp 0xed7a
movl -0x18c(%rbp), %ecx
movl -0x190(%rbp), %edx
movq -0x198(%rbp), %rsi
movq -0x188(%rbp), %rdi
movl -0x18(%rbp), %r9d
movl -0x1c(%rbp), %r8d
movl -0x20(%rbp), %r10d
movsd -0x28(%rbp), %xmm0
movsd -0x30(%rbp), %xmm1
movsd -0xf8(%rbp), %xmm2
movq %rsp, %rax
movl %r10d, 0x8(%rax)
movl %r8d, (%rax)
leaq -0x120(%rbp), %r8
callq 0x2b270
jmp 0xedca
movb $0x0, -0x121(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x55d0
movq -0x188(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rdi
movl -0x10(%rbp), %esi
callq 0x29de0
jmp 0xedfc
movq -0x100(%rbp), %rax
movq %rax, -0x130(%rbp)
leaq 0x315af(%rip), %rdi     # 0x403c0
leaq -0x130(%rbp), %rsi
callq 0x134b0
jmp 0xee1f
jmp 0xee65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xee47
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x55d0
testb $0x1, -0x121(%rbp)
jne 0xee52
jmp 0xee63
movq -0x188(%rbp), %rdi
movl $0x80, %esi
callq 0x5310
jmp 0xee7f
leaq -0x60(%rbp), %rdi
callq 0x55d0
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0xe9b7
leaq -0x60(%rbp), %rdi
callq 0x55d0
jmp 0xee93
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x5550
nopl (%rax)