// File: /workspace/github_c_makefile_star2_O2/zenlinux[P]cwm/client.c
// Function: client_new
struct client_ctx *
client_new(Window win, struct screen_ctx *sc, int mapped)
{
	struct client_ctx	*cc;
	XWindowAttributes	 wattr;
	XWMHints		*wmhints;
	int			 state;

	if (win == None)
		return (NULL);

	cc = xcalloc(1, sizeof(*cc));

	XGrabServer(X_Dpy);

	cc->state = mapped ? NormalState : IconicState;
	cc->sc = sc;
	cc->win = win;
	cc->size = XAllocSizeHints();

	client_getsizehints(cc);

	TAILQ_INIT(&cc->nameq);
	client_setname(cc);

	conf_client(cc);

	/* Saved pointer position */
	cc->ptr.x = -1;
	cc->ptr.y = -1;

	XGetWindowAttributes(X_Dpy, cc->win, &wattr);
	cc->geom.x = wattr.x;
	cc->geom.y = wattr.y;
	cc->geom.w = wattr.width;
	cc->geom.h = wattr.height;
	cc->cmap = wattr.colormap;

	if (wattr.map_state != IsViewable) {
		client_placecalc(cc);
		if ((wmhints = XGetWMHints(X_Dpy, cc->win)) != NULL) {
			if (wmhints->flags & StateHint)
				xu_setstate(cc, wmhints->initial_state);

			XFree(wmhints);
		}
		client_move(cc);
	}
	client_draw_border(cc);

	if (xu_getstate(cc, &state) < 0)
		state = NormalState;

	XSelectInput(X_Dpy, cc->win, ColormapChangeMask | EnterWindowMask |
	    PropertyChangeMask | KeyReleaseMask);

	XAddToSaveSet(X_Dpy, cc->win);

	client_transient(cc);

	/* Notify client of its configuration. */
	xu_configure(cc);

	(state == IconicState) ? client_hide(cc) : client_unhide(cc);
	xu_setstate(cc, cc->state);

	XSync(X_Dpy, False);
	XUngrabServer(X_Dpy);

	TAILQ_INSERT_TAIL(&sc->mruq, cc, mru_entry);
	TAILQ_INSERT_TAIL(&Clientq, cc, entry);

	xu_ewmh_net_client_list(sc);

	client_gethints(cc);
	client_update(cc);

	if (mapped)
		group_autogroup(cc);

	return (cc);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
testq %rdi, %rdi
je 0x61b9
movl %edx, %r12d
movq %rsi, %r14
movq %rdi, %r15
pushq $0x1
popq %rdi
movl $0x108, %esi            # imm = 0x108
callq 0x6032
movq %rax, %rbx
leaq 0x10784(%rip), %rbp     # 0x16848
movq (%rbp), %rdi
callq 0x5120
xorl %eax, %eax
testl %r12d, %r12d
sete %al
leal 0x1(%rax,%rax), %eax
movl %eax, 0xac(%rbx)
movq %r14, 0x30(%rbx)
movq %r15, 0x38(%rbx)
callq 0x5750
movq %rax, 0x40(%rbx)
movq %rbx, %rdi
callq 0x650f
leaq 0xc0(%rbx), %rax
andq $0x0, 0xc0(%rbx)
movq %rax, 0xc8(%rbx)
movq %rbx, %rdi
callq 0x660e
movq %rbx, %rdi
callq 0x96da
orq $-0x1, 0x9c(%rbx)
movq (%rbp), %rdi
movq 0x38(%rbx), %rsi
leaq 0x20(%rsp), %r15
movq %r15, %rdx
callq 0x5710
movdqa (%r15), %xmm0
movdqu %xmm0, 0x54(%rbx)
movq 0x50(%r15), %rax
movq %rax, 0x48(%rbx)
cmpl $0x2, 0x5c(%r15)
je 0x6350
movq 0x30(%rbx), %r15
movq 0x40(%rbx), %rax
testb $0x5, (%rax)
je 0x61c0
movl 0x50(%rbx), %edx
addl %edx, %edx
negl %edx
pshufd $0xff, %xmm0, %xmm1     # xmm1 = xmm0[3,3,3,3]
movd %xmm1, %esi
movl %edx, %ecx
subl %esi, %ecx
addl 0xb0(%r15), %ecx
movl 0x8(%rax), %esi
testl %esi, %esi
jle 0x61a1
pshufd $0xee, %xmm0, %xmm0     # xmm0 = xmm0[2,3,2,3]
movd %xmm0, %edi
subl %edi, %edx
addl 0xac(%r15), %edx
cmpl %edx, %esi
cmovll %esi, %edx
movl %edx, 0x54(%rbx)
movl 0xc(%rax), %eax
testl %eax, %eax
jle 0x631a
cmpl %ecx, %eax
cmovll %eax, %ecx
movl %ecx, 0x58(%rbx)
jmp 0x631a
xorl %ebx, %ebx
jmp 0x64fa
movl %r12d, (%rsp)
movq 0x18(%r15), %rdi
leaq 0x10(%rsp), %r12
leaq 0x8(%rsp), %r13
movq %r12, %rsi
movq %r13, %rdx
callq 0x85b2
movl (%r12), %esi
movl (%r13), %edx
movq %r15, %rdi
callq 0x5ef3
testq %rax, %rax
je 0x620d
movswl 0x4(%rax), %r10d
movswl 0x6(%rax), %r8d
movswl 0x8(%rax), %r12d
addl %r10d, %r12d
movswl 0xa(%rax), %esi
addl %r8d, %esi
jmp 0x6221
movl 0xac(%r15), %r12d
movl 0xb0(%r15), %esi
xorl %r10d, %r10d
xorl %r8d, %r8d
movl 0x50(%rbx), %r9d
movl 0x5c(%rbx), %r13d
movl 0x8(%rsp), %r11d
cmpl %r8d, %r11d
cmovlel %r8d, %r11d
movl 0x60(%rbx), %edi
pushq $-0x2
popq %rcx
movl %edi, %eax
cltd
idivl %ecx
movl %eax, %ecx
movl %r13d, %eax
addl %r11d, %ecx
cmpl %r8d, %ecx
cmovlel %r8d, %ecx
addl %r9d, %r9d
movl %r12d, %r13d
subl %eax, %r13d
subl %r9d, %r13d
movl %esi, %r11d
subl %edi, %r11d
subl %r9d, %r11d
cmpl %r10d, %r13d
jge 0x6284
movl 0xcc(%r15), %eax
addl %eax, %r10d
movl %r10d, 0x54(%rbx)
subl %eax, %r12d
movl %r12d, 0x5c(%rbx)
movl (%rsp), %r12d
jmp 0x62d1
cltd
pushq $-0x2
popq %rdi
idivl %edi
movl 0x10(%rsp), %edx
cmpl %r10d, %edx
cmovlel %r10d, %edx
addl %eax, %edx
cmpl %r10d, %edx
cmovlel %r10d, %edx
cmpl %r13d, %edx
cmovgel %r13d, %edx
addl 0xcc(%r15), %r10d
cmpl %r10d, %edx
cmovgl %edx, %r10d
movl %r10d, 0x54(%rbx)
movl 0xd0(%r15), %eax
subl %eax, %r13d
cmpl %r13d, %r10d
movl (%rsp), %r12d
jle 0x62d1
subl %eax, %r10d
movl %r10d, 0x54(%rbx)
cmpl %r8d, %r11d
jge 0x62eb
movl 0xc4(%r15), %eax
addl %eax, %r8d
movl %r8d, 0x58(%rbx)
subl %eax, %esi
movl %esi, 0x60(%rbx)
jmp 0x631a
cmpl %r11d, %ecx
cmovgel %r11d, %ecx
addl 0xc4(%r15), %r8d
cmpl %r8d, %ecx
cmovgl %ecx, %r8d
movl %r8d, 0x58(%rbx)
movl 0xc8(%r15), %eax
subl %eax, %r11d
cmpl %r11d, %r8d
jle 0x631a
subl %eax, %r8d
movl %r8d, 0x58(%rbx)
movq (%rbp), %rdi
movq 0x38(%rbx), %rsi
callq 0x54f0
testq %rax, %rax
je 0x6348
movq %rax, %r15
testb $0x2, (%rax)
je 0x6340
movl 0xc(%r15), %esi
movq %rbx, %rdi
callq 0x89ba
movq %r15, %rdi
callq 0x5060
movq %rbx, %rdi
callq 0x677b
movq %rbx, %rdi
callq 0x67a1
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq 0x8974
testl %eax, %eax
jns 0x6371
movl $0x1, 0x4(%rsp)
movq (%rbp), %rdi
movq 0x38(%rbx), %rsi
movl $0xc00012, %edx         # imm = 0xC00012
callq 0x5560
movq (%rbp), %rdi
movq 0x38(%rbx), %rsi
callq 0x53b0
movq %rbx, %rdi
callq 0x6806
movq %rbx, %rdi
callq 0x8763
cmpl $0x3, 0x4(%rsp)
jne 0x63b1
movq %rbx, %rdi
callq 0x686a
jmp 0x63b9
movq %rbx, %rdi
callq 0x68af
movl 0xac(%rbx), %esi
movq %rbx, %rdi
callq 0x89ba
movq (%rbp), %rdi
xorl %esi, %esi
callq 0x55b0
movq (%rbp), %rdi
callq 0x5420
movq %rbx, %rax
addq $0x20, %rax
andq $0x0, 0x20(%rbx)
movq 0xe0(%r14), %rcx
movq %rcx, 0x28(%rbx)
movq %rbx, (%rcx)
movq %rax, 0xe0(%r14)
andq $0x0, (%rbx)
leaq 0xe079(%rip), %rax      # 0x14480
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rbx)
movq %rbx, (%rcx)
movq %rbx, 0x8(%rax)
movq %r14, %rdi
callq 0x8c56
movq (%rbp), %rdi
movq 0x38(%rbx), %rsi
leaq 0x10(%rsp), %rdx
callq 0x53d0
testl %eax, %eax
je 0x6456
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x6445
movq %rax, 0x100(%rbx)
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x6456
movq %rax, 0xf8(%rbx)
movq 0x38(%rbx), %rdi
leaq 0xe02f(%rip), %r14      # 0x14490
movq 0x48(%r14), %rsi
pushq $0x4
popq %rdx
pushq $0x3
popq %rcx
leaq 0x8(%rsp), %r8
callq 0x8825
cmpl $0x3, %eax
jne 0x648e
movq 0x8(%rsp), %rax
testb $0x2, (%rax)
je 0x648e
testb $0x3, 0x10(%rax)
jne 0x648e
andl $0x0, 0x50(%rbx)
movq 0x38(%rbx), %rdi
movq 0x38(%r14), %rsi
pushq $0x4
popq %rdx
pushq $0x14
popq %rcx
leaq 0x10(%rsp), %r8
callq 0x8825
testl %eax, %eax
jle 0x64ed
movq 0x10(%rsp), %rdi
movq 0x18(%r14), %rcx
movq 0x28(%r14), %rdx
movl %eax, %eax
xorl %esi, %esi
pushq $0x1
popq %r8
pushq $0x2
popq %r9
cmpq %rsi, %rax
je 0x64e8
movq (%rdi,%rsi,8), %r11
movl %r8d, %r10d
cmpq %rcx, %r11
je 0x64dc
movl %r9d, %r10d
cmpq %rdx, %r11
jne 0x64e3
orl %r10d, 0xa4(%rbx)
incq %rsi
jmp 0x64c3
callq 0x5060
testl %r12d, %r12d
je 0x64fa
movq %rbx, %rdi
callq 0xa75f
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq