// File: /workspace/github_cpp_makefile_star2_O1/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 0xa410(%rip), %r15      # 0xefd0
leaq 0x66ba(%rip), %rsi      # 0xb281
movl $0x12, %edx
movq %r15, %rdi
callq 0x2240
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %r15, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
leaq 0x6692(%rip), %rsi      # 0xb294
movl $0xe, %edx
movq %r15, %rdi
callq 0x2240
movq (%r14), %rsi
movq %r14, -0x50(%rbp)
movq 0x8(%r14), %rdx
movq %r15, %rdi
callq 0x2240
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
movq 0x80(%rbx), %r12
cmpq 0x88(%rbx), %r12
jae 0x514e
xorl %r15d, %r15d
leaq -0x48(%rbp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x5abe
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq 0xa34f(%rip), %rdi      # 0xefd0
callq 0x2240
movq %rax, %r14
leaq -0x70(%rbp), %rdi
movq %r12, %rsi
callq 0x5aea
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq %r14, %rdi
callq 0x2240
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x4ce8
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4d01
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
movzbl 0x98(%rbx), %esi
movq 0xa2c1(%rip), %rdi      # 0xefd0
callq 0x22f0
movzbl 0x99(%rbx), %esi
movq %rax, %rdi
callq 0x22f0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
movq %r13, %rdi
movq %r12, %rsi
callq 0x5abe
movq -0x40(%rbp), %rdx
movq -0x50(%rbp), %rax
cmpq 0x8(%rax), %rdx
jne 0x4d83
testq %rdx, %rdx
je 0x4d88
movq -0x50(%rbp), %rax
movq (%rax), %rsi
movq -0x48(%rbp), %rdi
callq 0x2220
testl %eax, %eax
sete %r14b
jmp 0x4d8b
xorl %r14d, %r14d
jmp 0x4d8b
movb $0x1, %r14b
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4da4
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r14b, %r14b
je 0x50e7
movq %r13, %rdi
movq %r12, %rsi
callq 0x5aea
movq %r13, %rdi
leaq 0x64e1(%rip), %rsi      # 0xb2a3
callq 0x20c0
testl %eax, %eax
je 0x4de6
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4e0f
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x4e0f
movb 0x99(%rbx), %r14b
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4e06
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r14b, %r14b
je 0x5071
movq %r13, %rdi
movq %r12, %rsi
callq 0x5aea
movq %r13, %rdi
leaq 0x648a(%rip), %rsi      # 0xb2ae
callq 0x20c0
testl %eax, %eax
je 0x4e48
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4e71
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x4e71
movb 0x98(%rbx), %r14b
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4e68
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r14b, %r14b
je 0x507a
movq %r13, %rdi
movq %r12, %rsi
callq 0x5aea
movq %r13, %rdi
leaq 0x6432(%rip), %rsi      # 0xb2b8
callq 0x20c0
testl %eax, %eax
jne 0x4ecb
cmpb $0x0, 0x98(%rbx)
jne 0x4ecb
movb 0x99(%rbx), %r14b
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4eb8
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r14b, %r14b
jne 0x4ee4
movw $0x101, 0x98(%rbx)      # imm = 0x101
jmp 0x509c
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4ee4
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
movq %r13, %rdi
movq %r12, %rsi
callq 0x5aea
movq %r13, %rdi
leaq 0x63c9(%rip), %rsi      # 0xb2c2
callq 0x20c0
testl %eax, %eax
je 0x4f1d
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4f46
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x4f46
movb 0x9a(%rbx), %r14b
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4f3d
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r14b, %r14b
je 0x5083
movq %r13, %rdi
movq %r12, %rsi
callq 0x5aea
movq %r13, %rdi
leaq 0x636e(%rip), %rsi      # 0xb2c9
callq 0x20c0
testl %eax, %eax
je 0x4f7f
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4fa8
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x4fa8
movb 0x9b(%rbx), %r14b
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4f9f
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r14b, %r14b
je 0x508c
movq %r13, %rdi
movq %r12, %rsi
callq 0x5aea
movq %r13, %rdi
leaq 0x6318(%rip), %rsi      # 0xb2d5
callq 0x20c0
testl %eax, %eax
je 0x4fe1
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x500a
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x500a
movb 0x9c(%rbx), %r14b
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x5001
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r14b, %r14b
je 0x5095
movq %r13, %rdi
movq %r12, %rsi
callq 0x5aea
movq %r13, %rdi
leaq 0x62bf(%rip), %rsi      # 0xb2de
callq 0x20c0
testl %eax, %eax
je 0x5043
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x509f
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x509f
movb 0x9d(%rbx), %r14b
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x5063
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r14b, %r14b
jne 0x509f
movb $0x1, 0x9d(%rbx)
jmp 0x509c
movb $0x1, 0x99(%rbx)
jmp 0x509c
movb $0x1, 0x98(%rbx)
jmp 0x509c
movb $0x1, 0x9a(%rbx)
jmp 0x509c
movb $0x1, 0x9b(%rbx)
jmp 0x509c
movb $0x1, 0x9c(%rbx)
movb $0x1, %r15b
movl $0x12, %edx
movq 0x9f25(%rip), %r14      # 0xefd0
movq %r14, %rdi
leaq 0x622f(%rip), %rsi      # 0xb2e4
callq 0x2240
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21f0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
testb $0x1, %r15b
jne 0x50fa
addq $0x58, %r12
cmpq 0x88(%rbx), %r12
jb 0x4c67
jmp 0x514e
movq -0x50(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq 0x9ec4(%rip), %rdi      # 0xefd0
callq 0x2240
leaq 0x61df(%rip), %rsi      # 0xb2f7
movl $0x9, %edx
movq %rax, %rdi
callq 0x2240
movq %r12, %rdi
callq 0x5b22
addl %eax, 0x2c(%rbx)
movq %r12, %rdi
callq 0x5b18
addl %eax, 0x30(%rbx)
movq %r12, %rdi
callq 0x5b2c
addl %eax, 0x34(%rbx)
movq %r12, %rdi
callq 0x5d46
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x515f
movq %rax, %rbx
jmp 0x5180
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x5180
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x5199
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2320
nop