// File: /workspace/github_cpp_makefile_star2_O3/arisKoutsou[P]oopproj/./src/livings/Hero.cpp
// Function: Hero::equipWeapon(Weapon*)
void Hero :: equipWeapon(Weapon* weapon) {
  bool weaponNeedsBothHands = weapon->needsBothHands();
      
  if (weaponNeedsBothHands) {
    if (this->usesLeftHand()) {
      this->inventory.addItem(this->leftHandWeapon);
    }
    if (this->usesRightHand()) {
      this->inventory.addItem(this->rightHandWeapon);
    }
    this->leftHandWeapon = this->rightHandWeapon = weapon;
  } else {
    if (this->usesBothHands()) {
      string hand;
      do {
	cout << "You are using both hands. Would you like to equip"
	     << " the weapon to left of right hand?" << endl << endl << " >";

        getline(cin, hand);

	if (hand == "left") {
	  this->inventory.addItem(this->leftHandWeapon);
	  this->leftHandWeapon = weapon;
	} else if (hand == "right") {
	  this->inventory.addItem(this->rightHandWeapon);
	  this->rightHandWeapon = weapon;
	}
      } while (hand != "left" || hand != "right");
    } else if (this->usesLeftHand()) {
      this->rightHandWeapon = weapon;
    } else {
      this->leftHandWeapon = weapon;
    }
  }    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r14
movq %rsi, (%rsp)
movq %rsi, %rdi
callq 0x19db6
movq 0x48(%r14), %rsi
testb %al, %al
je 0x14afc
testq %rsi, %rsi
je 0x14ad6
leaq 0xc0(%r14), %rdi
callq 0xea7c
movq 0x50(%r14), %rsi
testq %rsi, %rsi
je 0x14aeb
leaq 0xc0(%r14), %rdi
callq 0xea7c
movq (%rsp), %rax
movq %rax, 0x50(%r14)
movq %rax, 0x48(%r14)
jmp 0x14cbc
leaq 0x48(%r14), %rax
movq %rax, 0x10(%rsp)
leaq 0x50(%r14), %rax
movq %rax, 0x8(%rsp)
testq %rsi, %rsi
je 0x14ca0
cmpq $0x0, 0x50(%r14)
je 0x14ca0
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
addq $0xc0, %r14
movq 0x1047c(%rip), %r15     # 0x24fc0
movq 0x10485(%rip), %r12     # 0x24fd0
leaq 0x18(%rsp), %r13
leaq 0x6c79(%rip), %rbp      # 0x1b7d0
movl $0x31, %edx
movq %r15, %rdi
leaq 0x7563(%rip), %rsi      # 0x1c0c9
callq 0x42f0
movl $0x22, %edx
movq %r15, %rdi
leaq 0x7581(%rip), %rsi      # 0x1c0fb
callq 0x42f0
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, %rbx
movq (%rax), %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
movl $0x2, %edx
movq %rax, %rdi
leaq 0x753f(%rip), %rsi      # 0x1c11e
callq 0x42f0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4270
movsbl %al, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x4460
movq %r13, %rdi
movq %rbp, %rsi
callq 0x40d0
testl %eax, %eax
je 0x14c3e
movq %r13, %rdi
leaq 0x6bb5(%rip), %rsi      # 0x1b7d5
callq 0x40d0
testl %eax, %eax
jne 0x14c58
movq 0x8(%rsp), %rbx
movq (%rbx), %rsi
movq %r14, %rdi
callq 0xea7c
movq %rbx, %rax
jmp 0x14c51
movq 0x10(%rsp), %rbx
movq (%rbx), %rsi
movq %r14, %rdi
callq 0xea7c
movq %rbx, %rax
movq (%rsp), %rcx
movq %rcx, (%rax)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x40d0
testl %eax, %eax
jne 0x14b57
movq %r13, %rdi
leaq 0x6b60(%rip), %rsi      # 0x1b7d5
callq 0x40d0
testl %eax, %eax
jne 0x14b57
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x14cbc
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x14cbc
testq %rsi, %rsi
je 0x14cb0
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
jmp 0x14cb9
movq (%rsp), %rax
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x14cea
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %rbx, %rdi
callq 0x4430