// File: 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 %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
callq 0x133a0
cmpq $0x1, %rax
jne 0x26c0f
movq -0x10(%rbp), %rdi
callq 0x13410
movq %rax, -0x20(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x13600
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq 0x1944e(%rip), %rdi     # 0x3ffc0
movq 0x19427(%rip), %rsi     # 0x3ffa0
callq 0x5330
movq %rax, %rdi
leaq 0x86a6(%rip), %rsi      # 0x2f22e
callq 0x52f0
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rdi
callq 0x29900
movq -0x78(%rbp), %rdi
movq %rax, %rsi
callq 0x52a0
movq %rax, %rdi
movq 0x193f0(%rip), %rsi     # 0x3ffa0
callq 0x5330
movq -0x70(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x265b0
movq -0x18(%rbp), %rdi
callq 0x298a0
cmpl $0x0, %eax
jne 0x26c0a
movq -0x70(%rbp), %rax
movl 0xb4(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xb4(%rax)
movq -0x10(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x28a70
movq -0x18(%rbp), %rax
movq %rax, -0x80(%rbp)
cmpq $0x0, %rax
je 0x26c08
movq -0x80(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x26c0a
jmp 0x26e8c
movq $0x0, -0x18(%rbp)
movq 0x193a2(%rip), %rdi     # 0x3ffc0
movq 0x1937b(%rip), %rsi     # 0x3ffa0
movq %rsi, -0x90(%rbp)
callq 0x5330
movq %rax, %rdi
leaq 0x8615(%rip), %rsi      # 0x2f250
callq 0x52f0
movq -0x90(%rbp), %rsi
movq %rax, %rdi
callq 0x5330
movq -0x90(%rbp), %rsi
movq %rax, %rdi
callq 0x5330
movq %rax, %rdi
leaq 0x73d4(%rip), %rsi      # 0x2e03c
callq 0x52f0
leaq -0x40(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq 0x5460
movq -0x10(%rbp), %rdi
callq 0x13410
movq -0x88(%rbp), %rsi
movq %rax, -0x48(%rbp)
movq 0x19340(%rip), %rdi     # 0x3ffd8
callq 0x5070
jmp 0x26c9f
movq -0x10(%rbp), %rdi
callq 0x13410
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0x135a0
movq %rax, -0x68(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x135d0
testb $0x1, %al
jne 0x26cd4
jmp 0x26d40
leaq -0x48(%rbp), %rdi
callq 0x13600
movq (%rax), %rdi
callq 0x29900
movq %rax, -0x98(%rbp)
jmp 0x26cee
movq -0x98(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x7e80
testb $0x1, %al
jne 0x26d04
jmp 0x26d30
leaq -0x48(%rbp), %rdi
callq 0x13600
movq (%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x26d40
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x55d0
jmp 0x26e95
jmp 0x26d32
leaq -0x48(%rbp), %rdi
callq 0x13620
jmp 0x26cb4
cmpq $0x0, -0x18(%rbp)
je 0x26e34
movq 0x1926e(%rip), %rdi     # 0x3ffc0
movq 0x19247(%rip), %rsi     # 0x3ffa0
callq 0x5330
movq %rax, -0xa0(%rbp)
jmp 0x26d67
movq -0xa0(%rbp), %rdi
leaq 0x8513(%rip), %rsi      # 0x2f288
callq 0x52f0
movq %rax, -0xa8(%rbp)
jmp 0x26d83
movq -0x18(%rbp), %rdi
callq 0x29900
movq %rax, -0xb0(%rbp)
jmp 0x26d95
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdi
callq 0x52a0
movq %rax, -0xb8(%rbp)
jmp 0x26db1
movq -0xb8(%rbp), %rdi
movq 0x191e1(%rip), %rsi     # 0x3ffa0
callq 0x5330
jmp 0x26dc6
movq -0x70(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x265b0
jmp 0x26dd5
movq -0x18(%rbp), %rdi
callq 0x298a0
movl %eax, -0xbc(%rbp)
jmp 0x26de6
movl -0xbc(%rbp), %eax
cmpl $0x0, %eax
jne 0x26e32
movq -0x70(%rbp), %rax
movl 0xb4(%rax), %ecx
incl %ecx
movl %ecx, 0xb4(%rax)
movq -0x10(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x28a70
jmp 0x26e12
movq -0x18(%rbp), %rax
movq %rax, -0xc8(%rbp)
cmpq $0x0, %rax
je 0x26e30
movq -0xc8(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x26e32
jmp 0x26e83
movq 0x19185(%rip), %rdi     # 0x3ffc0
movq 0x1915e(%rip), %rsi     # 0x3ffa0
callq 0x5330
movq %rax, -0xd0(%rbp)
jmp 0x26e50
movq -0xd0(%rbp), %rdi
leaq 0x843d(%rip), %rsi      # 0x2f29b
callq 0x52f0
movq %rax, -0xd8(%rbp)
jmp 0x26e6c
movq -0xd8(%rbp), %rdi
movq 0x19126(%rip), %rsi     # 0x3ffa0
callq 0x5330
jmp 0x26e81
jmp 0x26e83
leaq -0x40(%rbp), %rdi
callq 0x55d0
addq $0xe0, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x5550
nop