// File: /workspace/github_c_makefile_star2_O1/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 0x110c7(%rip), %r13     # 0x2d850
movq (%r13), %rbp
leaq 0x70ec(%rip), %rdi      # 0x23880
movl $0x29, %esi
callq 0x10881
testq %rax, %rax
je 0x1c963
movq %rax, %rbx
movq 0x10(%rax), %r14
movq %r14, %rdi
callq 0x1b623
testb %al, %al
je 0x1c963
movq %r14, %rdi
callq 0xd358
testb %al, %al
jne 0x1c963
cmpq %rbp, %r14
je 0x1c7da
cmpl $0x29, 0x20(%r14)
je 0x1c857
movq 0x18(%r14), %rsi
leaq 0x70a1(%rip), %rdi      # 0x23886
xorl %eax, %eax
callq 0xb6e0
xorl %eax, %eax
callq 0xb9fd
movsbl %al, %r12d
callq 0x65b0
movq (%rax), %rax
movsbq %r12b, %rcx
testb $0x1, 0x1(%rax,%rcx,2)
je 0x1c815
movl %r12d, %edi
callq 0x6310
movl %eax, %r12d
cmpl $0x1b, %r12d
je 0x1c827
cmpl $0x79, %r12d
je 0x1c857
cmpl $0x6e, %r12d
jne 0x1c7ec
leaq 0x70e3(%rip), %rdi      # 0x23911
xorl %eax, %eax
callq 0xb6e0
movq %rbp, (%r13)
leaq 0xdacd(%rip), %rax      # 0x2a30d
movb $0x0, (%rax)
cmpl $0x1b, %r12d
je 0x1c963
cmpl $0x6e, %r12d
je 0x1c963
movl 0x24(%r14), %eax
cmpl $0x1, %eax
jg 0x1c875
leaq 0x113f9(%rip), %rdi     # 0x2dc60
addq $0x68, %rdi
movq %rbx, %rsi
callq 0xbe00
jmp 0x1c8be
decl %eax
movl %eax, 0x24(%r14)
movq %r14, %rdi
callq 0x9804
movl %eax, 0x44(%r14)
movl $0x50, %edi
callq 0xbeb3
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 0x9804
movl %eax, 0x44(%r14)
movq %r12, %rbx
xorl %eax, %eax
callq 0x95e0
movq %r14, %rdi
movl %r15d, %esi
movl 0x4(%rsp), %edx
callq 0x1c974
callq 0x65b0
movq (%rax), %r15
leaq 0x1410d(%rip), %r12     # 0x309f0
movq (%r12), %rdi
movl (%r14), %edx
movl 0x4(%r14), %esi
callq 0x6490
cmpl $-0x1, %eax
je 0x1c905
movq (%r12), %rdi
callq 0x6330
cltq
jmp 0x1c90c
movq $-0x1, %rax
testb $0x4, 0x1(%r15,%rax,2)
je 0x1c928
movq %r14, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x99cc
testb %al, %al
jne 0x1c935
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1cacd
leaq 0x140a4(%rip), %rbx     # 0x309e0
movq (%rbx), %rdi
leaq 0x1131a(%rip), %rax     # 0x2dc60
movl 0x50(%rax), %edx
movl 0x54(%rax), %esi
callq 0x6490
cmpl $-0x1, %eax
je 0x1c963
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