// File: /workspace/github_cpp_makefile_star2_O1/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 0x19d34
movq 0x48(%r14), %rsi
testb %al, %al
je 0x14a90
testq %rsi, %rsi
je 0x14a6a
leaq 0xc0(%r14), %rdi
callq 0xea48
movq 0x50(%r14), %rsi
testq %rsi, %rsi
je 0x14a7f
leaq 0xc0(%r14), %rdi
callq 0xea48
movq (%rsp), %rax
movq %rax, 0x50(%r14)
movq %rax, 0x48(%r14)
jmp 0x14c50
leaq 0x48(%r14), %rax
movq %rax, 0x10(%rsp)
leaq 0x50(%r14), %rax
movq %rax, 0x8(%rsp)
testq %rsi, %rsi
je 0x14c34
cmpq $0x0, 0x50(%r14)
je 0x14c34
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
addq $0xc0, %r14
movq 0x104e8(%rip), %r15     # 0x24fc0
movq 0x104f1(%rip), %r12     # 0x24fd0
leaq 0x18(%rsp), %r13
leaq 0x6ce5(%rip), %rbp      # 0x1b7d0
movl $0x31, %edx
movq %r15, %rdi
leaq 0x75bf(%rip), %rsi      # 0x1c0b9
callq 0x42f0
movl $0x22, %edx
movq %r15, %rdi
leaq 0x75dd(%rip), %rsi      # 0x1c0eb
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 0x759b(%rip), %rsi      # 0x1c10e
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 0x14bd2
movq %r13, %rdi
leaq 0x6c21(%rip), %rsi      # 0x1b7d5
callq 0x40d0
testl %eax, %eax
jne 0x14bec
movq 0x8(%rsp), %rbx
movq (%rbx), %rsi
movq %r14, %rdi
callq 0xea48
movq %rbx, %rax
jmp 0x14be5
movq 0x10(%rsp), %rbx
movq (%rbx), %rsi
movq %r14, %rdi
callq 0xea48
movq %rbx, %rax
movq (%rsp), %rcx
movq %rcx, (%rax)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x40d0
testl %eax, %eax
jne 0x14aeb
movq %r13, %rdi
leaq 0x6bcc(%rip), %rsi      # 0x1b7d5
callq 0x40d0
testl %eax, %eax
jne 0x14aeb
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x14c50
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x14c50
testq %rsi, %rsi
je 0x14c44
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
jmp 0x14c4d
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 0x14c7e
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %rbx, %rdi
callq 0x4430