// File: /workspace/github_c_makefile_star2_O1/ajpaulson[P]srogue11/command.c
// Function: search
int search()
{
	int x, y;
	char ch;

	/*
	 * Look all around the hero, if there is something hidden there,
	 * give him a chance to find it.  If its found, display it.
	 */
	if (pl_on(ISBLIND))
		return 0;
	for (x = hero.x - 1; x <= hero.x + 1; x++) {
		for (y = hero.y - 1; y <= hero.y + 1; y++) {
			ch = winat(y, x);
			if (isatrap(ch)) {		/* see if its a trap */
				struct trap *tp;

				if ((tp = trap_at(y, x)) == NULL)
					break;
				if (tp->tr_flags & ISFOUND)
					break;		/* no message if its seen */
				if (mvwinch(cw, y, x) == ch)
					break;
				if (rnd(100) > (him->s_lvl * 9 + herowis() * 5))
					 break;
				tp->tr_flags |= ISFOUND;
				mvwaddch(cw, y, x, tp->tr_type);
				count = 0;
				running = FALSE;
				msg(tr_name(tp->tr_type));
			}
			else if(ch == SECRETDOOR) {
				if (rnd(100) < (him->s_lvl * 4 + herowis() * 5)) {
					mvaddch(y, x, DOOR);
					count = 0;
				}
			}
		}
	}
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0x1, %edi
callq 0x9595
testb %al, %al
jne 0x8538
leaq 0x258ca(%rip), %r12     # 0x2dc60
movl 0x50(%r12), %ebx
decl %ebx
leaq 0x2863c(%rip), %r13     # 0x309e0
movl 0x54(%r12), %ebp
addl $-0x2, %ebp
incl %ebp
movl %ebp, %edi
movl %ebx, %esi
callq 0x9514
movl %eax, %r14d
movsbl %al, %r15d
movl %r15d, %edi
callq 0xe4fd
testb %al, %al
je 0x8408
movl %ebp, %edi
movl %ebx, %esi
xorl %eax, %eax
callq 0xf4ea
testq %rax, %rax
je 0x8528
movq %rax, %r14
testb $0x8, 0x10(%rax)
jne 0x8528
movq (%r13), %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0x6490
cmpl $-0x1, %eax
je 0x847b
movq (%r13), %rdi
callq 0x6330
jmp 0x8480
cmpb $0x26, %r14b
jne 0x851d
movl $0x64, %edi
xorl %eax, %eax
callq 0xc72d
movl %eax, %r14d
leaq 0x25938(%rip), %rax     # 0x2dd60
movq (%rax), %rdi
movl 0x28(%rdi), %r15d
callq 0x1214b
leal (%rax,%rax,4), %eax
leal (%rax,%r15,4), %eax
cmpl %eax, %r14d
jge 0x851d
movq 0x21ae5(%rip), %r14     # 0x29f30
movq (%r14), %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0x6490
cmpl $-0x1, %eax
je 0x8469
movq (%r14), %rdi
movl $0x2b, %esi
callq 0x64c0
leaq 0x25414(%rip), %rax     # 0x2d884
movl $0x0, (%rax)
jmp 0x851d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %r15d, %eax
je 0x8528
movl $0x64, %edi
xorl %eax, %eax
callq 0xc72d
movl %eax, 0x4(%rsp)
leaq 0x258c0(%rip), %rax     # 0x2dd60
movq (%rax), %rdi
movl 0x28(%rdi), %eax
movq %rbx, %r15
movq %r13, %rbx
movq %r12, %r13
leal (%rax,%rax,8), %r12d
callq 0x1214b
leal (%rax,%rax,4), %eax
addl %r12d, %eax
movq %r13, %r12
movq %rbx, %r13
movq %r15, %rbx
cmpl %eax, 0x4(%rsp)
jg 0x8528
orb $0x8, 0x10(%r14)
movq (%r13), %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0x6490
cmpl $-0x1, %eax
je 0x84f2
movq (%r13), %rdi
movsbl 0x14(%r14), %esi
callq 0x64c0
leaq 0x2538b(%rip), %rax     # 0x2d884
movl $0x0, (%rax)
leaq 0x25396(%rip), %rax     # 0x2d89c
movb $0x0, (%rax)
movsbl 0x14(%r14), %edi
callq 0xcb0c
movq %rax, %rdi
xorl %eax, %eax
callq 0xb6e0
cmpl 0x54(%r12), %ebp
jle 0x83ac
leal 0x1(%rbx), %eax
cmpl 0x50(%r12), %ebx
movl %eax, %ebx
jle 0x83a4
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq