// File: /workspace/github_cpp_makefile_star2_O2/arisKoutsou[P]oopproj/./src/livings/Hero.cpp
// Function: Hero::handleAttackCase(std::__cxx11::list<Monster*, std::allocator<Monster*>>&)
void Hero :: handleAttackCase(list<Monster*>& monsters) {
  Monster* monsterToAttack;

  if (monsters.size() == 1) {
    monsterToAttack = *monsters.begin();

    cout << endl
	 << "Attacking the only monster here: "
	 << monsterToAttack->getName() << endl;

    this->attack(monsterToAttack);

    if (monsterToAttack->getHealthPower() == 0) {
      ++this->monstersKilled;
      monsters.remove(monsterToAttack);
      delete monsterToAttack;
    }
  } else {

    monsterToAttack = NULL;
    cout << endl
	 << "Please enter the name of the monster you want to attack"
	 << endl << endl << "> ";
    string name;
    list<Monster*> :: iterator it = monsters.begin();
    getline(cin, name);      
    for (it = monsters.begin() ; it != monsters.end(); ++it) {
      if ((*it)->getName() == name) {
	monsterToAttack = (*it);
	break;
      }
    }

    if (monsterToAttack != NULL) {

      cout << endl << "Attacking Monster " << monsterToAttack->getName() << endl;

      this->attack(monsterToAttack);

      if (monsterToAttack->getHealthPower() == 0) {
	++this->monstersKilled;
	monsters.remove(monsterToAttack);
	delete monsterToAttack;            
      }
    } else {

      cout << endl << "There is no such Monster here..." << endl;
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
cmpq $0x1, 0x10(%rsi)
jne 0x1180f
movq (%rbx), %rax
movq 0x10(%rax), %r15
movq %r15, (%rsp)
movq 0xf82a(%rip), %rdi      # 0x20fc0
callq 0x4120
leaq 0x4ab4(%rip), %rsi      # 0x16256
movq %rax, %rdi
callq 0x4250
movq %rax, %r12
movq %r15, %rdi
callq 0x12a64
movq %r12, %rdi
movq %rax, %rsi
callq 0x4220
movq %rax, %rdi
callq 0x4120
movq %r14, %rdi
movq %r15, %rsi
callq 0x11414
movq %r15, %rdi
callq 0x12a58
testl %eax, %eax
jne 0x11953
incl 0xb4(%r14)
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x127e0
movq (%r14), %rdi
testq %rdi, %rdi
je 0x11953
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x11953
andq $0x0, (%rsp)
movq 0xf7a5(%rip), %rdi      # 0x20fc0
callq 0x4120
leaq 0x4a51(%rip), %rsi      # 0x16278
movq %rax, %rdi
callq 0x4250
movq %rax, %rdi
callq 0x4120
movq %rax, %rdi
callq 0x4120
leaq 0x37f6(%rip), %rsi      # 0x1503c
movq %rax, %rdi
callq 0x4250
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0xf76a(%rip), %rdi      # 0x20fd0
leaq 0x8(%rsp), %rsi
callq 0x4060
leaq 0x8(%rsp), %r15
movq %rbx, %r12
movq (%r12), %r12
cmpq %rbx, %r12
je 0x118a5
movq 0x10(%r12), %rdi
callq 0x12a64
movq %rax, %rdi
movq %r15, %rsi
callq 0x57df
testb %al, %al
je 0x11878
movq 0x10(%r12), %rax
movq %rax, (%rsp)
jmp 0x118a9
movq (%rsp), %rax
testq %rax, %rax
je 0x11926
movq 0xf70b(%rip), %rdi      # 0x20fc0
callq 0x4120
leaq 0x49ef(%rip), %rsi      # 0x162b0
movq %rax, %rdi
callq 0x4250
movq %rax, %r15
movq (%rsp), %rdi
callq 0x12a64
movq %r15, %rdi
movq %rax, %rsi
callq 0x4220
movq %rax, %rdi
callq 0x4120
movq (%rsp), %rsi
movq %r14, %rdi
callq 0x11414
movq (%rsp), %rdi
callq 0x12a58
testl %eax, %eax
jne 0x11949
incl 0xb4(%r14)
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x127e0
movq (%r14), %rdi
testq %rdi, %rdi
je 0x11949
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x11949
movq 0xf693(%rip), %rdi      # 0x20fc0
callq 0x4120
leaq 0x498a(%rip), %rsi      # 0x162c3
movq %rax, %rdi
callq 0x4250
movq %rax, %rdi
callq 0x4120
leaq 0x8(%rsp), %rdi
callq 0x4470
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x11961
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4470
movq %rbx, %rdi
callq 0x4410