// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rsi, %rbx
movq %rdi, %r14
cmpq $0x1, 0x10(%rsi)
jne 0x16c47
movq (%rbx), %rax
movq 0x10(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0xe447(%rip), %r15      # 0x24fc0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4270
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41b0
movq %rax, %r15
leaq 0x56ac(%rip), %rsi      # 0x1c256
movl $0x21, %edx
movq %rax, %rdi
callq 0x42f0
movq 0x8(%rsp), %rdi
callq 0x18694
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r15, %rdi
callq 0x42f0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4270
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41b0
movq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x166d2
movq 0x8(%rsp), %rdi
callq 0x18688
testl %eax, %eax
jne 0x16ecb
incl 0xb4(%r14)
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1857e
movq (%r14), %rdi
testq %rdi, %rdi
je 0x16ecb
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x16ecb
xorl %r13d, %r13d
movq %r13, 0x8(%rsp)
movq 0xe36a(%rip), %r15      # 0x24fc0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4270
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41b0
movq %rax, %r12
leaq 0x55f1(%rip), %rsi      # 0x1c278
movl $0x37, %edx
movq %rax, %rdi
callq 0x42f0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4270
movsbl %al, %esi
movq %r12, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41b0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4270
movsbl %al, %esi
movq %r12, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41b0
leaq 0x437f(%rip), %rsi      # 0x1b06c
movl $0x2, %edx
movq %rax, %rdi
callq 0x42f0
leaq 0x20(%rsp), %r12
movq %r12, -0x10(%r12)
movq %r13, -0x8(%r12)
movb $0x0, (%r12)
movq 0xe2bb(%rip), %rdi      # 0x24fd0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x4270
movsbl %al, %edx
movq 0xe2a0(%rip), %rdi      # 0x24fd0
leaq 0x10(%rsp), %rsi
callq 0x4460
movq (%rbx), %r13
cmpq %rbx, %r13
je 0x16d7b
movq 0x10(%r13), %rdi
callq 0x18694
movq 0x8(%rax), %rdx
cmpq 0x18(%rsp), %rdx
jne 0x16d6c
testq %rdx, %rdx
je 0x16d72
movq 0x10(%rsp), %rsi
movq (%rax), %rdi
callq 0x42b0
testl %eax, %eax
je 0x16d72
movq (%r13), %r13
jmp 0x16d3d
movq 0x10(%r13), %rax
movq %rax, 0x8(%rsp)
movq (%r15), %rax
addq -0x18(%rax), %r15
cmpq $0x0, 0x8(%rsp)
je 0x16e52
movq %r15, %rdi
movl $0xa, %esi
callq 0x4270
movsbl %al, %esi
movq 0xe21b(%rip), %rdi      # 0x24fc0
callq 0x4040
movq %rax, %rdi
callq 0x41b0
movq %rax, %r15
leaq 0x54f4(%rip), %rsi      # 0x1c2b0
movl $0x12, %edx
movq %rax, %rdi
callq 0x42f0
movq 0x8(%rsp), %rdi
callq 0x18694
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r15, %rdi
callq 0x42f0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4270
movsbl %al, %esi
movq %r15, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41b0
movq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x166d2
movq 0x8(%rsp), %rdi
callq 0x18688
testl %eax, %eax
jne 0x16eb4
incl 0xb4(%r14)
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1857e
movq (%r14), %rdi
testq %rdi, %rdi
je 0x16eb4
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x16eb4
movq %r15, %rdi
movl $0xa, %esi
callq 0x4270
movsbl %al, %esi
movq 0xe157(%rip), %rdi      # 0x24fc0
callq 0x4040
movq %rax, %rdi
callq 0x41b0
movq %rax, %rbx
leaq 0x5443(%rip), %rsi      # 0x1c2c3
movl $0x20, %edx
movq %rax, %rdi
callq 0x42f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4270
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41b0
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x16ecb
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42a0
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x16edb
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x16ef5
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %rbx, %rdi
callq 0x4430
nop