// File: /workspace/github_c_makefile_star2_O0/ajpaulson[P]srogue11/monsters.c
// Function: wake_monster
struct linked_list *wake_monster(int y,int x)
{
	struct thing *tp;
	struct linked_list *it;
	struct room *rp;
	char ch;
	bool treas = FALSE;

	if ((it = find_mons(y, x)) == NULL)
		return NULL;
	tp = THINGPTR(it);
	ch = tp->t_type;
	/*
	 * Every time he sees mean monster, it might start chasing him
	 */
	rp = player.t_room;
	if (rp != NULL && rf_on(rp,ISTREAS)) {
		tp->t_flags &= ~ISHELD;
		treas = TRUE;
	}
	if (treas || (rnd(100) > 33 && on(*tp,ISMEAN) && off(*tp,ISHELD) &&
	  !iswearing(R_STEALTH))) {
		tp->t_dest = &hero;
		tp->t_flags |= ISRUN;
	}
	if (ch == 'U' && pl_off(ISBLIND)) {
		if ((rp != NULL && !rf_on(rp,ISDARK) && levtype != MAZELEV)
		  || DISTANCE(y, x, hero.y, hero.x) < 3) {
			if (off(*tp,ISFOUND) && !save(VS_PETRIFICATION)
			  && !iswearing(R_SUSAB) && pl_off(ISINVINC)) {
				msg("The umber hulk's gaze has confused you.");
				if (pl_on(ISHUH))
					lengthen(unconfuse,rnd(20)+HUHDURATION);
				else
					fuse(unconfuse,TRUE,rnd(20)+HUHDURATION);
				player.t_flags |= ISHUH;
			}
			tp->t_flags |= ISFOUND;
		}
	}
	/*
	 * Hide invisible monsters
	 */
	if ((tp->t_flags & ISINVIS) && pl_off(CANSEE))
		ch = mvinch(y, x);
	/*
	 * Let greedy ones guard gold
	 */
	if (on(*tp, ISGREED) && off(*tp, ISRUN)) {
		if (rp != NULL && rp->r_goldval) {
			tp->t_dest = &rp->r_gold;
			tp->t_flags |= ISRUN;
		}
	}
	return it;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0xc(%rbp)
movl %esi, -0x10(%rbp)
movb $0x0, -0x2a(%rbp)
movl -0xc(%rbp), %edi
movl -0x10(%rbp), %esi
callq 0x7c90
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x10a34
movq $0x0, -0x8(%rbp)
jmp 0x10d1c
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movb 0x8d(%rax), %al
movb %al, -0x29(%rbp)
leaq 0x2667c(%rip), %rax     # 0x370d0
movq 0x70(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x10a8d
movq -0x28(%rbp), %rdi
movl $0x4, %esi
callq 0x19950
cmpl $0x0, %eax
je 0x10a8d
movq -0x18(%rbp), %rax
movq 0x78(%rax), %rcx
andq $-0x101, %rcx           # imm = 0xFEFF
movq %rcx, 0x78(%rax)
movb $0x1, -0x2a(%rbp)
testb $0x1, -0x2a(%rbp)
jne 0x10ad8
movl $0x64, %edi
movb $0x0, %al
callq 0xef20
cmpl $0x21, %eax
jle 0x10afb
movq -0x18(%rbp), %rax
movq 0x78(%rax), %rax
andq $0x20, %rax
cmpq $0x0, %rax
je 0x10afb
movq -0x18(%rbp), %rax
movq 0x78(%rax), %rax
andq $0x100, %rax            # imm = 0x100
cmpq $0x0, %rax
jne 0x10afb
movl $0xc, %edi
callq 0x18220
testb $0x1, %al
jne 0x10afb
movq -0x18(%rbp), %rax
leaq 0x265ed(%rip), %rcx     # 0x370d0
addq $0x50, %rcx
movq %rcx, 0x60(%rax)
movq -0x18(%rbp), %rax
movq 0x78(%rax), %rcx
orq $0x4, %rcx
movq %rcx, 0x78(%rax)
movsbl -0x29(%rbp), %eax
cmpl $0x55, %eax
jne 0x10c5f
movl $0x1, %edi
callq 0xaa90
testb $0x1, %al
jne 0x10b1b
jmp 0x10c5f
cmpq $0x0, -0x28(%rbp)
je 0x10b41
movq -0x28(%rbp), %rdi
movl $0x1, %esi
callq 0x19950
cmpl $0x0, %eax
jne 0x10b41
leaq 0x26198(%rip), %rax     # 0x36cd4
cmpl $0x2, (%rax)
jne 0x10b86
leaq 0x26588(%rip), %rax     # 0x370d0
movl 0x50(%rax), %eax
subl -0x10(%rbp), %eax
leaq 0x2657b(%rip), %rcx     # 0x370d0
movl 0x50(%rcx), %ecx
subl -0x10(%rbp), %ecx
imull %ecx, %eax
leaq 0x2656b(%rip), %rcx     # 0x370d0
movl 0x54(%rcx), %ecx
subl -0xc(%rbp), %ecx
leaq 0x2655e(%rip), %rdx     # 0x370d0
movl 0x54(%rdx), %edx
subl -0xc(%rbp), %edx
imull %edx, %ecx
addl %ecx, %eax
cmpl $0x3, %eax
jge 0x10c5d
movq -0x18(%rbp), %rax
movq 0x78(%rax), %rax
andq $0x8, %rax
cmpq $0x0, %rax
jne 0x10c4d
movl $0x1, %edi
callq 0xcaa0
cmpl $0x0, %eax
jne 0x10c4d
movl $0x10, %edi
callq 0x18220
testb $0x1, %al
jne 0x10c4d
movl $0x8, %edi
callq 0xaa90
testb $0x1, %al
jne 0x10bd1
jmp 0x10c4d
leaq 0x1a9a0(%rip), %rdi     # 0x2b578
movb $0x0, %al
callq 0xd8f0
movl $0x200, %edi            # imm = 0x200
callq 0xaa60
testb $0x1, %al
jne 0x10bef
jmp 0x10c0e
movl $0x14, %edi
movb $0x0, %al
callq 0xef20
movl %eax, %esi
addl $0x14, %esi
leaq -0x6bc7(%rip), %rdi     # 0xa040
callq 0x9c60
jmp 0x10c30
movl $0x14, %edi
movb $0x0, %al
callq 0xef20
movl %eax, %edx
addl $0x14, %edx
leaq -0x6be6(%rip), %rdi     # 0xa040
movl $0x1, %esi
callq 0x9c30
leaq 0x26499(%rip), %rax     # 0x370d0
movq 0x78(%rax), %rcx
orq $0x200, %rcx            # imm = 0x200
leaq 0x26487(%rip), %rax     # 0x370d0
movq %rcx, 0x78(%rax)
movq -0x18(%rbp), %rax
movq 0x78(%rax), %rcx
orq $0x8, %rcx
movq %rcx, 0x78(%rax)
jmp 0x10c5f
movq -0x18(%rbp), %rax
movq 0x78(%rax), %rax
andq $0x10, %rax
cmpq $0x0, %rax
je 0x10cbd
movl $0x1000, %edi           # imm = 0x1000
callq 0xaa90
testb $0x1, %al
jne 0x10c81
jmp 0x10cbd
movq 0x22338(%rip), %rax     # 0x32fc0
movq (%rax), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
callq 0x6490
cmpl $-0x1, %eax
jne 0x10ca5
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x30(%rbp)
jmp 0x10cb7
movq 0x22314(%rip), %rax     # 0x32fc0
movq (%rax), %rdi
callq 0x6340
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movb %al, -0x29(%rbp)
movq -0x18(%rbp), %rax
movq 0x78(%rax), %rax
andq $0x40, %rax
cmpq $0x0, %rax
je 0x10d14
movq -0x18(%rbp), %rax
movq 0x78(%rax), %rax
andq $0x4, %rax
cmpq $0x0, %rax
jne 0x10d14
cmpq $0x0, -0x28(%rbp)
je 0x10d12
movq -0x28(%rbp), %rax
cmpl $0x0, 0x58(%rax)
je 0x10d12
movq -0x28(%rbp), %rcx
addq $0x10, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x18(%rbp), %rax
movq 0x78(%rax), %rcx
orq $0x4, %rcx
movq %rcx, 0x78(%rax)
jmp 0x10d14
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)