// File: arisKoutsou[P]oopproj/./src/livings/Hero.cpp
// Function: Hero::updatePotions()
void Hero::updatePotions() {
  // (George): Alternative Implementation

  list<Potion*> :: iterator potionsIterator = potions.begin();  

  for ( ; potionsIterator != potions.end(); ++potionsIterator) {
    (*potionsIterator)->roundPassed();

    if ((*potionsIterator)->getRoundsEffective() == -1) {
      double strengthBoost = (*potionsIterator)->getStrengthBoost();
      double agilityBoost = (*potionsIterator)->getAgilityBoost();
      double dexterityBoost = (*potionsIterator)->getDexterityBoost();
      
      if (strengthBoost != 0.0) {
	this->strength /= strengthBoost + 1.0;
      }

      if (agilityBoost != 0.0) {
	this->agility /= agilityBoost + 1.0;
      }

      if (dexterityBoost != 0.0) {
	this->dexterity = dexterityBoost + 1.0;
      }      

      // Rounding up 1 digit (It's like calling ceil())
      this->strength += (strengthBoost == 0.0) ? 0 : 1;
      this->dexterity += (dexterityBoost == 0.0) ? 0 : 1;

      list<Potion*> :: iterator temp = potionsIterator++;
      delete (*temp);
      potions.erase(temp);
    }    
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x50(%rbp)
addq $0x78, %rdi
callq 0x286d0
movq %rax, -0x10(%rbp)
movq -0x50(%rbp), %rdi
addq $0x78, %rdi
callq 0x28730
movq %rax, -0x18(%rbp)
leaq -0x10(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x28700
testb $0x1, %al
jne 0x23138
jmp 0x23309
leaq -0x10(%rbp), %rdi
callq 0x28760
movq (%rax), %rdi
callq 0x2cba0
leaq -0x10(%rbp), %rdi
callq 0x28760
movq (%rax), %rdi
callq 0x2cb80
cmpl $-0x1, %eax
jne 0x232f9
leaq -0x10(%rbp), %rdi
callq 0x28760
movq (%rax), %rdi
callq 0x2cb60
movsd %xmm0, -0x20(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x28760
movq (%rax), %rdi
callq 0x2cb20
movsd %xmm0, -0x28(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x28760
movq (%rax), %rdi
callq 0x2cb40
movsd %xmm0, -0x30(%rbp)
movsd -0x20(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x231b7
jp 0x231b7
jmp 0x231de
movq -0x50(%rbp), %rax
movsd 0xbb55(%rip), %xmm1     # 0x2ed18
addsd -0x20(%rbp), %xmm1
cvtsi2sdl 0x98(%rax), %xmm0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %ecx
movl %ecx, 0x98(%rax)
movsd -0x28(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x231f0
jp 0x231f0
jmp 0x23215
movq -0x50(%rbp), %rax
movsd 0xbb1c(%rip), %xmm1     # 0x2ed18
addsd -0x28(%rbp), %xmm1
movsd 0xa0(%rax), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0xa0(%rax)
movsd -0x30(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x23227
jp 0x23227
jmp 0x23242
movq -0x50(%rbp), %rax
movsd 0xbae5(%rip), %xmm0     # 0x2ed18
addsd -0x30(%rbp), %xmm0
cvttsd2si %xmm0, %ecx
movl %ecx, 0xa8(%rax)
movq -0x50(%rbp), %rax
movsd -0x20(%rbp), %xmm0
xorps %xmm1, %xmm1
movl $0x1, %ecx
xorl %edx, %edx
ucomisd %xmm1, %xmm0
setnp %dil
sete %sil
testb %dil, %sil
cmovnel %edx, %ecx
addl 0x98(%rax), %ecx
movl %ecx, 0x98(%rax)
movsd -0x30(%rbp), %xmm0
xorps %xmm1, %xmm1
movl $0x1, %ecx
xorl %edx, %edx
ucomisd %xmm1, %xmm0
setnp %dil
sete %sil
testb %dil, %sil
cmovnel %edx, %ecx
addl 0xa8(%rax), %ecx
movl %ecx, 0xa8(%rax)
leaq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x28780
movq %rax, -0x38(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x28760
movq (%rax), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, %rax
je 0x232cf
movq -0x58(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq -0x50(%rbp), %rax
addq $0x78, %rax
movq %rax, -0x60(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x28800
movq -0x60(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x287b0
movq %rax, -0x48(%rbp)
jmp 0x232fb
leaq -0x10(%rbp), %rdi
callq 0x28820
jmp 0x23111
addq $0x60, %rsp
popq %rbp
retq
nop