// File: /workspace/github_c_makefile_star2_O3/kek[P]evilwm/client.c
// Function: remove_client
void remove_client(Client *c) {
	LOG_ENTER("remove_client(window=%lx, %s)", c->window, c->remove ? "withdrawing" : "wm quitting");

	XGrabServer(dpy);
	ignore_xerror = 1;

	/* ICCCM 4.1.3.1
	 * "When the window is withdrawn, the window manager will either
	 *  change the state field's value to WithdrawnState or it will
	 *  remove the WM_STATE property entirely."
	 * EWMH 1.3
	 * "The Window Manager should remove the property whenever a
	 *  window is withdrawn but it should leave the property in
	 *  place when it is shutting down." (both _NET_WM_DESKTOP and
	 *  _NET_WM_STATE) */
	if (c->remove) {
		LOG_DEBUG("setting WithdrawnState\n");
		set_wm_state(c, WithdrawnState);
		ewmh_withdraw_client(c);
	} else {
		ewmh_deinit_client(c);
	}

	gravitate_border(c, -c->border);
	gravitate_border(c, c->old_border);
	c->x -= c->old_border;
	c->y -= c->old_border;
	XReparentWindow(dpy, c->window, c->screen->root, c->x, c->y);
	XSetWindowBorderWidth(dpy, c->window, c->old_border);
	XRemoveFromSaveSet(dpy, c->window);
	if (c->parent)
		XDestroyWindow(dpy, c->parent);

	clients_tab_order = list_delete(clients_tab_order, c);
	clients_mapping_order = list_delete(clients_mapping_order, c);
	clients_stacking_order = list_delete(clients_stacking_order, c);
	/* If the wm is quitting, we'll remove the client list properties
	 * soon enough, otherwise: */
	if (c->remove) {
		ewmh_set_net_client_list(c->screen);
		ewmh_set_net_client_list_stacking(c->screen);
	}

	if (current == c)
		current = NULL;  /* an enter event should set this up again */
	free(c);
#ifdef DEBUG
	{
		struct list *iter;
		int i = 0;
		for (iter = clients_tab_order; iter; iter = iter->next)
			i++;
		LOG_DEBUG("free(), window count now %d\n", i);
	}
#endif

	XUngrabServer(dpy);
	XSync(dpy, False);
	ignore_xerror = 0;
	LOG_LEAVE();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x8a58(%rip), %r14      # 0xc7e0
movq (%r14), %rdi
callq 0x34b0
leaq 0x8a8d(%rip), %r15      # 0xc824
movl $0x1, (%r15)
cmpl $0x0, 0x7c(%rbx)
je 0x3ddf
xorps %xmm0, %xmm0
movq %rsp, %rax
movaps %xmm0, (%rax)
movq (%r14), %rdi
movq (%rbx), %rsi
leaq 0x8876(%rip), %rcx      # 0xc630
movq (%rcx), %rcx
movq %rcx, %rdx
movl $0x20, %r8d
xorl %r9d, %r9d
pushq $0x2
pushq %rax
callq 0x3460
addq $0x10, %rsp
movq %rbx, %rdi
callq 0x574f
jmp 0x3de7
movq %rbx, %rdi
callq 0x5733
xorl %esi, %esi
subl 0x34(%rbx), %esi
movq %rbx, %rdi
callq 0x3bfb
movl 0x70(%rbx), %esi
movq %rbx, %rdi
callq 0x3bfb
movl 0x70(%rbx), %eax
movl 0x24(%rbx), %ecx
subl %eax, %ecx
movl %ecx, 0x24(%rbx)
movl 0x28(%rbx), %r8d
subl %eax, %r8d
movl %r8d, 0x28(%rbx)
movq (%r14), %rdi
movq (%rbx), %rsi
movq 0x10(%rbx), %rax
movq 0x8(%rax), %rdx
callq 0x3060
movq (%r14), %rdi
movq (%rbx), %rsi
movl 0x70(%rbx), %edx
callq 0x33b0
movq (%r14), %rdi
movq (%rbx), %rsi
callq 0x34d0
movq 0x8(%rbx), %rsi
testq %rsi, %rsi
je 0x3e52
movq (%r14), %rdi
callq 0x3300
leaq 0x893f(%rip), %r12      # 0xc798
movq (%r12), %rdi
movq %rbx, %rsi
callq 0x5bbc
movq %rax, (%r12)
leaq 0x8930(%rip), %r12      # 0xc7a0
movq (%r12), %rdi
movq %rbx, %rsi
callq 0x5bbc
movq %rax, (%r12)
leaq 0x8921(%rip), %r12      # 0xc7a8
movq (%r12), %rdi
movq %rbx, %rsi
callq 0x5bbc
movq %rax, (%r12)
cmpl $0x0, 0x7c(%rbx)
je 0x3eaf
movq 0x10(%rbx), %rdi
callq 0x57a0
movq 0x10(%rbx), %rdi
callq 0x5841
leaq 0x88fa(%rip), %rax      # 0xc7b0
cmpq %rbx, (%rax)
jne 0x3ec2
movq $0x0, (%rax)
movq %rbx, %rdi
callq 0x3090
movq (%r14), %rdi
callq 0x33f0
movq (%r14), %rdi
xorl %esi, %esi
callq 0x3490
movl $0x0, (%r15)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq