// File: /workspace/github_c_makefile_star2_O2/ajpaulson[P]srogue11/weapons.c
// Function: missile
int missile(int ydelta,int xdelta)
{
	struct object *obj, *nowwield;
	struct linked_list *item, *nitem;

	/*
	 * Get which thing we are hurling
	 */
	nowwield = cur_weapon;		/* must save current weap */
	if ((item = get_item("throw", WEAPON)) == NULL)
		return 0;
	obj = OBJPTR(item);
	if (!dropcheck(obj) || is_current(obj))
		return 0;
	if (obj == nowwield || obj->o_type != WEAPON) {
		int c;

		msg("Do you want to throw that %s? (y or n)",obj->o_typname);
		do {
			c = readchar();
			if (isupper(c))
				c = tolower(c);
			if (c == ESCAPE || c == 'n') {
				msg("");
				cur_weapon = nowwield;
				after = FALSE;		/* ooops, a mistake */
				return 0;
			}
		} while (c != 'y');	/* keep looking for good ans */
	}
	/*
	 * Get rid of the thing.  If it is a non-multiple item object, or
	 * if it is the last thing, just drop it.  Otherwise, create a new
	 * item with a count of one.
	 */
	if (obj->o_count < 2) {
		detach(pack, item);
	}
	else {
		obj->o_count--;
		obj->o_vol = itemvol(obj);
		nitem = new_item(sizeof *obj);
		obj = OBJPTR(nitem);
		*obj = *(OBJPTR(item));
		obj->o_count = 1;
		obj->o_vol = itemvol(obj);
		item = nitem;
	}
	updpack();						/* new pack weight */
	do_motion(obj, ydelta, xdelta);
	if (!isalpha(mvwinch(mw, obj->o_pos.y, obj->o_pos.x))
	  || !hit_monster(&obj->o_pos, obj))
		fall(item, TRUE);
	mvwaddch(cw, hero.y, hero.x, PLAYER);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, 0x4(%rsp)
movl %edi, %r15d
leaq 0x12d0b(%rip), %r13     # 0x2d840
movq (%r13), %rbp
leaq 0x6db8(%rip), %rdi      # 0x218f8
pushq $0x29
popq %rsi
callq 0xfd08
testq %rax, %rax
je 0x1acfc
movq %rax, %rbx
movq 0x10(%rax), %r14
movq %r14, %rdi
callq 0x19ba9
testb %al, %al
je 0x1acfc
movq %r14, %rdi
callq 0xcb75
testb %al, %al
jne 0x1acfc
cmpq %rbp, %r14
je 0x1ab84
cmpl $0x29, 0x20(%r14)
je 0x1ac01
movq 0x18(%r14), %rsi
leaq 0x6d6f(%rip), %rdi      # 0x218fe
xorl %eax, %eax
callq 0xb178
xorl %eax, %eax
callq 0xb447
movsbl %al, %r12d
callq 0x6590
movq (%rax), %rax
movsbq %r12b, %rcx
testb $0x1, 0x1(%rax,%rcx,2)
je 0x1abbf
movl %r12d, %edi
callq 0x6300
movl %eax, %r12d
cmpl $0x1b, %r12d
je 0x1abd1
cmpl $0x79, %r12d
je 0x1ac01
cmpl $0x6e, %r12d
jne 0x1ab96
leaq 0x6db1(%rip), %rdi      # 0x21989
xorl %eax, %eax
callq 0xb178
movq %rbp, (%r13)
leaq 0xf713(%rip), %rax      # 0x2a2fd
movb $0x0, (%rax)
cmpl $0x1b, %r12d
je 0x1acfc
cmpl $0x6e, %r12d
je 0x1acfc
movl 0x24(%r14), %eax
cmpl $0x1, %eax
jg 0x1ac1f
leaq 0x1303f(%rip), %rdi     # 0x2dc50
addq $0x68, %rdi
movq %rbx, %rsi
callq 0xb7f4
jmp 0x1ac64
decl %eax
movl %eax, 0x24(%r14)
movq %r14, %rdi
callq 0x953d
movl %eax, 0x44(%r14)
pushq $0x50
popq %rdi
callq 0xb877
movq %rax, %r12
movq 0x10(%rax), %r14
movq 0x10(%rbx), %rsi
pushq $0xa
popq %rcx
movq %r14, %rdi
rep  movsq (%rsi), %es:(%rdi)
movl $0x1, 0x24(%r14)
movq %r14, %rdi
callq 0x953d
movl %eax, 0x44(%r14)
movq %r12, %rbx
xorl %eax, %eax
callq 0x9378
movq %r14, %rdi
movl %r15d, %esi
movl 0x4(%rsp), %edx
callq 0x1ad0d
callq 0x6590
movq (%rax), %r15
leaq 0x15d57(%rip), %r12     # 0x309e0
movq (%r12), %rdi
movl (%r14), %edx
movl 0x4(%r14), %esi
callq 0x6470
cmpl $-0x1, %eax
je 0x1acab
movq (%r12), %rdi
callq 0x6320
cltq
jmp 0x1acae
pushq $-0x1
popq %rax
testb $0x4, 0x1(%r15,%rax,2)
je 0x1acc5
movq %r14, %rdi
movq %r14, %rsi
callq 0x1ae5b
testb %al, %al
jne 0x1acd0
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x1ae63
leaq 0x15cf9(%rip), %rbx     # 0x309d0
movq (%rbx), %rdi
leaq 0x12f6f(%rip), %rax     # 0x2dc50
movl 0x50(%rax), %edx
movl 0x54(%rax), %esi
callq 0x6470
cmpl $-0x1, %eax
je 0x1acfc
movq (%rbx), %rdi
pushq $0x40
popq %rsi
callq 0x64a0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq