// File: /workspace/github_c_makefile_star2_O2/9wm[P]9wm/event.c
// Function: mapreq
void
mapreq(XMapRequestEvent * e)
{
	Client *c;
	int i;

	curtime = CurrentTime;
	c = getclient(e->window, 0);
	trace("mapreq", c, e);

	if (c == 0 || c->window != e->window) {
		/*
		 * workaround for stupid NCDware 
		 */
		fprintf(stderr, "9wm: bad mapreq c %p w %x, rescanning\n", (void *) c, (int) e->window);
		for (i = 0; i < num_screens; i++)
			scanwins(&screens[i]);
		c = getclient(e->window, 0);
		if (c == 0 || c->window != e->window) {
			fprintf(stderr, "9wm: window not found after rescan\n");
			return;
		}
	}

	switch (c->state) {
	case WithdrawnState:
		if (c->parent == c->screen->root) {
			if (!manage(c, 0))
				return;
			break;
		}
		XReparentWindow(dpy, c->window, c->parent, BORDER - 1, BORDER - 1);
		XAddToSaveSet(dpy, c->window);
		/*
		 * fall through... 
		 */
	case NormalState:
		XMapWindow(dpy, c->window);
		XMapRaised(dpy, c->parent);
		top(c);
		setwstate(c, NormalState);
		if (c->trans != None && current && c->trans == current->window)
			active(c);
		break;
	case IconicState:
		unhidec(c, 1);
		break;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x829b(%rip), %rax      # 0xb9a8
andl $0x0, (%rax)
movq 0x28(%rdi), %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x5576
movq %rax, %rbx
movq 0x28(%r14), %rcx
testq %rax, %rax
je 0x3849
cmpq %rcx, (%rbx)
jne 0x3849
movl 0x98(%rbx), %eax
cmpl $0x3, %eax
je 0x3779
cmpl $0x1, %eax
je 0x37c4
testl %eax, %eax
jne 0x383a
movq 0x8(%rbx), %rdx
movq 0xf8(%rbx), %rax
cmpq 0x8(%rax), %rdx
jne 0x3794
movq %rbx, %rdi
xorl %esi, %esi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x403c
pushq $0x1
popq %rsi
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5160
leaq 0x81ed(%rip), %r14      # 0xb988
movq (%r14), %rdi
leaq 0x7b8b(%rip), %rax      # 0xb330
movl (%rax), %r8d
decl %r8d
movq %rcx, %rsi
movl %r8d, %ecx
callq 0x2050
movq (%r14), %rdi
movq (%rbx), %rsi
callq 0x2440
movq (%rbx), %rcx
leaq 0x81bd(%rip), %r14      # 0xb988
movq (%r14), %rdi
movq %rcx, %rsi
callq 0x24d0
movq (%r14), %rdi
movq 0x8(%rbx), %rsi
callq 0x2350
movq %rbx, %rdi
xorl %eax, %eax
callq 0x5526
pushq $0x1
popq %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x49e8
movq 0x10(%rbx), %rax
testq %rax, %rax
setne %dl
leaq 0x8336(%rip), %rcx      # 0xbb40
movq (%rcx), %rcx
testq %rcx, %rcx
setne %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x383a
cmpq (%rcx), %rax
jne 0x383a
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5367
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x77a8(%rip), %r15      # 0xaff8
movq (%r15), %rdi
leaq 0x3c7c(%rip), %rsi      # 0x74d6
movq %rbx, %rdx
xorl %eax, %eax
callq 0x22c0
leaq 0x81ad(%rip), %rbx      # 0xba18
leaq 0x81ae(%rip), %r12      # 0xba20
xorl %r13d, %r13d
xorl %ebp, %ebp
movslq (%rbx), %rax
cmpq %rax, %rbp
jge 0x3899
movq (%r12), %rdi
addq %r13, %rdi
xorl %eax, %eax
callq 0x4427
incq %rbp
addq $0x178, %r13            # imm = 0x178
jmp 0x3877
movq 0x28(%r14), %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x5576
testq %rax, %rax
je 0x38bb
movq %rax, %rbx
movq (%rax), %rcx
cmpq 0x28(%r14), %rcx
je 0x3736
movq (%r15), %rcx
leaq 0x3c38(%rip), %rdi      # 0x74fd
pushq $0x23
popq %rsi
pushq $0x1
popq %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2540