// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %r14
leaq 0x7f2b(%rip), %rax      # 0xb9a8
movl $0x0, (%rax)
movq 0x28(%rdi), %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x58ca
movq %rax, %rbx
movq 0x28(%r14), %rcx
testq %rax, %rax
je 0x3baa
cmpq %rcx, (%rbx)
jne 0x3baa
movl 0x98(%rbx), %eax
cmpl $0x3, %eax
je 0x3ae7
cmpl $0x1, %eax
je 0x3b2f
testl %eax, %eax
jne 0x3c24
movq 0x8(%rbx), %rdx
movq 0xf8(%rbx), %rax
cmpq 0x8(%rax), %rdx
jne 0x3aff
movq %rbx, %rdi
xorl %esi, %esi
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x42e0
movq %rbx, %rdi
movl $0x1, %esi
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x54dd
leaq 0x7e82(%rip), %r14      # 0xb988
movq (%r14), %rdi
leaq 0x7820(%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 0x7e52(%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 0x5866
movq %rbx, %rdi
movl $0x1, %esi
xorl %eax, %eax
callq 0x4dad
movq 0x10(%rbx), %rax
testq %rax, %rax
setne %dl
leaq 0x7fc9(%rip), %rcx      # 0xbb40
movq (%rcx), %rcx
testq %rcx, %rcx
setne %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x3c24
cmpq (%rcx), %rax
jne 0x3c24
movq %rbx, %rdi
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x56cd
movq 0x7447(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x391b(%rip), %rsi      # 0x74d6
movq %rbx, %rdx
xorl %eax, %eax
callq 0x22c0
leaq 0x7e4c(%rip), %rbx      # 0xba18
cmpl $0x0, (%rbx)
jle 0x3bfd
leaq 0x7e48(%rip), %r15      # 0xba20
xorl %r12d, %r12d
xorl %r13d, %r13d
movq (%r15), %rdi
addq %r12, %rdi
xorl %eax, %eax
callq 0x477c
incq %r13
movslq (%rbx), %rax
addq $0x178, %r12            # imm = 0x178
cmpq %rax, %r13
jl 0x3bde
movq 0x28(%r14), %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x58ca
testq %rax, %rax
je 0x3c1f
movq %rax, %rbx
movq (%rax), %rcx
cmpq 0x28(%r14), %rcx
je 0x3aa9
callq 0x2793
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq