// File: /workspace/github_c_makefile_star2_O0/ajpaulson[P]srogue11/sticks.c
// Function: drain
int drain(int ymin,int  ymax,int xmin,int xmax)
{
	int i, j, cnt;
	struct thing *ick;
	struct linked_list *item;

	/*
	 * First count how many things we need to spread the hit points among
	 */
	cnt = 0;
	for (i = ymin; i <= ymax; i++)
		for (j = xmin; j <= xmax; j++)
			if (isalpha(mvwinch(mw, i, j)))
				cnt++;
	if (cnt == 0) {
		msg("You have a tingling feeling.");
		return 0;
	}
	cnt = him->s_hpt / cnt;
	him->s_hpt /= 2;
	/*
	 * Now zot all of the monsters
	 */
	for (i = ymin; i <= ymax; i++) {
		for (j = xmin; j <= xmax; j++) {
			if(isalpha(mvwinch(mw, i, j))) {
				item = find_mons(i, j);
				if (item == NULL)
					continue;
				ick = THINGPTR(item);
				if ((ick->t_stats.s_hpt -= cnt) < 1)
					killed(item,cansee(i,j) && !(ick->t_flags & ISINVIS));
			}
		}
	}
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0xc(%rbp), %eax
jg 0x22e5b
movl -0x10(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jg 0x22e4b
callq 0x65b0
movq (%rax), %rax
movq %rax, -0x38(%rbp)
leaq 0x17072(%rip), %rax     # 0x39e60
movq (%rax), %rdi
movl -0x18(%rbp), %esi
movl -0x1c(%rbp), %edx
callq 0x6490
cmpl $-0x1, %eax
jne 0x22e0b
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x3c(%rbp)
jmp 0x22e1d
leaq 0x1704e(%rip), %rax     # 0x39e60
movq (%rax), %rdi
callq 0x6340
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rax
movl -0x3c(%rbp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x22e3e
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x22e40
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x22dd3
jmp 0x22e4d
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x22dc1
cmpl $0x0, -0x20(%rbp)
jne 0x22e7b
leaq 0xac42(%rip), %rdi      # 0x2daaa
movb $0x0, %al
callq 0xd8f0
movl $0x0, -0x4(%rbp)
jmp 0x22fdf
leaq 0x1434e(%rip), %rax     # 0x371d0
movq (%rax), %rax
movl 0x30(%rax), %eax
cltd
idivl -0x20(%rbp)
movl %eax, -0x20(%rbp)
leaq 0x1433a(%rip), %rax     # 0x371d0
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movl 0x30(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x30(%rax)
movl -0x8(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0xc(%rbp), %eax
jg 0x22fd8
movl -0x10(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jg 0x22fc8
callq 0x65b0
movq (%rax), %rax
movq %rax, -0x50(%rbp)
leaq 0x16f78(%rip), %rax     # 0x39e60
movq (%rax), %rdi
movl -0x18(%rbp), %esi
movl -0x1c(%rbp), %edx
callq 0x6490
cmpl $-0x1, %eax
jne 0x22f05
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x54(%rbp)
jmp 0x22f17
leaq 0x16f54(%rip), %rax     # 0x39e60
movq (%rax), %rdi
callq 0x6340
movl %eax, -0x54(%rbp)
movq -0x50(%rbp), %rax
movl -0x54(%rbp), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x22fb8
movl -0x18(%rbp), %edi
movl -0x1c(%rbp), %esi
callq 0x7c90
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x22f4b
jmp 0x22fba
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
movl -0x20(%rbp), %edx
movq -0x28(%rbp), %rcx
movl 0x30(%rcx), %eax
subl %edx, %eax
movl %eax, 0x30(%rcx)
cmpl $0x1, %eax
jge 0x22fb6
movq -0x30(%rbp), %rax
movq %rax, -0x60(%rbp)
movl -0x18(%rbp), %edi
movl -0x1c(%rbp), %esi
callq 0x7480
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x55(%rbp)
jne 0x22f8c
jmp 0x22fa4
movq -0x28(%rbp), %rax
movq 0x78(%rax), %rax
andq $0x10, %rax
cmpq $0x0, %rax
setne %al
xorb $-0x1, %al
movb %al, -0x55(%rbp)
movq -0x60(%rbp), %rdi
movb -0x55(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
callq 0xbaf0
jmp 0x22fb8
jmp 0x22fba
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x22ec9
jmp 0x22fca
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x22eb7
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)