// File: /workspace/github_cpp_makefile_star2_O1/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, %r15
movq %rdi, %r13
leaq 0x6e74(%rip), %rsi      # 0xb208
movq %r15, %rdi
callq 0x20c0
testl %eax, %eax
je 0x43ca
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
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x43f3
sqrtsd %xmm0, %xmm0
jmp 0x43f8
movq 0xabff(%rip), %rdi      # 0xefd0
leaq 0x6e36(%rip), %rsi      # 0xb20e
movl $0x1b, %edx
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2240
callq 0x21a0
cvttsd2si %xmm0, %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
cmpl $0x1, %ecx
ja 0x45f3
movq %r13, -0x30(%rbp)
movq 0x80(%rbx), %r12
cmpq 0x88(%rbx), %r12
jae 0x45c9
leaq 0x80(%rbx), %rax
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rax
addq $0x80, %rax
movq %rax, -0x68(%rbp)
movq %r12, %r13
movq %r15, -0x60(%rbp)
movq %rbx, -0x70(%rbp)
leaq -0x50(%rbp), %rdi
movq %r12, %rsi
callq 0x5abe
movq 0x8(%r15), %rdx
cmpq -0x48(%rbp), %rdx
jne 0x4477
testq %rdx, %rdx
je 0x447c
movq -0x50(%rbp), %rsi
movq (%r15), %rdi
callq 0x2220
testl %eax, %eax
sete %r14b
jmp 0x447f
xorl %r14d, %r14d
jmp 0x447f
movb $0x1, %r14b
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x4498
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r14b, %r14b
leaq -0x80(%rbp), %r14
je 0x45b4
movq %r12, %rdi
callq 0x5d50
movq %r14, -0x90(%rbp)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0x90(%rbp), %rbx
movq %rbx, %rdi
callq 0x344a
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
callq 0x4738
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
leaq -0xe8(%rbp), %r15
je 0x44f8
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2210
leaq -0xd8(%rbp), %r14
movq %r14, -0xe8(%rbp)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x344a
leaq -0xb8(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq 0x20(%r12), %rsi
movq 0x28(%r12), %rdx
addq %rsi, %rdx
leaq -0xc8(%rbp), %rdi
callq 0x344a
movq -0x70(%rbp), %rbx
movq 0x4d(%r12), %rax
movq %rax, 0x3d(%r14)
movupd 0x40(%r12), %xmm0
movupd %xmm0, 0x30(%r14)
movq -0x68(%rbp), %rdi
movq %r15, %rsi
callq 0x9486
movq -0x60(%rbp), %r15
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x458d
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xe8(%rbp), %rdi
cmpq %r14, %rdi
je 0x45a8
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x58(%rbp), %rdi
movq %r13, %rsi
callq 0x594a
addq $0x58, %r12
addq $0x58, %r13
cmpq 0x88(%rbx), %r12
jb 0x4448
movq 0xaa00(%rip), %rbx      # 0xefd0
leaq 0x6c53(%rip), %rsi      # 0xb22a
movl $0xc, %edx
movq %rbx, %rdi
callq 0x2240
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %rbx, %rdi
jmp 0x46c2
movq 0xa9d6(%rip), %r15      # 0xefd0
leaq 0x6c36(%rip), %rsi      # 0xb237
movl $0xb, %edx
movq %r15, %rdi
callq 0x2240
leaq -0x40(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x50(%rbp), %r12
movq %r12, %rdi
callq 0x344a
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %r15, %rdi
callq 0x2240
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x4652
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2210
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
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x467f
sqrtsd %xmm0, %xmm0
jmp 0x4684
callq 0x21a0
cvttsd2si %xmm0, %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
cmpl $0x2, %ecx
jb 0x46c7
cmpl $0x0, 0x20(%rbx)
jle 0x46af
movq 0xa92f(%rip), %rdi      # 0xefd0
leaq 0x6b9b(%rip), %rsi      # 0xb243
movl $0x31, %edx
jmp 0x46c2
movq 0xa91a(%rip), %rdi      # 0xefd0
leaq 0x6bb8(%rip), %rsi      # 0xb275
movl $0xb, %edx
callq 0x2240
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x472f
movq -0x40(%rbp), %rsi
jmp 0x4716
movq %rax, %rbx
movq -0xe8(%rbp), %rdi
cmpq %r14, %rdi
je 0x472f
movq -0xd8(%rbp), %rsi
jmp 0x4716
movq %rax, %rbx
movq -0x90(%rbp), %rdi
cmpq %r14, %rdi
je 0x472f
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x472f
movq %rax, %rbx
leaq -0xe8(%rbp), %rdi
callq 0x5872
movq %rbx, %rdi
callq 0x2320
nop