// File: /workspace/github_cpp_makefile_star2_O2/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 0x13d6e
movq 0x48(%r14), %rsi
testb %al, %al
je 0x101e6
testq %rsi, %rsi
je 0x101c0
leaq 0xc0(%r14), %rdi
callq 0xb74a
movq 0x50(%r14), %rsi
testq %rsi, %rsi
je 0x101d5
leaq 0xc0(%r14), %rdi
callq 0xb74a
movq (%rsp), %rax
movq %rax, 0x50(%r14)
movq %rax, 0x48(%r14)
jmp 0x10341
leaq 0x48(%r14), %rax
movq %rax, 0x10(%rsp)
leaq 0x50(%r14), %rax
movq %rax, 0x8(%rsp)
testq %rsi, %rsi
je 0x10322
cmpq $0x0, 0x50(%r14)
je 0x10322
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
addq $0xc0, %r14
movq 0x10d95(%rip), %rbp     # 0x20fc0
leaq 0x5e87(%rip), %r13      # 0x160b9
leaq 0x5eb2(%rip), %r12      # 0x160eb
leaq 0x18(%rsp), %r15
movq %rbp, %rdi
movq %r13, %rsi
callq 0x4250
movq %rax, %rdi
movq %r12, %rsi
callq 0x4250
movq %rax, %rdi
callq 0x4120
movq %rax, %rdi
callq 0x4120
movq %rax, %rdi
leaq 0x5ea0(%rip), %rsi      # 0x1610e
callq 0x4250
movq 0x10d56(%rip), %rdi     # 0x20fd0
movq %r15, %rsi
callq 0x4060
movq %r15, %rbx
movq %r15, %rdi
leaq 0x5531(%rip), %rsi      # 0x157c0
callq 0x5b02
testb %al, %al
je 0x102ad
movq 0x10(%rsp), %rbx
movq (%rbx), %rsi
movq %r14, %rdi
callq 0xb74a
movq %rbx, %rax
jmp 0x102e1
movq %rbx, %rdi
leaq 0x550e(%rip), %rsi      # 0x157c5
callq 0x5b02
testb %al, %al
je 0x102e8
movq %rbp, %rbx
movq 0x8(%rsp), %rbp
movq (%rbp), %rsi
movq %r14, %rdi
callq 0xb74a
movq %rbp, %rax
movq %rbx, %rbp
leaq 0x5e0a(%rip), %r12      # 0x160eb
movq (%rsp), %rcx
movq %rcx, (%rax)
movq %r15, %rdi
leaq 0x54ce(%rip), %rsi      # 0x157c0
callq 0x5808
testb %al, %al
jne 0x1023e
movq %r15, %rdi
leaq 0x54bc(%rip), %rsi      # 0x157c5
callq 0x5808
testb %al, %al
jne 0x1023e
leaq 0x18(%rsp), %rdi
callq 0x4470
jmp 0x10341
testq %rsi, %rsi
je 0x10335
movq 0x8(%rsp), %rax
movq (%rsp), %rcx
movq %rcx, (%rax)
jmp 0x10341
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
leaq 0x18(%rsp), %rdi
callq 0x4470
movq %rbx, %rdi
callq 0x4410
nop