// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
leaq 0xbacd(%rip), %rax      # 0xf980
movq (%rax), %rdi
callq 0x34d0
leaq 0xbb02(%rip), %rax      # 0xf9c4
movl $0x1, (%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x7c(%rax)
je 0x3ee8
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x3940
movq -0x8(%rbp), %rdi
callq 0x6610
jmp 0x3ef1
movq -0x8(%rbp), %rdi
callq 0x65e0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
xorl %esi, %esi
subl 0x34(%rax), %esi
callq 0x3bf0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movl 0x70(%rax), %esi
callq 0x3bf0
movq -0x8(%rbp), %rax
movl 0x70(%rax), %edx
movq -0x8(%rbp), %rax
movl 0x24(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x24(%rax)
movq -0x8(%rbp), %rax
movl 0x70(%rax), %edx
movq -0x8(%rbp), %rax
movl 0x28(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x28(%rax)
leaq 0xba40(%rip), %rax      # 0xf980
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rdx
movq -0x8(%rbp), %rax
movl 0x24(%rax), %ecx
movq -0x8(%rbp), %rax
movl 0x28(%rax), %r8d
callq 0x3060
leaq 0xba0f(%rip), %rax      # 0xf980
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x8(%rbp), %rax
movl 0x70(%rax), %edx
callq 0x33d0
leaq 0xb9f2(%rip), %rax      # 0xf980
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rsi
callq 0x34f0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x3fbf
leaq 0xb9d1(%rip), %rax      # 0xf980
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x3320
leaq 0xb972(%rip), %rax      # 0xf938
movq (%rax), %rdi
movq -0x8(%rbp), %rsi
callq 0x6d90
movq %rax, %rcx
leaq 0xb95c(%rip), %rax      # 0xf938
movq %rcx, (%rax)
leaq 0xb95a(%rip), %rax      # 0xf940
movq (%rax), %rdi
movq -0x8(%rbp), %rsi
callq 0x6d90
movq %rax, %rcx
leaq 0xb944(%rip), %rax      # 0xf940
movq %rcx, (%rax)
leaq 0xb942(%rip), %rax      # 0xf948
movq (%rax), %rdi
movq -0x8(%rbp), %rsi
callq 0x6d90
movq %rax, %rcx
leaq 0xb92c(%rip), %rax      # 0xf948
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x7c(%rax)
je 0x4043
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x66a0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x67e0
leaq 0xb906(%rip), %rax      # 0xf950
movq (%rax), %rax
cmpq -0x8(%rbp), %rax
jne 0x4061
leaq 0xb8f6(%rip), %rax      # 0xf950
movq $0x0, (%rax)
movq -0x8(%rbp), %rdi
callq 0x3090
leaq 0xb90f(%rip), %rax      # 0xf980
movq (%rax), %rdi
callq 0x3410
leaq 0xb900(%rip), %rax      # 0xf980
movq (%rax), %rdi
xorl %esi, %esi
callq 0x34b0
leaq 0xb933(%rip), %rax      # 0xf9c4
movl $0x0, (%rax)
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)