// File: /workspace/github_c_makefile_star2_O0/ajpaulson[P]srogue11/move.c
// Function: light
int light(struct coord *cp)
{
	struct room *rp;
	int j, k, x, y;
	unsigned long ch, rch;
	struct linked_list *item;

	rp = roomin(cp);
	if (rp == NULL)
		return 0;
	if (pl_on(ISBLIND)) {
		for (j = 0; j < rp->r_max.y; j += 1) {
			for (k = 0; k < rp->r_max.x; k += 1) {
				y = rp->r_pos.y + j;
				x = rp->r_pos.x + k;
				mvwaddch(cw, y, x, ' ');
			}
		}
		look(FALSE);
		return 0;
	}
	if (iswearing(R_LIGHT))
		rp->r_flags &= ~ISDARK;
	for (j = 0; j < rp->r_max.y; j += 1) {
		for (k = 0; k < rp->r_max.x; k += 1) {
			y = rp->r_pos.y + j;
			x = rp->r_pos.x + k;
			if (levtype == MAZELEV && !cansee(y, x))
				continue;
			ch = show(y, x);
			wmove(cw, y, x);
			/*
			 * Figure out how to display a secret door
			 */
			if (ch == SECRETDOOR) {
				if (j == 0 || j == rp->r_max.y - 1)
					ch = '-';
				else
					ch = '|';
			}
			if (isalpha(ch)) {
				struct thing *mit;

				item = wake_monster(y, x);
				if (item == NULL) {
					ch = FLOOR;
					mvaddch(y, x, ch);
				}
				else {
					mit = THINGPTR(item);
					if (mit->t_oldch == ' ')
						if (!rf_on(rp,ISDARK))
							mit->t_oldch = mvinch(y, x);
					if (levtype == MAZELEV)
						ch = mvinch(y, x);
				}
			}
			if (rf_on(rp,ISDARK)) {
				rch = mvwinch(cw, y, x);
				if (isatrap(rch)) {
					ch = rch;			/* if its a trap */
				}
				else {					/* try other things */
					switch (rch) {
						case DOOR:	case STAIRS:	case '|':
						case '-':
							ch = rch;
						otherwise:
							ch = ' ';
					}
				}
			}
			mvwaddch(cw, y, x, ch);
		}
	}
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x7560
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x123dc
movl $0x0, -0x4(%rbp)
jmp 0x127b5
movl $0x1, %edi
callq 0xaa60
testb $0x1, %al
jne 0x123ef
jmp 0x12489
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x12476
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x12469
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
leaq 0x27a1b(%rip), %rax     # 0x39e50
movq (%rax), %rdi
movl -0x28(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0x6490
cmpl $-0x1, %eax
jne 0x1244a
jmp 0x1245e
leaq 0x279ff(%rip), %rax     # 0x39e50
movq (%rax), %rdi
movl $0x20, %esi
callq 0x64c0
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x12409
jmp 0x1246b
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x123f6
xorl %edi, %edi
callq 0xf540
movl $0x0, -0x4(%rbp)
jmp 0x127b5
movl $0x16, %edi
callq 0x18220
testb $0x1, %al
jne 0x12499
jmp 0x124a6
movq -0x18(%rbp), %rax
movl 0x5c(%rax), %ecx
andl $-0x2, %ecx
movl %ecx, 0x5c(%rax)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x127ae
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x1279e
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
leaq 0x247e0(%rip), %rax     # 0x36cd4
cmpl $0x2, (%rax)
jne 0x1250d
movl -0x28(%rbp), %edi
movl -0x24(%rbp), %esi
callq 0x7480
testb $0x1, %al
jne 0x1250d
jmp 0x12790
movl -0x28(%rbp), %edi
movl -0x24(%rbp), %esi
callq 0x118c0
movsbq %al, %rax
movq %rax, -0x30(%rbp)
leaq 0x27929(%rip), %rax     # 0x39e50
movq (%rax), %rdi
movl -0x28(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0x6490
cmpq $0x26, -0x30(%rbp)
jne 0x12567
cmpl $0x0, -0x1c(%rbp)
je 0x12553
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
movl 0xc(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1255d
movq $0x2d, -0x30(%rbp)
jmp 0x12565
movq $0x7c, -0x30(%rbp)
jmp 0x12567
callq 0x65b0
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x126a3
movl -0x28(%rbp), %edi
movl -0x24(%rbp), %esi
movb $0x0, %al
callq 0x10a00
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x125de
movq $0x2e, -0x30(%rbp)
movq 0x20a11(%rip), %rax     # 0x32fc0
movq (%rax), %rdi
movl -0x28(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0x6490
cmpl $-0x1, %eax
jne 0x125c4
jmp 0x125d9
movq 0x209f5(%rip), %rax     # 0x32fc0
movq (%rax), %rdi
movq -0x30(%rbp), %rax
movl %eax, %esi
callq 0x64c0
jmp 0x126a1
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movsbl 0x8f(%rax), %eax
cmpl $0x20, %eax
jne 0x12654
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x19950
cmpl $0x0, %eax
jne 0x12652
movq 0x209ac(%rip), %rax     # 0x32fc0
movq (%rax), %rdi
movl -0x28(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0x6490
cmpl $-0x1, %eax
jne 0x12631
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x4c(%rbp)
jmp 0x12643
movq 0x20988(%rip), %rax     # 0x32fc0
movq (%rax), %rdi
callq 0x6340
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movb %al, %cl
movq -0x48(%rbp), %rax
movb %cl, 0x8f(%rax)
jmp 0x12654
leaq 0x24679(%rip), %rax     # 0x36cd4
cmpl $0x2, (%rax)
jne 0x1269f
movq 0x20959(%rip), %rax     # 0x32fc0
movq (%rax), %rdi
movl -0x28(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0x6490
cmpl $-0x1, %eax
jne 0x12684
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x50(%rbp)
jmp 0x12696
movq 0x20935(%rip), %rax     # 0x32fc0
movq (%rax), %rdi
callq 0x6340
movl %eax, -0x50(%rbp)
movl -0x50(%rbp), %eax
movl %eax, %eax
movq %rax, -0x30(%rbp)
jmp 0x126a1
jmp 0x126a3
movq -0x18(%rbp), %rdi
movl $0x1, %esi
callq 0x19950
cmpl $0x0, %eax
je 0x1275f
leaq 0x2778f(%rip), %rax     # 0x39e50
movq (%rax), %rdi
movl -0x28(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0x6490
cmpl $-0x1, %eax
jne 0x126de
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x54(%rbp)
jmp 0x126f0
leaq 0x2776b(%rip), %rax     # 0x39e50
movq (%rax), %rdi
callq 0x6340
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movl %eax, %eax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movsbl %al, %edi
callq 0x11a80
testb $0x1, %al
jne 0x1270b
jmp 0x12715
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x1275d
movq -0x38(%rbp), %rax
movq %rax, -0x60(%rbp)
subq $0x25, %rax
je 0x12749
jmp 0x12725
movq -0x60(%rbp), %rax
subq $0x2b, %rax
je 0x12749
jmp 0x12731
movq -0x60(%rbp), %rax
subq $0x2d, %rax
je 0x12749
jmp 0x1273d
movq -0x60(%rbp), %rax
subq $0x7c, %rax
jne 0x12753
jmp 0x12749
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x1275b
movq $0x20, -0x30(%rbp)
jmp 0x1275d
jmp 0x1275f
leaq 0x276ea(%rip), %rax     # 0x39e50
movq (%rax), %rdi
movl -0x28(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0x6490
cmpl $-0x1, %eax
jne 0x1277b
jmp 0x12790
leaq 0x276ce(%rip), %rax     # 0x39e50
movq (%rax), %rdi
movq -0x30(%rbp), %rax
movl %eax, %esi
callq 0x64c0
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x124c4
jmp 0x127a0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x124ad
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nop