// File: /workspace/github_c_makefile_star2_O3/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 0x9513
testb %al, %al
jne 0x8468
leaq 0x2599a(%rip), %r12     # 0x2dc60
movl 0x50(%r12), %ebx
decl %ebx
leaq 0x2870c(%rip), %r13     # 0x309e0
movl 0x54(%r12), %ebp
addl $-0x2, %ebp
incl %ebp
movl %ebp, %edi
movl %ebx, %esi
callq 0x9492
movl %eax, %r14d
movsbl %al, %r15d
movl %r15d, %edi
callq 0xe41e
testb %al, %al
je 0x8338
movl %ebp, %edi
movl %ebx, %esi
xorl %eax, %eax
callq 0xf3d8
testq %rax, %rax
je 0x8458
movq %rax, %r14
testb $0x8, 0x10(%rax)
jne 0x8458
movq (%r13), %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0x6490
cmpl $-0x1, %eax
je 0x83ab
movq (%r13), %rdi
callq 0x6330
jmp 0x83b0
cmpb $0x26, %r14b
jne 0x844d
movl $0x64, %edi
xorl %eax, %eax
callq 0xc674
movl %eax, %r14d
leaq 0x25a08(%rip), %rax     # 0x2dd60
movq (%rax), %rdi
movl 0x28(%rdi), %r15d
callq 0x11fbc
leal (%rax,%rax,4), %eax
leal (%rax,%r15,4), %eax
cmpl %eax, %r14d
jge 0x844d
movq 0x21bb5(%rip), %r14     # 0x29f30
movq (%r14), %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0x6490
cmpl $-0x1, %eax
je 0x8399
movq (%r14), %rdi
movl $0x2b, %esi
callq 0x64c0
leaq 0x254e4(%rip), %rax     # 0x2d884
movl $0x0, (%rax)
jmp 0x844d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %r15d, %eax
je 0x8458
movl $0x64, %edi
xorl %eax, %eax
callq 0xc674
movl %eax, 0x4(%rsp)
leaq 0x25990(%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 0x11fbc
leal (%rax,%rax,4), %eax
addl %r12d, %eax
movq %r13, %r12
movq %rbx, %r13
movq %r15, %rbx
cmpl %eax, 0x4(%rsp)
jg 0x8458
orb $0x8, 0x10(%r14)
movq (%r13), %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0x6490
cmpl $-0x1, %eax
je 0x8422
movq (%r13), %rdi
movsbl 0x14(%r14), %esi
callq 0x64c0
leaq 0x2545b(%rip), %rax     # 0x2d884
movl $0x0, (%rax)
leaq 0x25466(%rip), %rax     # 0x2d89c
movb $0x0, (%rax)
movsbl 0x14(%r14), %edi
callq 0xca54
movq %rax, %rdi
xorl %eax, %eax
callq 0xb620
cmpl 0x54(%r12), %ebp
jle 0x82dc
leal 0x1(%rbx), %eax
cmpl 0x50(%r12), %ebx
movl %eax, %ebx
jle 0x82d4
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq