// File: /workspace/github_cpp_makefile_star2_O3/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, -0x50(%rbp)
movq 0x80(%rdi), %rbx
cmpq 0x88(%rdi), %rbx
jae 0x4b35
movq %rdi, %r14
leaq -0x38(%rbp), %r13
movq %r14, %r12
movq %r13, %r14
leaq -0x48(%rbp), %rdi
movq %rbx, %rsi
callq 0x5ad6
movq -0x40(%rbp), %rdx
movq -0x50(%rbp), %rax
cmpq 0x8(%rax), %rdx
jne 0x47a6
movq -0x48(%rbp), %r13
testq %rdx, %rdx
je 0x47af
movq -0x50(%rbp), %rax
movq (%rax), %rsi
movq %r13, %rdi
callq 0x2210
testl %eax, %eax
sete %r15b
jmp 0x47b2
movq -0x48(%rbp), %r13
xorl %r15d, %r15d
jmp 0x47b2
movb $0x1, %r15b
cmpq %r14, %r13
je 0x47c6
movq -0x38(%rbp), %rsi
incq %rsi
movq %r13, %rdi
callq 0x2200
testb %r15b, %r15b
movq %r14, %r13
movq %r12, %r14
je 0x4a82
leaq -0x48(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5b02
movq %r12, %rdi
leaq 0x6ab5(%rip), %rsi      # 0xb2a3
callq 0x20c0
testl %eax, %eax
je 0x480e
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x4833
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2200
jmp 0x4833
movb 0x99(%r14), %r15b
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x482a
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2200
testb %r15b, %r15b
jne 0x4a98
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5b02
movq %r12, %rdi
leaq 0x6a66(%rip), %rsi      # 0xb2ae
callq 0x20c0
testl %eax, %eax
je 0x4868
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x488d
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2200
jmp 0x488d
movb 0x98(%r14), %r15b
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x4884
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2200
testb %r15b, %r15b
jne 0x4aa2
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5b02
movq %r12, %rdi
leaq 0x6a16(%rip), %rsi      # 0xb2b8
callq 0x20c0
testl %eax, %eax
jne 0x48db
cmpb $0x1, 0x99(%r14)
jne 0x48db
movb 0x98(%r14), %r15b
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x48d1
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2200
testb %r15b, %r15b
je 0x48f0
jmp 0x4ad4
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x48f0
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2200
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5b02
movq %r12, %rdi
leaq 0x69bd(%rip), %rsi      # 0xb2c2
callq 0x20c0
testl %eax, %eax
je 0x4925
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x494a
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2200
jmp 0x494a
movb 0x9a(%r14), %r15b
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x4941
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2200
testb %r15b, %r15b
jne 0x4aac
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5b02
movq %r12, %rdi
leaq 0x696a(%rip), %rsi      # 0xb2c9
callq 0x20c0
testl %eax, %eax
je 0x497f
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x49a4
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2200
jmp 0x49a4
movb 0x9b(%r14), %r15b
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x499b
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2200
testb %r15b, %r15b
jne 0x4ab6
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5b02
movq %r12, %rdi
leaq 0x691c(%rip), %rsi      # 0xb2d5
callq 0x20c0
testl %eax, %eax
je 0x49d9
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x49fe
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2200
jmp 0x49fe
movb 0x9c(%r14), %r15b
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x49f5
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2200
testb %r15b, %r15b
jne 0x4ac0
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5b02
movq %r12, %rdi
leaq 0x68cb(%rip), %rsi      # 0xb2de
callq 0x20c0
testl %eax, %eax
je 0x4a33
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x4a54
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2200
jmp 0x4a54
movb 0x9d(%r14), %r15b
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x4a4f
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2200
testb %r15b, %r15b
jne 0x4aca
movl $0x13, %edx
movq 0xa570(%rip), %r15      # 0xefd0
movq %r15, %rdi
leaq 0x68a4(%rip), %rsi      # 0xb30e
callq 0x2230
movq -0x50(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r15, %rdi
callq 0x2230
addq $0x58, %rbx
cmpq 0x88(%r14), %rbx
jb 0x4766
jmp 0x4b35
movb $0x0, 0x99(%r14)
jmp 0x4ade
movb $0x0, 0x98(%r14)
jmp 0x4ade
movb $0x0, 0x9a(%r14)
jmp 0x4ade
movb $0x0, 0x9b(%r14)
jmp 0x4ade
movb $0x0, 0x9c(%r14)
jmp 0x4ade
movb $0x0, 0x9d(%r14)
jmp 0x4ade
movw $0x0, 0x98(%r14)
movq -0x50(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq 0xa4e0(%rip), %rdi      # 0xefd0
callq 0x2230
leaq 0x6805(%rip), %rsi      # 0xb301
movl $0xc, %edx
movq %rax, %rdi
callq 0x2230
movq %rbx, %rdi
callq 0x5b3a
subl %eax, 0x2c(%r14)
movq %rbx, %rdi
callq 0x5b30
subl %eax, 0x30(%r14)
movq %rbx, %rdi
callq 0x5b44
subl %eax, 0x34(%r14)
movq %rbx, %rdi
callq 0x5d68
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq