// File: /workspace/github_c_makefile_star2_O3/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 0x1119b(%rip), %r13     # 0x2d850
movq (%r13), %rbp
leaq 0x7238(%rip), %rdi      # 0x238f8
movl $0x29, %esi
callq 0x10749
testq %rax, %rax
je 0x1c88f
movq %rax, %rbx
movq 0x10(%rax), %r14
movq %r14, %rdi
callq 0x1b54e
testb %al, %al
je 0x1c88f
movq %r14, %rdi
callq 0xd2fe
testb %al, %al
jne 0x1c88f
cmpq %rbp, %r14
je 0x1c706
cmpl $0x29, 0x20(%r14)
je 0x1c783
movq 0x18(%r14), %rsi
leaq 0x71ed(%rip), %rdi      # 0x238fe
xorl %eax, %eax
callq 0xb620
xorl %eax, %eax
callq 0xb94c
movsbl %al, %r12d
callq 0x65b0
movq (%rax), %rax
movsbq %r12b, %rcx
testb $0x1, 0x1(%rax,%rcx,2)
je 0x1c741
movl %r12d, %edi
callq 0x6310
movl %eax, %r12d
cmpl $0x1b, %r12d
je 0x1c753
cmpl $0x79, %r12d
je 0x1c783
cmpl $0x6e, %r12d
jne 0x1c718
leaq 0x722f(%rip), %rdi      # 0x23989
xorl %eax, %eax
callq 0xb620
movq %rbp, (%r13)
leaq 0xdba1(%rip), %rax      # 0x2a30d
movb $0x0, (%rax)
cmpl $0x1b, %r12d
je 0x1c88f
cmpl $0x6e, %r12d
je 0x1c88f
movl 0x24(%r14), %eax
cmpl $0x1, %eax
jg 0x1c7a1
leaq 0x114cd(%rip), %rdi     # 0x2dc60
addq $0x68, %rdi
movq %rbx, %rsi
callq 0xbd4c
jmp 0x1c7ea
decl %eax
movl %eax, 0x24(%r14)
movq %r14, %rdi
callq 0x978c
movl %eax, 0x44(%r14)
movl $0x50, %edi
callq 0xbdfa
movq %rax, %r12
movq 0x10(%rax), %r14
movq 0x10(%rbx), %rsi
movl $0xa, %ecx
movq %r14, %rdi
rep  movsq (%rsi), %es:(%rdi)
movl $0x1, 0x24(%r14)
movq %r14, %rdi
callq 0x978c
movl %eax, 0x44(%r14)
movq %r12, %rbx
xorl %eax, %eax
callq 0x9560
movq %r14, %rdi
movl %r15d, %esi
movl 0x4(%rsp), %edx
callq 0x1c8a0
callq 0x65b0
movq (%rax), %r15
leaq 0x141e1(%rip), %r12     # 0x309f0
movq (%r12), %rdi
movl (%r14), %edx
movl 0x4(%r14), %esi
callq 0x6490
cmpl $-0x1, %eax
je 0x1c831
movq (%r12), %rdi
callq 0x6330
cltq
jmp 0x1c838
movq $-0x1, %rax
testb $0x4, 0x1(%r15,%rax,2)
je 0x1c854
movq %r14, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x9954
testb %al, %al
jne 0x1c861
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1c9f8
leaq 0x14178(%rip), %rbx     # 0x309e0
movq (%rbx), %rdi
leaq 0x113ee(%rip), %rax     # 0x2dc60
movl 0x50(%rax), %edx
movl 0x54(%rax), %esi
callq 0x6490
cmpl $-0x1, %eax
je 0x1c88f
movq (%rbx), %rdi
movl $0x40, %esi
callq 0x64c0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq