// File: 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
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2c3b0
andb $0x1, %al
movb %al, -0x11(%rbp)
testb $0x1, -0x11(%rbp)
je 0x24240
movq -0x50(%rbp), %rdi
callq 0x25570
testb $0x1, %al
jne 0x241ee
jmp 0x24205
movq -0x50(%rbp), %rax
movq %rax, %rdi
addq $0xc0, %rdi
movq 0x48(%rax), %rsi
callq 0x17050
movq -0x50(%rbp), %rdi
callq 0x25590
testb $0x1, %al
jne 0x24214
jmp 0x2422b
movq -0x50(%rbp), %rax
movq %rax, %rdi
addq $0xc0, %rdi
movq 0x50(%rax), %rsi
callq 0x17050
movq -0x50(%rbp), %rax
movq -0x10(%rbp), %rcx
movq %rcx, 0x50(%rax)
movq %rcx, 0x48(%rax)
jmp 0x24404
movq -0x50(%rbp), %rdi
callq 0x25830
testb $0x1, %al
jne 0x24252
jmp 0x243d7
leaq -0x38(%rbp), %rdi
callq 0x5460
movq 0x1bd5e(%rip), %rdi     # 0x3ffc0
leaq 0xae28(%rip), %rsi      # 0x2f091
callq 0x52f0
movq %rax, -0x58(%rbp)
jmp 0x24274
movq -0x58(%rbp), %rdi
leaq 0xae44(%rip), %rsi      # 0x2f0c3
callq 0x52f0
movq %rax, -0x60(%rbp)
jmp 0x2428a
movq -0x60(%rbp), %rdi
movq 0x1bd0b(%rip), %rsi     # 0x3ffa0
callq 0x5330
movq %rax, -0x68(%rbp)
jmp 0x242a0
movq -0x68(%rbp), %rdi
movq 0x1bcf5(%rip), %rsi     # 0x3ffa0
callq 0x5330
movq %rax, -0x70(%rbp)
jmp 0x242b6
movq -0x70(%rbp), %rdi
leaq 0xae25(%rip), %rsi      # 0x2f0e6
callq 0x52f0
jmp 0x242c8
movq 0x1bd09(%rip), %rdi     # 0x3ffd8
leaq -0x38(%rbp), %rsi
callq 0x5070
jmp 0x242da
leaq 0xa4cf(%rip), %rsi      # 0x2e7b0
leaq -0x38(%rbp), %rdi
callq 0x8e10
movb %al, -0x71(%rbp)
jmp 0x242ef
movb -0x71(%rbp), %al
testb $0x1, %al
jne 0x242f8
jmp 0x24339
movq -0x50(%rbp), %rax
movq %rax, %rdi
addq $0xc0, %rdi
movq 0x48(%rax), %rsi
callq 0x17050
jmp 0x24311
movq -0x50(%rbp), %rax
movq -0x10(%rbp), %rcx
movq %rcx, 0x48(%rax)
jmp 0x2437e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x55d0
jmp 0x2440d
leaq 0xa475(%rip), %rsi      # 0x2e7b5
leaq -0x38(%rbp), %rdi
callq 0x8e10
movb %al, -0x72(%rbp)
jmp 0x2434e
movb -0x72(%rbp), %al
testb $0x1, %al
jne 0x24357
jmp 0x2437c
movq -0x50(%rbp), %rax
movq %rax, %rdi
addq $0xc0, %rdi
movq 0x50(%rax), %rsi
callq 0x17050
jmp 0x24370
movq -0x50(%rbp), %rax
movq -0x10(%rbp), %rcx
movq %rcx, 0x50(%rax)
jmp 0x2437e
jmp 0x24380
leaq 0xa429(%rip), %rsi      # 0x2e7b0
leaq -0x38(%rbp), %rdi
callq 0x7f10
movb %al, -0x73(%rbp)
jmp 0x24395
movb -0x73(%rbp), %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x74(%rbp)
jne 0x243c1
jmp 0x243a4
leaq 0xa40a(%rip), %rsi      # 0x2e7b5
leaq -0x38(%rbp), %rdi
callq 0x7f10
movb %al, -0x75(%rbp)
jmp 0x243b9
movb -0x75(%rbp), %al
movb %al, -0x74(%rbp)
jmp 0x243c1
movb -0x74(%rbp), %al
testb $0x1, %al
jne 0x2425b
leaq -0x38(%rbp), %rdi
callq 0x55d0
jmp 0x24402
movq -0x50(%rbp), %rdi
callq 0x25570
testb $0x1, %al
jne 0x243e6
jmp 0x243f4
movq -0x50(%rbp), %rax
movq -0x10(%rbp), %rcx
movq %rcx, 0x50(%rax)
jmp 0x24400
movq -0x50(%rbp), %rax
movq -0x10(%rbp), %rcx
movq %rcx, 0x48(%rax)
jmp 0x24402
jmp 0x24404
addq $0x80, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x5550
nopw %cs:(%rax,%rax)