// File: XxAdi101xX[P]ChamberCrawler/Character/Merchant.cc
// Function: Merchant::deathRoutine()
void Merchant::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>(MERCHANT_DROPPED_GOLD_PILE_VALUE));

			++numberOfGoldPilesAlreadyDropped;
		}

		if (numberOfGoldPilesAlreadyDropped
			== MERCHANT_NUMBER_OF_GOLD_PILES_DROPPED) {

			return;
		}

	}

	merchantsAngered = true;
}

// 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 0x3357d
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 0x335c5
jmp 0x33845
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 0x33602
jmp 0x3369c
leaq -0x68(%rbp), %rdi
callq 0x19df0
movq %rax, %rsi
leaq -0x78(%rbp), %rdi
callq 0x2cc70
jmp 0x33619
movb $0x1, -0x79(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x19dd0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0xc9(%rbp)
jne 0x3369c
leaq -0x68(%rbp), %rdi
callq 0x19df0
movq %rax, %rsi
leaq -0x90(%rbp), %rdi
callq 0x2cf30
jmp 0x3364f
movb $0x1, -0x91(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x19780
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0xc9(%rbp)
jne 0x3369c
leaq -0x68(%rbp), %rdi
callq 0x19df0
movq %rax, %rdi
callq 0x2cc40
movl %eax, -0xd0(%rbp)
jmp 0x3368a
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 0x336b3
jmp 0x336bf
leaq -0x90(%rbp), %rdi
callq 0x19530
testb $0x1, -0x79(%rbp)
jne 0x336c7
jmp 0x336d0
leaq -0x78(%rbp), %rdi
callq 0x19e40
movb -0xd1(%rbp), %al
testb $0x1, %al
jne 0x336df
jmp 0x337f0
leaq -0x68(%rbp), %rdi
callq 0x19df0
movq %rax, -0xe0(%rbp)
leaq 0x11af6(%rip), %rsi     # 0x451ec
leaq -0xb8(%rbp), %rdi
callq 0x19b40
jmp 0x33704
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 0x33733
leaq -0xa8(%rbp), %rdi
callq 0x19e40
leaq -0xb8(%rbp), %rdi
callq 0x19be0
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x337f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x199a0
jmp 0x3386b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x33831
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x337b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
testb $0x1, -0x91(%rbp)
jne 0x337a9
jmp 0x337b5
leaq -0x90(%rbp), %rdi
callq 0x19530
jmp 0x337b7
testb $0x1, -0x79(%rbp)
jne 0x337bf
jmp 0x337c8
leaq -0x78(%rbp), %rdi
callq 0x19e40
jmp 0x33831
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 0x33831
cmpl $0x1, -0x40(%rbp)
jne 0x33802
movl $0x1, -0xbc(%rbp)
jmp 0x3380c
movl $0x0, -0xbc(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x199a0
movl -0xbc(%rbp), %eax
testl %eax, %eax
jne 0x33859
jmp 0x33821
jmp 0x33823
leaq -0x50(%rbp), %rdi
callq 0x1a4e0
jmp 0x335af
leaq -0x68(%rbp), %rdi
callq 0x199a0
leaq -0x20(%rbp), %rdi
callq 0x1a2f0
jmp 0x3386b
leaq 0x34921(%rip), %rax     # 0x6816d
movb $0x1, (%rax)
movl $0x0, -0xbc(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x1a2f0
addq $0xf0, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x6550
nopw %cs:(%rax,%rax)
nop