// File: /workspace/github_c_makefile_star2_O2/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
pushq %rax
movq %rdi, %rbx
leaq 0x9c1e(%rip), %r14      # 0xd7e0
movq (%r14), %rdi
callq 0x34b0
leaq 0x9c53(%rip), %r15      # 0xd824
movl $0x1, (%r15)
cmpl $0x0, 0x7c(%rbx)
je 0x3bf2
movq %rbx, %rdi
xorl %esi, %esi
callq 0x38b4
movq %rbx, %rdi
callq 0x546b
jmp 0x3bfa
movq %rbx, %rdi
callq 0x544f
xorl %esi, %esi
subl 0x34(%rbx), %esi
movq %rbx, %rdi
callq 0x3a3e
movl 0x70(%rbx), %esi
movq %rbx, %rdi
callq 0x3a3e
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 0x3c65
movq (%r14), %rdi
callq 0x3300
leaq 0x9b2c(%rip), %r12      # 0xd798
movq (%r12), %rdi
movq %rbx, %rsi
callq 0x5871
movq %rax, (%r12)
leaq 0x9b1d(%rip), %r12      # 0xd7a0
movq (%r12), %rdi
movq %rbx, %rsi
callq 0x5871
movq %rax, (%r12)
leaq 0x9b0e(%rip), %r12      # 0xd7a8
movq (%r12), %rdi
movq %rbx, %rsi
callq 0x5871
movq %rax, (%r12)
cmpl $0x0, 0x7c(%rbx)
je 0x3cc2
movq 0x10(%rbx), %rdi
callq 0x54bc
movq 0x10(%rbx), %rdi
callq 0x555a
leaq 0x9ae7(%rip), %rax      # 0xd7b0
cmpq %rbx, (%rax)
jne 0x3cd2
andq $0x0, (%rax)
movq %rbx, %rdi
callq 0x3090
movq (%r14), %rdi
callq 0x33f0
movq (%r14), %rdi
xorl %esi, %esi
callq 0x3490
andl $0x0, (%r15)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq