// File: /workspace/github_c_makefile_star2_O2/ajpaulson[P]srogue11/things.c
// Function: drop
bool drop(struct linked_list *item)
{
	char ch;
	struct linked_list *ll, *nll;
	struct object *op;

	if (item == NULL) {
		ch = mvinch(hero.y, hero.x);
		if (ch != FLOOR && ch != PASSAGE && ch != POOL) {
			msg("There is something there already.");
			after = FALSE;
			return SOMTHERE;
		}
		if ((ll = get_item("drop", 0)) == NULL)
			return FALSE;
	}
	else {
		ll = item;
	}
	op = OBJPTR(ll);
	if (!dropcheck(op))
		return CANTDROP;
	/*
	 * Take it out of the pack
	 */
	if (op->o_count >= 2 && op->o_type != WEAPON) {
		nll = new_item(sizeof *op);
		op->o_count--;
		op->o_vol = itemvol(op);
		op = OBJPTR(nll);
		*op = *(OBJPTR(ll));
		op->o_count = 1;
		op->o_vol = itemvol(op);
		ll = nll;
	}
	else {
		detach(pack, ll);
	}
	if (ch == POOL) {
		msg("%s sinks out of sight.",inv_name(op, TRUE));
		discard(ll);
	}
	else {			/* put on dungeon floor */
		if (levtype == POSTLEV) {
			op->o_pos = hero;	/* same place as hero */
			fall(ll,FALSE);
			if (item == NULL)	/* if item wasn't sold */
				msg("Thanks for your donation to the Fiend's flea market.");
		}
		else {
			attach(lvl_obj, ll);
			mvaddch(hero.y, hero.x, op->o_type);
			op->o_pos = hero;
			msg("Dropped %s", inv_name(op, TRUE));
		}
	}
	updpack();			/* new pack weight */
	return TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq %rdi, %r12
testq %rdi, %rdi
je 0x199f5
movq 0x10(%r12), %r15
movq %r15, %rdi
callq 0x19ba9
movb $0x1, %bl
testb %al, %al
je 0x19b98
cmpl $0x2, 0x24(%r15)
jl 0x199dd
cmpl $0x29, 0x20(%r15)
jne 0x19a7a
leaq 0x1426c(%rip), %rdi     # 0x2dc50
addq $0x68, %rdi
movq %r12, %rsi
callq 0xb7f4
jmp 0x19abe
movq 0x1053c(%rip), %rbx     # 0x29f38
movq (%rbx), %rdi
leaq 0x1424a(%rip), %rax     # 0x2dc50
movl 0x50(%rax), %edx
movl 0x54(%rax), %esi
callq 0x6470
cmpl $-0x1, %eax
je 0x19a5b
movq (%rbx), %rdi
callq 0x6320
movl %eax, %ebp
cmpb $0x2e, %bpl
ja 0x19a5b
movzbl %bpl, %eax
movabsq $0x400c00000000, %rcx   # imm = 0x400C00000000
btq %rax, %rcx
jae 0x19a5b
leaq 0x7bb4(%rip), %rdi      # 0x215f5
xorl %ebx, %ebx
xorl %esi, %esi
callq 0xfd08
movq %rax, %r12
testq %rax, %rax
jne 0x199b4
jmp 0x19b98
leaq 0x7b71(%rip), %rdi      # 0x215d3
xorl %eax, %eax
callq 0xb178
leaq 0x1088d(%rip), %rax     # 0x2a2fd
movb $0x0, (%rax)
movb $0x1, %bl
jmp 0x19b98
pushq $0x50
popq %rdi
callq 0xb877
movq %rax, %r13
decl 0x24(%r15)
movq %r15, %rdi
callq 0x953d
movl %eax, 0x44(%r15)
movq 0x10(%r13), %r15
movq 0x10(%r12), %rsi
pushq $0xa
popq %rcx
movq %r15, %rdi
rep  movsq (%rsi), %es:(%rdi)
movl $0x1, 0x24(%r15)
movq %r15, %rdi
callq 0x953d
movl %eax, 0x44(%r15)
movq %r13, %r12
cmpb $0x22, %bpl
jne 0x19af1
pushq $0x1
popq %rsi
movq %r15, %rdi
callq 0x1908c
leaq 0x7b24(%rip), %rdi      # 0x215fa
leaq 0x143a3(%rip), %rsi     # 0x2de80
xorl %eax, %eax
callq 0xb178
movq %r12, %rdi
callq 0xb857
jmp 0x19b91
leaq 0x13d5c(%rip), %rax     # 0x2d854
cmpl $0x1, (%rax)
jne 0x19b2a
leaq 0x1414c(%rip), %rax     # 0x2dc50
movq 0x50(%rax), %rax
movq %rax, (%r15)
movq %r12, %rdi
xorl %esi, %esi
callq 0x1ae63
testq %r14, %r14
jne 0x19b91
leaq 0x7af0(%rip), %rdi      # 0x21611
xorl %eax, %eax
callq 0xb178
jmp 0x19b91
leaq 0x13d07(%rip), %rdi     # 0x2d838
movq %r12, %rsi
callq 0xb81b
movq 0x103f8(%rip), %r12     # 0x29f38
movq (%r12), %rdi
leaq 0x14105(%rip), %r14     # 0x2dc50
movl 0x50(%r14), %edx
movl 0x54(%r14), %esi
callq 0x6470
cmpl $-0x1, %eax
je 0x19b6a
movq (%r12), %rdi
movl 0x20(%r15), %esi
callq 0x64a0
movq 0x50(%r14), %rax
movq %rax, (%r15)
pushq $0x1
popq %rsi
movq %r15, %rdi
callq 0x1908c
leaq 0x7ac3(%rip), %rdi      # 0x21646
leaq 0x142f6(%rip), %rsi     # 0x2de80
xorl %eax, %eax
callq 0xb178
xorl %eax, %eax
callq 0x9378
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq