// File: hobbitsyfeet[P]Turn/unit.cc
// Function: Unit::lootUnit(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, Unit&)
void Unit::lootUnit(string iName,Unit& target){
  if(iName == "Fists"){
    cout<<"You cannot yet remove hands";
    return;
  }
  if(distanceTo(target.getPosX(),target.getPosY() ) <= 1){
  vector<Item>::iterator it;
  for(it=target.inv.invContainer.begin();it<target.inv.invContainer.end();it++){
      if(iName == it->itemGetName()){
       it->itemUnequip();
			 this->unEquipItem(iName);
			 inv.pickUp(*it);
       target.inv.invContainer.erase(it);
      }
    }
    cout<<"You grabbed "<<iName;
  }
  else{
    cout<<"Cannot loot"<<target.getName();
    if(distanceTo(target.getPosX(),target.getPosY() ) > 1 ){
      if(target.getHealth() > 0)
        cout<<" is still alive, cannot grab his things just yet!";
      else
        cout<<" is too far";
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rsi, -0x128(%rbp)
movq %rdi, %rax
movq -0x128(%rbp), %rdi
movq %rdi, -0x120(%rbp)
movq %rax, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x118(%rbp)
leaq 0xc2e3(%rip), %rsi      # 0x121d4
callq 0x4880
testb $0x1, %al
jne 0x5efc
jmp 0x5f14
movq 0x130cd(%rip), %rdi     # 0x18fd0
leaq 0xc2d0(%rip), %rsi      # 0x121da
callq 0x3280
jmp 0x61fe
movq -0x18(%rbp), %rdi
callq 0x5260
movl %eax, -0x12c(%rbp)
movq -0x18(%rbp), %rdi
callq 0x5240
movq -0x118(%rbp), %rdi
movl -0x12c(%rbp), %esi
movl %eax, %edx
callq 0x5c70
cmpl $0x1, %eax
jg 0x6127
leaq -0x20(%rbp), %rdi
callq 0x7aa0
movq -0x18(%rbp), %rdi
addq $0x80, %rdi
callq 0x7ac0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
addq $0x80, %rdi
callq 0x7b30
movq %rax, -0x30(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x7af0
testb $0x1, %al
jne 0x5f98
jmp 0x6100
leaq -0x20(%rbp), %rdi
callq 0x7bf0
movq %rax, %rsi
leaq -0x50(%rbp), %rdi
callq 0x8770
movq -0x120(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x7b60
movb %al, -0x12d(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x31c0
movb -0x12d(%rbp), %al
testb $0x1, %al
jne 0x5fdb
jmp 0x60e7
leaq -0x20(%rbp), %rdi
callq 0x7bf0
movq %rax, %rdi
callq 0x8a80
movq -0x120(%rbp), %rsi
leaq -0x70(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x3140
movq -0x118(%rbp), %rdi
movq -0x138(%rbp), %rsi
callq 0x6210
jmp 0x6018
leaq -0x70(%rbp), %rdi
callq 0x31c0
movq -0x118(%rbp), %rax
subq $-0x80, %rax
movq %rax, -0x148(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x7c10
movq %rax, %rsi
leaq -0xd8(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0x7c30
movq -0x148(%rbp), %rdi
movq -0x140(%rbp), %rsi
callq 0xfc10
jmp 0x6067
leaq -0xd8(%rbp), %rdi
callq 0x4b00
movq -0x18(%rbp), %rax
addq $0x80, %rax
movq %rax, -0x150(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x7d30
movq -0x150(%rbp), %rdi
movq -0xe0(%rbp), %rsi
callq 0x7cc0
movq %rax, -0xe8(%rbp)
jmp 0x60e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x31c0
jmp 0x6207
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x4b00
jmp 0x6207
jmp 0x60e9
leaq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x7d70
movq %rax, -0xf0(%rbp)
jmp 0x5f6e
movq 0x12ec9(%rip), %rdi     # 0x18fd0
leaq 0xc0e8(%rip), %rsi      # 0x121f6
callq 0x3280
movq -0x120(%rbp), %rsi
movq %rax, %rdi
callq 0x3270
jmp 0x61fe
movq 0x12ea2(%rip), %rdi     # 0x18fd0
leaq 0xc0ce(%rip), %rsi      # 0x12203
callq 0x3280
movq %rax, -0x160(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x110(%rbp), %rdi
movq %rdi, -0x158(%rbp)
callq 0x50d0
movq -0x160(%rbp), %rdi
movq -0x158(%rbp), %rsi
callq 0x3270
jmp 0x616d
leaq -0x110(%rbp), %rdi
callq 0x31c0
movq -0x18(%rbp), %rdi
callq 0x5260
movl %eax, -0x164(%rbp)
movq -0x18(%rbp), %rdi
callq 0x5240
movq -0x118(%rbp), %rdi
movl -0x164(%rbp), %esi
movl %eax, %edx
callq 0x5c70
cmpl $0x1, %eax
jle 0x61fc
movq -0x18(%rbp), %rdi
callq 0x5140
cmpl $0x0, %eax
jle 0x61e7
movq 0x12e11(%rip), %rdi     # 0x18fd0
leaq 0xc049(%rip), %rsi      # 0x1220f
callq 0x3280
jmp 0x61fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x31c0
jmp 0x6207
movq 0x12de2(%rip), %rdi     # 0x18fd0
leaq 0xc04c(%rip), %rsi      # 0x12241
callq 0x3280
jmp 0x61fc
jmp 0x61fe
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x3440