// File: arisKoutsou[P]oopproj/./src/game_utils.cpp
// Function: claimRewards()
void claimRewards(void) {
  for (size_t i = 0U; i != heroes.size(); ++i) {
    int monstersKilled = heroes[i]->getMonstersKilled();
    if (monstersKilled != 0) {      
      int experienceToClaim = heroes[i]->getLevel()*0.2*monstersKilled + 50*monstersKilled;

      heroes[i]->setExperience(heroes[i]->getExperience() + experienceToClaim);

      if (heroes[i]->getExperience() > heroes[i]->getExperienceMilestone()) {
	// Hero exceeded the milestone. He needs to level up.
	heroes[i]->levelUp();		// Level up the Hero. Deserves it.
	heroes[i]->nextMilestone();	// Set a new milestone.
      }

      int moneyToClaim = heroes[i]->getLevel()*0.1*monstersKilled + 100*monstersKilled;
      heroes[i]->setMoney(heroes[i]->getMoney() + moneyToClaim);

    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq 0x313d1(%rip), %rdi     # 0x40330
callq 0x133f0
movq %rax, %rcx
movq -0x20(%rbp), %rax
cmpq %rcx, %rax
je 0xf11b
movq -0x8(%rbp), %rsi
leaq 0x313b1(%rip), %rdi     # 0x40330
callq 0x133d0
movq (%rax), %rdi
callq 0x22130
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0xf108
movq -0x8(%rbp), %rsi
leaq 0x3138c(%rip), %rdi     # 0x40330
callq 0x133d0
movq (%rax), %rdi
callq 0x298e0
cvtsi2sd %eax, %xmm0
movsd 0x1f44b(%rip), %xmm1    # 0x2e408
mulsd %xmm1, %xmm0
cvtsi2sdl -0xc(%rbp), %xmm2
imull $0x32, -0xc(%rbp), %eax
cvtsi2sd %eax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rsi
leaq 0x31348(%rip), %rdi     # 0x40330
callq 0x133d0
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rsi
leaq 0x31331(%rip), %rdi     # 0x40330
callq 0x133d0
movq (%rax), %rdi
callq 0x21f40
movq -0x30(%rbp), %rdi
movl %eax, %esi
addl -0x10(%rbp), %esi
callq 0x220d0
movq -0x8(%rbp), %rsi
leaq 0x3130b(%rip), %rdi     # 0x40330
callq 0x133d0
movq (%rax), %rdi
callq 0x21f40
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rsi
leaq 0x312f0(%rip), %rdi     # 0x40330
callq 0x133d0
movq (%rax), %rdi
callq 0x22150
movl %eax, %ecx
movl -0x24(%rbp), %eax
cmpl %ecx, %eax
jle 0xf087
movq -0x8(%rbp), %rsi
leaq 0x312cf(%rip), %rdi     # 0x40330
callq 0x133d0
movq (%rax), %rdi
movq (%rdi), %rax
callq *0x38(%rax)
movq -0x8(%rbp), %rsi
leaq 0x312b6(%rip), %rdi     # 0x40330
callq 0x133d0
movq (%rax), %rdi
callq 0x22170
movq -0x8(%rbp), %rsi
leaq 0x3129e(%rip), %rdi     # 0x40330
callq 0x133d0
movq (%rax), %rdi
callq 0x298e0
cvtsi2sd %eax, %xmm0
movsd 0x1f345(%rip), %xmm1    # 0x2e3f0
mulsd %xmm1, %xmm0
cvtsi2sdl -0xc(%rbp), %xmm2
imull $0x64, -0xc(%rbp), %eax
cvtsi2sd %eax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rsi
leaq 0x3125a(%rip), %rdi     # 0x40330
callq 0x133d0
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rsi
leaq 0x31243(%rip), %rdi     # 0x40330
callq 0x133d0
movq (%rax), %rdi
callq 0x21f80
movq -0x38(%rbp), %rdi
movl %eax, %esi
addl -0x14(%rbp), %esi
callq 0x220b0
jmp 0xf10a
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0xef50
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)