// File: XxAdi101xX[P]ChamberCrawler/Character/Human.cc
// Function: Human::deathRoutine()
void Human::deathRoutine() {
	vector<shared_ptr<Cell>> neighbourHood
		= (this->getCurrentCell())->getNeighbours();

	int numberOfGoldPilesAlreadyDropped = 0;


	for (auto neighbour : neighbourHood) {
		// if there is no item or character on a neighbouring cell
		if (neighbour && !(neighbour->getItem()) && !(neighbour->getOccupant())
            && neighbour->getCellType() == CellType::FloorTile) {
			
			neighbour->setItem
				(make_shared<GoldPile>(HUMAN_DROPPED_GOLD_PILE_VALUE));

			++numberOfGoldPilesAlreadyDropped;
		}

		if (numberOfGoldPilesAlreadyDropped
			== HUMAN_NUMBER_OF_GOLD_PILES_DROPPED) {

			return;
		}

	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rsi
leaq -0x30(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x2ff40
movq -0xc8(%rbp), %rdi
callq 0x19df0
movq %rax, %rsi
leaq -0x20(%rbp), %rdi
callq 0x2cf00
jmp 0x3315d
leaq -0x30(%rbp), %rdi
callq 0x199a0
movl $0x0, -0x40(%rbp)
leaq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x1a400
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rdi
callq 0x1a430
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x1a460
testb $0x1, %al
jne 0x331a5
jmp 0x33425
leaq -0x50(%rbp), %rdi
callq 0x1a4a0
movq %rax, %rsi
leaq -0x68(%rbp), %rdi
callq 0x19e60
leaq -0x68(%rbp), %rdi
callq 0x1a4c0
movb %al, %cl
movb $0x0, -0x79(%rbp)
movb $0x0, -0x91(%rbp)
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0xc9(%rbp)
jne 0x331e2
jmp 0x3327c
leaq -0x68(%rbp), %rdi
callq 0x19df0
movq %rax, %rsi
leaq -0x78(%rbp), %rdi
callq 0x2cc70
jmp 0x331f9
movb $0x1, -0x79(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x19dd0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0xc9(%rbp)
jne 0x3327c
leaq -0x68(%rbp), %rdi
callq 0x19df0
movq %rax, %rsi
leaq -0x90(%rbp), %rdi
callq 0x2cf30
jmp 0x3322f
movb $0x1, -0x91(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x19780
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0xc9(%rbp)
jne 0x3327c
leaq -0x68(%rbp), %rdi
callq 0x19df0
movq %rax, %rdi
callq 0x2cc40
movl %eax, -0xd0(%rbp)
jmp 0x3326a
movl -0xd0(%rbp), %eax
cmpl $0x1, %eax
sete %al
movb %al, -0xc9(%rbp)
movb -0xc9(%rbp), %al
movb %al, -0xd1(%rbp)
testb $0x1, -0x91(%rbp)
jne 0x33293
jmp 0x3329f
leaq -0x90(%rbp), %rdi
callq 0x19530
testb $0x1, -0x79(%rbp)
jne 0x332a7
jmp 0x332b0
leaq -0x78(%rbp), %rdi
callq 0x19e40
movb -0xd1(%rbp), %al
testb $0x1, %al
jne 0x332bf
jmp 0x333d0
leaq -0x68(%rbp), %rdi
callq 0x19df0
movq %rax, -0xe0(%rbp)
leaq 0x11f0a(%rip), %rsi     # 0x451e0
leaq -0xb8(%rbp), %rdi
callq 0x19b40
jmp 0x332e4
leaq -0xa8(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
leaq -0xb8(%rbp), %rsi
callq 0x1a160
movq -0xe0(%rbp), %rdi
movq -0xe8(%rbp), %rsi
callq 0x2cbe0
jmp 0x33313
leaq -0xa8(%rbp), %rdi
callq 0x19e40
leaq -0xb8(%rbp), %rdi
callq 0x19be0
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x333d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x199a0
jmp 0x33441
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x33411
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x33397
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
testb $0x1, -0x91(%rbp)
jne 0x33389
jmp 0x33395
leaq -0x90(%rbp), %rdi
callq 0x19530
jmp 0x33397
testb $0x1, -0x79(%rbp)
jne 0x3339f
jmp 0x333a8
leaq -0x78(%rbp), %rdi
callq 0x19e40
jmp 0x33411
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x19e40
leaq -0xb8(%rbp), %rdi
callq 0x19be0
jmp 0x33411
cmpl $0x2, -0x40(%rbp)
jne 0x333e2
movl $0x1, -0xbc(%rbp)
jmp 0x333ec
movl $0x0, -0xbc(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x199a0
movl -0xbc(%rbp), %eax
testl %eax, %eax
jne 0x3342f
jmp 0x33401
jmp 0x33403
leaq -0x50(%rbp), %rdi
callq 0x1a4e0
jmp 0x3318f
leaq -0x68(%rbp), %rdi
callq 0x199a0
leaq -0x20(%rbp), %rdi
callq 0x1a2f0
jmp 0x33441
movl $0x0, -0xbc(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x1a2f0
addq $0xf0, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x6550
nopw (%rax,%rax)