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

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0xa1ba(%rip), %r15      # 0xdfd0
leaq 0x5464(%rip), %rsi      # 0x9281
movq %r15, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x2110
leaq 0x5460(%rip), %rsi      # 0x9294
movq %r15, %rdi
callq 0x21c0
movq %rax, %rdi
movq %r14, -0x30(%rbp)
movq %r14, %rsi
callq 0x21b0
movq %rax, %rdi
callq 0x2110
movq 0x80(%rbx), %r15
leaq -0x70(%rbp), %r13
leaq -0x50(%rbp), %r14
cmpq 0x88(%rbx), %r15
jae 0x4193
movq %r13, %rdi
movq %r15, %rsi
callq 0x4992
movq 0xa14f(%rip), %rdi      # 0xdfd0
movq %r13, %rsi
callq 0x21b0
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x49aa
movq %r12, %rdi
movq %r14, %rsi
callq 0x21b0
movq %rax, %rdi
callq 0x2110
movq %r14, %rdi
callq 0x2100
movq %r13, %rdi
callq 0x2100
movzbl 0x98(%rbx), %esi
movq 0xa108(%rip), %rdi      # 0xdfd0
callq 0x22d0
movzbl 0x99(%rbx), %esi
movq %rax, %rdi
callq 0x22d0
movq %rax, %rdi
callq 0x2110
movq %r13, %rdi
movq %r15, %rsi
callq 0x4992
movq %r13, %rdi
movq -0x30(%rbp), %rsi
callq 0x4753
movl %eax, %r12d
movq %r13, %rdi
callq 0x2100
testb %r12b, %r12b
je 0x40e9
movq %r13, %rdi
movq %r15, %rsi
callq 0x49aa
movq %r13, %rdi
leaq 0x537f(%rip), %rsi      # 0x92a3
callq 0x2e13
testb %al, %al
je 0x3f46
movb 0x99(%rbx), %r12b
movq %r13, %rdi
callq 0x2100
testb %r12b, %r12b
jne 0x3f4e
jmp 0x40f2
movq %r13, %rdi
callq 0x2100
movq %r13, %rdi
movq %r15, %rsi
callq 0x49aa
movq %r13, %rdi
leaq 0x534b(%rip), %rsi      # 0x92ae
callq 0x2e13
testb %al, %al
je 0x3f85
movb 0x98(%rbx), %r12b
movq %r13, %rdi
callq 0x2100
testb %r12b, %r12b
jne 0x3f8d
jmp 0x40fb
movq %r13, %rdi
callq 0x2100
movq %r13, %rdi
movq %r15, %rsi
callq 0x49aa
movq %r13, %rdi
leaq 0x5316(%rip), %rsi      # 0x92b8
callq 0x2e13
testb %al, %al
je 0x3fcd
cmpb $0x0, 0x98(%rbx)
jne 0x3fcd
movb 0x99(%rbx), %r12b
movq %r13, %rdi
callq 0x2100
testb %r12b, %r12b
jne 0x3fd5
jmp 0x4104
movq %r13, %rdi
callq 0x2100
movq %r13, %rdi
movq %r15, %rsi
callq 0x49aa
movq %r13, %rdi
leaq 0x52d8(%rip), %rsi      # 0x92c2
callq 0x2e13
testb %al, %al
je 0x400c
movb 0x9a(%rbx), %r12b
movq %r13, %rdi
callq 0x2100
testb %r12b, %r12b
jne 0x4014
jmp 0x410f
movq %r13, %rdi
callq 0x2100
movq %r13, %rdi
movq %r15, %rsi
callq 0x49aa
movq %r13, %rdi
leaq 0x52a0(%rip), %rsi      # 0x92c9
callq 0x2e13
testb %al, %al
je 0x404b
movb 0x9b(%rbx), %r12b
movq %r13, %rdi
callq 0x2100
testb %r12b, %r12b
jne 0x4053
jmp 0x4118
movq %r13, %rdi
callq 0x2100
movq %r13, %rdi
movq %r15, %rsi
callq 0x49aa
movq %r13, %rdi
leaq 0x526d(%rip), %rsi      # 0x92d5
callq 0x2e13
testb %al, %al
je 0x408a
movb 0x9c(%rbx), %r12b
movq %r13, %rdi
callq 0x2100
testb %r12b, %r12b
jne 0x4092
jmp 0x4121
movq %r13, %rdi
callq 0x2100
movq %r13, %rdi
movq %r15, %rsi
callq 0x49aa
movq %r13, %rdi
leaq 0x5237(%rip), %rsi      # 0x92de
callq 0x2e13
testb %al, %al
je 0x40c6
movb 0x9d(%rbx), %r12b
movq %r13, %rdi
callq 0x2100
testb %r12b, %r12b
jne 0x40ce
jmp 0x412a
movq %r13, %rdi
callq 0x2100
movq 0x9efb(%rip), %rdi      # 0xdfd0
leaq 0x5208(%rip), %rsi      # 0x92e4
callq 0x21c0
movq %rax, %rdi
callq 0x2110
addq $0x58, %r15
jmp 0x3e62
movb $0x1, 0x99(%rbx)
jmp 0x4131
movb $0x1, 0x98(%rbx)
jmp 0x4131
movw $0x101, 0x98(%rbx)      # imm = 0x101
jmp 0x4131
movb $0x1, 0x9a(%rbx)
jmp 0x4131
movb $0x1, 0x9b(%rbx)
jmp 0x4131
movb $0x1, 0x9c(%rbx)
jmp 0x4131
movb $0x1, 0x9d(%rbx)
movq 0x9e98(%rip), %r14      # 0xdfd0
leaq 0x51a5(%rip), %rsi      # 0x92e4
movq %r14, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x2110
movq %r14, %rdi
movq -0x30(%rbp), %rsi
callq 0x21b0
leaq 0x5195(%rip), %rsi      # 0x92f7
movq %rax, %rdi
callq 0x21c0
movq %r15, %rdi
callq 0x49d0
addl %eax, 0x2c(%rbx)
movq %r15, %rdi
callq 0x49c6
addl %eax, 0x30(%rbx)
movq %r15, %rdi
callq 0x49da
addl %eax, 0x34(%rbx)
movq %r15, %rdi
callq 0x4b7a
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x41a4
movq %rax, %rbx
jmp 0x41b5
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x2100
leaq -0x70(%rbp), %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x2300