// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x8b35(%rip), %rax      # 0xc998
movl $0x0, (%rax)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
xorl %esi, %esi
movb $0x0, %al
callq 0x6e90
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x3e9a
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x28(%rcx), %rax
je 0x3f4b
movq 0x8157(%rip), %rax      # 0xbff8
movq (%rax), %rdi
movq -0x10(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl %eax, %ecx
leaq 0x561d(%rip), %rsi      # 0x94d6
movb $0x0, %al
callq 0x22b0
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
leaq 0x8b37(%rip), %rcx      # 0xca08
cmpl (%rcx), %eax
jge 0x3eff
leaq 0x8b34(%rip), %rax      # 0xca10
movq (%rax), %rdi
movslq -0x14(%rbp), %rax
imulq $0x178, %rax, %rax      # imm = 0x178
addq %rax, %rdi
movb $0x0, %al
callq 0x5280
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3ec7
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
xorl %esi, %esi
movb $0x0, %al
callq 0x6e90
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x3f2c
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x28(%rcx), %rax
je 0x3f49
movq 0x80c5(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x55c0(%rip), %rsi      # 0x94fd
movb $0x0, %al
callq 0x22b0
jmp 0x4094
jmp 0x3f4b
movq -0x10(%rbp), %rax
movl 0x98(%rax), %eax
movl %eax, -0x18(%rbp)
testl %eax, %eax
je 0x3f7d
jmp 0x3f5e
movl -0x18(%rbp), %eax
subl $0x1, %eax
je 0x4000
jmp 0x3f6c
movl -0x18(%rbp), %eax
subl $0x3, %eax
je 0x4084
jmp 0x4094
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0xf8(%rcx), %rcx
cmpq 0x8(%rcx), %rax
jne 0x3fb2
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movb $0x0, %al
callq 0x4c00
cmpl $0x0, %eax
jne 0x3fad
jmp 0x4094
jmp 0x4094
leaq 0x89bf(%rip), %rax      # 0xc978
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x834e(%rip), %rax      # 0xc320
movl (%rax), %ecx
subl $0x1, %ecx
leaq 0x8342(%rip), %rax      # 0xc320
movl (%rax), %r8d
subl $0x1, %r8d
callq 0x2050
leaq 0x8987(%rip), %rax      # 0xc978
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x2430
leaq 0x8971(%rip), %rax      # 0xc978
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x24c0
leaq 0x895b(%rip), %rax      # 0xc978
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x2340
movq -0x10(%rbp), %rdi
movb $0x0, %al
callq 0x6df0
movq -0x10(%rbp), %rdi
movl $0x1, %esi
movb $0x0, %al
callq 0x5d00
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x4082
leaq 0x8ad6(%rip), %rax      # 0xcb30
cmpq $0x0, (%rax)
je 0x4082
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
leaq 0x8ac1(%rip), %rcx      # 0xcb30
movq (%rcx), %rcx
cmpq (%rcx), %rax
jne 0x4082
movq -0x10(%rbp), %rdi
movb $0x0, %al
callq 0x6b40
jmp 0x4094
movq -0x10(%rbp), %rdi
movl $0x1, %esi
movb $0x0, %al
callq 0x67e0
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)