// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdx, %rbx
movq %rsi, %rax
movq %rdi, %r13
leaq 0x6e74(%rip), %rsi      # 0xb208
movq %rax, -0x30(%rbp)
movq %rax, %rdi
callq 0x20c0
testl %eax, %eax
je 0x45db
movl 0x78(%rbx), %eax
subl 0x78(%r13), %eax
movl 0x7c(%rbx), %ecx
imull %eax, %eax
subl 0x7c(%r13), %ecx
imull %ecx, %ecx
addl %eax, %ecx
cvtsi2sd %ecx, %xmm0
sqrtsd %xmm0, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
cmpl $0x1, %ecx
ja 0x4604
movq %r13, -0x38(%rbp)
movq 0x80(%rbx), %r12
cmpq 0x88(%rbx), %r12
jae 0x45ad
leaq 0x80(%rbx), %rax
movq %rax, -0x68(%rbp)
leaq -0x80(%rbp), %r14
movq -0x38(%rbp), %rax
addq $0x80, %rax
movq %rax, -0x70(%rbp)
movq %r12, %r13
movq %rbx, -0x40(%rbp)
movq %r14, %r15
leaq -0x60(%rbp), %rdi
movq %r12, %rsi
callq 0x5ad6
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
cmpq -0x58(%rbp), %rdx
jne 0x4452
movq -0x60(%rbp), %r14
testq %rdx, %rdx
je 0x445a
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movq %r14, %rsi
callq 0x2210
testl %eax, %eax
sete %bl
jmp 0x445c
movq -0x60(%rbp), %r14
xorl %ebx, %ebx
jmp 0x445c
movb $0x1, %bl
leaq -0x50(%rbp), %rax
cmpq %rax, %r14
je 0x4474
movq -0x50(%rbp), %rsi
incq %rsi
movq %r14, %rdi
callq 0x2200
testb %bl, %bl
movq -0x40(%rbp), %rax
movq %r15, %r14
je 0x4598
movq %r12, %rdi
callq 0x5d68
movq %r14, -0x90(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x90(%rbp), %rbx
movq %rbx, %rdi
callq 0x347c
movq -0x38(%rbp), %rdi
movq %rbx, %rsi
callq 0x4736
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
leaq -0xe8(%rbp), %r15
je 0x44da
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2200
leaq -0xd8(%rbp), %rbx
movq %rbx, -0xe8(%rbp)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x347c
leaq -0xb8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq 0x20(%r12), %rsi
movq 0x28(%r12), %rdx
addq %rsi, %rdx
leaq -0xc8(%rbp), %rdi
callq 0x347c
movq 0x4d(%r12), %rax
movq %rax, 0x3d(%rbx)
movupd 0x40(%r12), %xmm0
movupd %xmm0, 0x30(%rbx)
movq -0x70(%rbp), %rdi
movq %r15, %rsi
callq 0x94c6
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x4566
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x2200
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x4588
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x2200
movq -0x68(%rbp), %rdi
movq %r13, %rsi
callq 0x595c
movq -0x40(%rbp), %rax
addq $0x58, %r12
addq $0x58, %r13
cmpq 0x88(%rax), %r12
jb 0x4416
movq 0xaa1c(%rip), %rbx      # 0xefd0
leaq 0x6c6f(%rip), %rsi      # 0xb22a
movl $0xc, %edx
movq %rbx, %rdi
callq 0x2230
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbx, %rdi
jmp 0x46c1
movq 0xa9ee(%rip), %rdi      # 0xefd0
leaq 0x6c25(%rip), %rsi      # 0xb20e
movl $0x1b, %edx
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2230
movq 0xa9c5(%rip), %r14      # 0xefd0
leaq 0x6c25(%rip), %rsi      # 0xb237
movl $0xb, %edx
movq %r14, %rdi
callq 0x2230
leaq -0x50(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x60(%rbp), %r15
movq %r15, %rdi
callq 0x347c
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r14, %rdi
callq 0x2230
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x4662
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x2200
movl 0x78(%rbx), %eax
subl 0x78(%r13), %eax
movl 0x7c(%rbx), %ecx
imull %eax, %eax
subl 0x7c(%r13), %ecx
imull %ecx, %ecx
addl %eax, %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
sqrtsd %xmm0, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
cmpl $0x2, %ecx
jb 0x46c6
cmpl $0x0, 0x20(%rbx)
jle 0x46ae
movq 0xa930(%rip), %rdi      # 0xefd0
leaq 0x6b9c(%rip), %rsi      # 0xb243
movl $0x31, %edx
jmp 0x46c1
movq 0xa91b(%rip), %rdi      # 0xefd0
leaq 0x6bb9(%rip), %rsi      # 0xb275
movl $0xb, %edx
callq 0x2230
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x472e
movq -0x50(%rbp), %rsi
jmp 0x4715
movq %rax, %r15
movq -0xe8(%rbp), %rdi
cmpq %rbx, %rdi
je 0x472e
movq -0xd8(%rbp), %rsi
jmp 0x4715
movq %rax, %r15
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
je 0x472e
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2200
jmp 0x472e
movq %rax, %r15
leaq -0xe8(%rbp), %rdi
callq 0x5884
movq %r15, %rdi
callq 0x2310