// File: /workspace/github_cpp_makefile_star2_O1/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 0x80(%rdi), %rbx
cmpq 0x88(%rdi), %rbx
jae 0x4b54
movq %rsi, %r15
movq %rdi, %r14
movl $0x0, -0x4c(%rbp)
leaq -0x48(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5abe
movq -0x40(%rbp), %rdx
cmpq 0x8(%r15), %rdx
jne 0x479c
testq %rdx, %rdx
je 0x47a1
movq (%r15), %rsi
movq -0x48(%rbp), %rdi
callq 0x2220
testl %eax, %eax
sete %r13b
jmp 0x47a4
xorl %r13d, %r13d
jmp 0x47a4
movb $0x1, %r13b
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x47bd
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r13b, %r13b
je 0x4aee
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5aea
movq %r12, %rdi
leaq 0x6ac8(%rip), %rsi      # 0xb2a3
callq 0x20c0
testl %eax, %eax
je 0x47ff
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4831
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x4831
movb 0x99(%r14), %r13b
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x481f
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r13b, %r13b
je 0x4831
movb $0x0, 0x99(%r14)
jmp 0x4abb
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5aea
movq %r12, %rdi
leaq 0x6a68(%rip), %rsi      # 0xb2ae
callq 0x20c0
testl %eax, %eax
je 0x486a
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x489c
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x489c
movb 0x98(%r14), %r13b
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x488a
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r13b, %r13b
je 0x489c
movb $0x0, 0x98(%r14)
jmp 0x4abb
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5aea
movq %r12, %rdi
leaq 0x6a07(%rip), %rsi      # 0xb2b8
callq 0x20c0
testl %eax, %eax
jne 0x48f8
cmpb $0x1, 0x99(%r14)
jne 0x48f8
movb 0x98(%r14), %r13b
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x48e4
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r13b, %r13b
je 0x4911
movw $0x0, 0x98(%r14)
jmp 0x4abb
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4911
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5aea
movq %r12, %rdi
leaq 0x699c(%rip), %rsi      # 0xb2c2
callq 0x20c0
testl %eax, %eax
je 0x494a
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x497c
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x497c
movb 0x9a(%r14), %r13b
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x496a
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r13b, %r13b
je 0x497c
movb $0x0, 0x9a(%r14)
jmp 0x4abb
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5aea
movq %r12, %rdi
leaq 0x6938(%rip), %rsi      # 0xb2c9
callq 0x20c0
testl %eax, %eax
je 0x49b5
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x49e7
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x49e7
movb 0x9b(%r14), %r13b
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x49d5
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r13b, %r13b
je 0x49e7
movb $0x0, 0x9b(%r14)
jmp 0x4abb
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5aea
movq %r12, %rdi
leaq 0x68d9(%rip), %rsi      # 0xb2d5
callq 0x20c0
testl %eax, %eax
je 0x4a20
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4a4f
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x4a4f
movb 0x9c(%r14), %r13b
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4a40
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r13b, %r13b
je 0x4a4f
movb $0x0, 0x9c(%r14)
jmp 0x4abb
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5aea
movq %r12, %rdi
leaq 0x687a(%rip), %rsi      # 0xb2de
callq 0x20c0
testl %eax, %eax
je 0x4a8b
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4a86
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
movl -0x4c(%rbp), %eax
jmp 0x4abd
movb 0x9d(%r14), %r13b
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4aab
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r13b, %r13b
movl -0x4c(%rbp), %eax
je 0x4abd
movb $0x0, 0x9d(%r14)
movb $0x1, %al
testb $0x1, %al
jne 0x4b01
movl %eax, -0x4c(%rbp)
movl $0x13, %edx
movq 0xa500(%rip), %r13      # 0xefd0
movq %r13, %rdi
leaq 0x6834(%rip), %rsi      # 0xb30e
callq 0x2240
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r13, %rdi
callq 0x2240
addq $0x58, %rbx
cmpq 0x88(%r14), %rbx
jb 0x476e
jmp 0x4b54
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq 0xa4c1(%rip), %rdi      # 0xefd0
callq 0x2240
leaq 0x67e6(%rip), %rsi      # 0xb301
movl $0xc, %edx
movq %rax, %rdi
callq 0x2240
movq %rbx, %rdi
callq 0x5b22
subl %eax, 0x2c(%r14)
movq %rbx, %rdi
callq 0x5b18
subl %eax, 0x30(%r14)
movq %rbx, %rdi
callq 0x5b2c
subl %eax, 0x34(%r14)
movq %rbx, %rdi
callq 0x5d50
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop