// File: /workspace/github_c_makefile_star2_O1/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 0x6342
movl %edx, %r12d
movq %rsi, %r14
movq %rdi, %r15
movl $0x1, %edi
movl $0x108, %esi            # imm = 0x108
callq 0x61a8
movq %rax, %rbx
leaq 0x10613(%rip), %rbp     # 0x16858
movq (%rbp), %rdi
callq 0x5120
xorl %eax, %eax
testl %r12d, %r12d
sete %al
leal 0x1(,%rax,2), %eax
movl %eax, 0xac(%rbx)
movq %r14, 0x30(%rbx)
movq %r15, 0x38(%rbx)
callq 0x5760
movq %rax, 0x40(%rbx)
movq %rbx, %rdi
callq 0x66b1
leaq 0xc0(%rbx), %rax
movq $0x0, 0xc0(%rbx)
movq %rax, 0xc8(%rbx)
movq %rbx, %rdi
callq 0x67e8
movq %rbx, %rdi
callq 0x9bd0
movq $-0x1, 0x9c(%rbx)
movq (%rbp), %rdi
movq 0x38(%rbx), %rsi
leaq 0x20(%rsp), %r15
movq %r15, %rdx
callq 0x5720
movl (%r15), %eax
movl %eax, 0x54(%rbx)
movl 0x4(%r15), %eax
movl %eax, 0x58(%rbx)
movl 0x8(%r15), %eax
movl %eax, 0x5c(%rbx)
movl 0xc(%r15), %edi
movl %edi, 0x60(%rbx)
movq 0x50(%r15), %rcx
movq %rcx, 0x48(%rbx)
cmpl $0x2, 0x5c(%r15)
je 0x64ea
movq 0x30(%rbx), %r15
movq 0x40(%rbx), %rcx
testb $0x5, (%rcx)
je 0x6349
movl 0x50(%rbx), %esi
addl %esi, %esi
negl %esi
movl %esi, %edx
subl %edi, %edx
addl 0xb0(%r15), %edx
movl 0x8(%rcx), %edi
testl %edi, %edi
jle 0x632a
subl %eax, %esi
addl 0xac(%r15), %esi
cmpl %esi, %edi
cmovll %edi, %esi
movl %esi, 0x54(%rbx)
movl 0xc(%rcx), %eax
testl %eax, %eax
jle 0x64a1
cmpl %edx, %eax
cmovll %eax, %edx
movl %edx, 0x58(%rbx)
jmp 0x64a1
xorl %ebx, %ebx
jmp 0x669c
movl %r12d, (%rsp)
movq 0x18(%r15), %rdi
leaq 0x10(%rsp), %r12
leaq 0x8(%rsp), %r13
movq %r12, %rsi
movq %r13, %rdx
callq 0x89e4
movl (%r12), %esi
movl (%r13), %edx
movq %r15, %rdi
callq 0x6065
testq %rax, %rax
je 0x6391
movswl 0x4(%rax), %edx
movswl 0x6(%rax), %ecx
movswl 0x8(%rax), %esi
addl %edx, %esi
movswl 0xa(%rax), %eax
addl %ecx, %eax
jmp 0x63a3
movl 0xac(%r15), %esi
movl 0xb0(%r15), %eax
xorl %edx, %edx
xorl %ecx, %ecx
movl 0x10(%rsp), %r8d
cmpl %edx, %r8d
cmovlel %edx, %r8d
movl 0x5c(%rbx), %r9d
movl %r9d, %edi
shrl $0x1f, %edi
addl %r9d, %edi
sarl %edi
subl %edi, %r8d
movl 0x8(%rsp), %edi
cmpl %ecx, %edi
cmovlel %ecx, %edi
movl %r8d, 0x10(%rsp)
movl 0x60(%rbx), %r11d
movl %r11d, %r10d
shrl $0x1f, %r10d
addl %r11d, %r10d
sarl %r10d
subl %r10d, %edi
cmpl %edx, %r8d
cmovlel %edx, %r8d
movl %r8d, 0x10(%rsp)
cmpl %ecx, %edi
cmovlel %ecx, %edi
movl %edi, 0x8(%rsp)
movl 0x50(%rbx), %r12d
addl %r12d, %r12d
movl %esi, %r10d
subl %r9d, %r10d
subl %r12d, %r10d
movl %eax, %r9d
subl %r11d, %r9d
subl %r12d, %r9d
cmpl %edx, %r10d
jge 0x642f
movl 0xcc(%r15), %r8d
addl %r8d, %edx
movl %edx, 0x54(%rbx)
subl %r8d, %esi
movl %esi, 0x5c(%rbx)
movl (%rsp), %r12d
jmp 0x645f
cmpl %r10d, %r8d
cmovgel %r10d, %r8d
addl 0xcc(%r15), %edx
cmpl %edx, %r8d
cmovgl %r8d, %edx
movl %edx, 0x54(%rbx)
movl 0xd0(%r15), %esi
subl %esi, %r10d
cmpl %r10d, %edx
movl (%rsp), %r12d
jle 0x645f
subl %esi, %edx
movl %edx, 0x54(%rbx)
cmpl %ecx, %r9d
jge 0x6477
movl 0xc4(%r15), %edx
addl %edx, %ecx
movl %ecx, 0x58(%rbx)
subl %edx, %eax
movl %eax, 0x60(%rbx)
jmp 0x64a1
cmpl %r9d, %edi
cmovgel %r9d, %edi
addl 0xc4(%r15), %ecx
cmpl %ecx, %edi
cmovgl %edi, %ecx
movl %ecx, 0x58(%rbx)
movl 0xc8(%r15), %eax
subl %eax, %r9d
cmpl %r9d, %ecx
jle 0x64a1
subl %eax, %ecx
movl %ecx, 0x58(%rbx)
movq (%rbp), %rdi
movq 0x38(%rbx), %rsi
callq 0x5500
testq %rax, %rax
je 0x64cf
movq %rax, %r15
testb $0x2, (%rax)
je 0x64c7
movl 0xc(%r15), %esi
movq %rbx, %rdi
callq 0x8e10
movq %r15, %rdi
callq 0x5060
movq (%rbp), %rdi
movq 0x38(%rbx), %rsi
movl 0x54(%rbx), %edx
movl 0x58(%rbx), %ecx
callq 0x5070
movq %rbx, %rdi
callq 0x8b8b
movq %rbx, %rdi
callq 0x6983
leaq 0x4(%rsp), %rsi
movq %rbx, %rdi
callq 0x8dc3
testl %eax, %eax
jns 0x650b
movl $0x1, 0x4(%rsp)
movq (%rbp), %rdi
movq 0x38(%rbx), %rsi
movl $0xc00012, %edx         # imm = 0xC00012
callq 0x5570
movq (%rbp), %rdi
movq 0x38(%rbx), %rsi
callq 0x53c0
movq %rbx, %rdi
callq 0x69f0
movq %rbx, %rdi
callq 0x8b8b
cmpl $0x3, 0x4(%rsp)
jne 0x654b
movq %rbx, %rdi
callq 0x6a66
jmp 0x6553
movq %rbx, %rdi
callq 0x6abc
movl 0xac(%rbx), %esi
movq %rbx, %rdi
callq 0x8e10
movq (%rbp), %rdi
xorl %r15d, %r15d
xorl %esi, %esi
callq 0x55c0
movq (%rbp), %rdi
callq 0x5430
movq %rbx, %rax
addq $0x20, %rax
movq %r15, 0x20(%rbx)
movq 0xe0(%r14), %rcx
movq %rcx, 0x28(%rbx)
movq %rbx, (%rcx)
movq %rax, 0xe0(%r14)
movq %r15, (%rbx)
leaq 0xdeee(%rip), %rax      # 0x14490
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rbx)
movq %rbx, (%rcx)
movq %rbx, 0x8(%rax)
movq %r14, %rdi
callq 0x90d4
movq (%rbp), %rdi
movq 0x38(%rbx), %rsi
leaq 0x10(%rsp), %rdx
callq 0x53e0
testl %eax, %eax
je 0x65f1
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x65e0
movq %rax, 0x100(%rbx)
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x65f1
movq %rax, 0xf8(%rbx)
movq 0x38(%rbx), %rdi
leaq 0xdea4(%rip), %r14      # 0x144a0
movq 0x48(%r14), %rsi
leaq 0x8(%rsp), %r8
movl $0x4, %edx
movl $0x3, %ecx
callq 0x8c6f
cmpl $0x3, %eax
jne 0x6630
movq 0x8(%rsp), %rax
testb $0x2, (%rax)
je 0x6630
testb $0x3, 0x10(%rax)
jne 0x6630
movl $0x0, 0x50(%rbx)
movq 0x38(%rbx), %rdi
movq 0x38(%r14), %rsi
leaq 0x10(%rsp), %r8
movl $0x4, %edx
movl $0x14, %ecx
callq 0x8c6f
testl %eax, %eax
jle 0x668f
movq 0x10(%rsp), %rdi
movq 0x18(%r14), %rcx
movq 0x28(%r14), %rdx
movl %eax, %eax
xorl %esi, %esi
movq (%rdi,%rsi,8), %r9
movl $0x1, %r8d
cmpq %rcx, %r9
je 0x667b
movl $0x2, %r8d
cmpq %rdx, %r9
jne 0x6682
orl %r8d, 0xa4(%rbx)
incq %rsi
cmpq %rsi, %rax
jne 0x6661
callq 0x5060
testl %r12d, %r12d
je 0x669c
movq %rbx, %rdi
callq 0xad8b
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq