// File: /workspace/github_cpp_makefile_star2_O2/hobbitsyfeet[P]Turn/unit.cc
// Function: Unit::unEquipItem(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Unit::unEquipItem(string i){
  vector<Item>::iterator it;
  bool didEquip = false;
  for(it=inv.invContainer.begin(); it< inv.invContainer.end(); it++){
    if(it->itemGetName() == i){
      if(it->itemGetType() == "Right-Hand" && rightHandEquipped == true){
	rightHandEquipped = false;
	didEquip = true;
      }
      else if(it->itemGetType() == "Left-Hand" && leftHandEquipped == true){
	leftHandEquipped = false;
	didEquip = true;
      }
      else if(it->itemGetType() == "Two-Hands" && rightHandEquipped == true && leftHandEquipped == true){
	rightHandEquipped = false;
	leftHandEquipped = false;
	didEquip = true;
      }
      else if(it->itemGetType() == "Helmet" && headEquipped == true){
	headEquipped = false;
	didEquip = true;
      }
      else if(it->itemGetType() == "Body-Armour" && torsoEquipped == true){
	torsoEquipped = false;
	didEquip = true;
      }
      else if(it->itemGetType() == "Leggings" && legsEquipped == true){
	legsEquipped = false;
	didEquip = true;
      }
      else if(it->itemGetType() == "Boots" && feetEquipped == true){
	feetEquipped = false;
	didEquip = true;
      }
      if(didEquip == true){
	cout<<i<<" un-equipped";
	attack -= it->itemGetDamage();
  range -= it->itemGetRange();
	defence -= it->itemGetDefence();
	it->itemUnequip();
  break;
      }
      else
	cout<<"Could not un-equip "<<i;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
movq %rdi, %r14
movq 0x80(%rdi), %rbx
leaq -0x48(%rbp), %r12
cmpq 0x88(%r14), %rbx
jae 0x3db4
movq %r12, %rdi
movq %rbx, %rsi
callq 0x4992
movq %r12, %rdi
movq %r15, %rsi
callq 0x4753
movl %eax, %r13d
movq %r12, %rdi
callq 0x2100
testb %r13b, %r13b
je 0x3d1c
movq %r12, %rdi
movq %rbx, %rsi
callq 0x49aa
movq %r12, %rdi
leaq 0x5757(%rip), %rsi      # 0x92a3
callq 0x2e13
testb %al, %al
je 0x3b6f
movb 0x99(%r14), %r13b
movq %r12, %rdi
callq 0x2100
cmpb $0x1, %r13b
jne 0x3b77
jmp 0x3d25
movq %r12, %rdi
callq 0x2100
movq %r12, %rdi
movq %rbx, %rsi
callq 0x49aa
movq %r12, %rdi
leaq 0x5722(%rip), %rsi      # 0x92ae
callq 0x2e13
testb %al, %al
je 0x3baf
movb 0x98(%r14), %r13b
movq %r12, %rdi
callq 0x2100
cmpb $0x1, %r13b
jne 0x3bb7
jmp 0x3d2f
movq %r12, %rdi
callq 0x2100
movq %r12, %rdi
movq %rbx, %rsi
callq 0x49aa
movq %r12, %rdi
leaq 0x56ec(%rip), %rsi      # 0x92b8
callq 0x2e13
testb %al, %al
je 0x3bf9
cmpb $0x1, 0x99(%r14)
jne 0x3bf9
movb 0x98(%r14), %r13b
movq %r12, %rdi
callq 0x2100
cmpb $0x1, %r13b
jne 0x3c01
jmp 0x3d61
movq %r12, %rdi
callq 0x2100
movq %r12, %rdi
movq %rbx, %rsi
callq 0x49aa
movq %r12, %rdi
leaq 0x56ac(%rip), %rsi      # 0x92c2
callq 0x2e13
testb %al, %al
je 0x3c39
movb 0x9a(%r14), %r13b
movq %r12, %rdi
callq 0x2100
cmpb $0x1, %r13b
jne 0x3c41
jmp 0x3d39
movq %r12, %rdi
callq 0x2100
movq %r12, %rdi
movq %rbx, %rsi
callq 0x49aa
movq %r12, %rdi
leaq 0x5673(%rip), %rsi      # 0x92c9
callq 0x2e13
testb %al, %al
je 0x3c79
movb 0x9b(%r14), %r13b
movq %r12, %rdi
callq 0x2100
cmpb $0x1, %r13b
jne 0x3c81
jmp 0x3d43
movq %r12, %rdi
callq 0x2100
movq %r12, %rdi
movq %rbx, %rsi
callq 0x49aa
movq %r12, %rdi
leaq 0x563f(%rip), %rsi      # 0x92d5
callq 0x2e13
testb %al, %al
je 0x3cb9
movb 0x9c(%r14), %r13b
movq %r12, %rdi
callq 0x2100
cmpb $0x1, %r13b
jne 0x3cc1
jmp 0x3d4d
movq %r12, %rdi
callq 0x2100
movq %r12, %rdi
movq %rbx, %rsi
callq 0x49aa
movq %r12, %rdi
leaq 0x5608(%rip), %rsi      # 0x92de
callq 0x2e13
testb %al, %al
je 0x3cf6
movb 0x9d(%r14), %r13b
movq %r12, %rdi
callq 0x2100
cmpb $0x1, %r13b
jne 0x3cfe
jmp 0x3d57
movq %r12, %rdi
callq 0x2100
movq 0xa2cb(%rip), %rdi      # 0xdfd0
leaq 0x5602(%rip), %rsi      # 0x930e
callq 0x21c0
movq %rax, %rdi
movq %r15, %rsi
callq 0x21b0
addq $0x58, %rbx
jmp 0x3b00
movb $0x0, 0x99(%r14)
jmp 0x3d6a
movb $0x0, 0x98(%r14)
jmp 0x3d6a
movb $0x0, 0x9a(%r14)
jmp 0x3d6a
movb $0x0, 0x9b(%r14)
jmp 0x3d6a
movb $0x0, 0x9c(%r14)
jmp 0x3d6a
movb $0x0, 0x9d(%r14)
jmp 0x3d6a
andw $0x0, 0x98(%r14)
movq 0xa25f(%rip), %rdi      # 0xdfd0
movq %r15, %rsi
callq 0x21b0
leaq 0x5581(%rip), %rsi      # 0x9301
movq %rax, %rdi
callq 0x21c0
movq %rbx, %rdi
callq 0x49d0
subl %eax, 0x2c(%r14)
movq %rbx, %rdi
callq 0x49c6
subl %eax, 0x30(%r14)
movq %rbx, %rdi
callq 0x49da
subl %eax, 0x34(%r14)
movq %rbx, %rdi
callq 0x4b84
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop