// File: /workspace/github_c_makefile_star2_O0/kek[P]evilwm/new.c
// Function: make_new_client
void make_new_client(Window w, ScreenInfo *s) {
	Client *c;
	char *name;
	XClassHint *class;
	unsigned int window_type;

	LOG_ENTER("make_new_client(window=%lx)", w);

	XGrabServer(dpy);

	/* First a bit of interaction with the error handler due to X's
	 * tendency to batch event notifications.  We set a global variable to
	 * the id of the window we're initialising then do simple X call on
	 * that window.  If an error is raised by this (and nothing else should
	 * do so as we've grabbed the server), the error handler resets the
	 * variable indicating the window has already disappeared, so we stop
	 * trying to manage it. */
	initialising = w;
	XFetchName(dpy, w, &name);
	XSync(dpy, False);
	/* If 'initialising' is now set to None, that means doing the
	 * XFetchName raised BadWindow - the window has been removed before
	 * we got a chance to grab the server. */
	if (initialising == None) {
		LOG_DEBUG("XError occurred for initialising window - aborting...\n");
		XUngrabServer(dpy);
		LOG_LEAVE();
		return;
	}
	initialising = None;
	LOG_DEBUG("screen=%d\n", s->screen);
	LOG_DEBUG("name=%s\n", name ? name : "Untitled");
	if (name)
		XFree(name);

	window_type = ewmh_get_net_wm_window_type(w);
	/* Don't manage DESKTOP type windows */
	if (window_type & EWMH_WINDOW_TYPE_DESKTOP) {
		XMapWindow(dpy, w);
		XUngrabServer(dpy);
		return;
	}

	c = malloc(sizeof(Client));
	/* Don't crash the window manager, just fail the operation. */
	if (!c) {
		LOG_ERROR("out of memory in new_client; limping onward\n");
		LOG_LEAVE();
		XUngrabServer(dpy);
		return;
	}
	clients_tab_order = list_prepend(clients_tab_order, c);
	clients_mapping_order = list_append(clients_mapping_order, c);
	clients_stacking_order = list_append(clients_stacking_order, c);

	c->screen = s;
	c->window = w;
	c->ignore_unmap = 0;
	c->remove = 0;

	/* Ungrab the X server as soon as possible. Now that the client is
	 * malloc()ed and attached to the list, it is safe for any subsequent
	 * X calls to raise an X error and thus flag it for removal. */
	XUngrabServer(dpy);

	c->border = opt_bw;

	update_window_type_flags(c, window_type);
	init_geometry(c);

#ifdef DEBUG
	{
		struct list *iter;
		int i = 0;
		for (iter = clients_tab_order; iter; iter = iter->next)
			i++;
		LOG_DEBUG("new window %dx%d+%d+%d, wincount=%d\n", c->width, c->height, c->x, c->y, i);
	}
#endif

	XSelectInput(dpy, c->window, ColormapChangeMask | EnterWindowMask | PropertyChangeMask);

	reparent(c);

#ifdef SHAPE
	if (have_shape) {
		XShapeSelectInput(dpy, c->window, ShapeNotifyMask);
		set_shape(c);
	}
#endif

	/* Read instance/class information for client and check against list
	 * built with -app options */
	class = XAllocClassHint();
	if (class) {
		struct list *aiter = applications;
		XGetClassHint(dpy, w, class);
		while (aiter) {
			Application *a = aiter->data;
			if ((!a->res_name || (class->res_name && !strcmp(class->res_name, a->res_name)))
					&& (!a->res_class || (class->res_class && !strcmp(class->res_class, a->res_class)))) {
				if (a->geometry_mask & WidthValue)
					c->width = a->width * c->width_inc;
				if (a->geometry_mask & HeightValue)
					c->height = a->height * c->height_inc;
				if (a->geometry_mask & XValue) {
					if (a->geometry_mask & XNegative)
						c->x = a->x + DisplayWidth(dpy, s->screen)-c->width-c->border;
					else
						c->x = a->x + c->border;
				}
				if (a->geometry_mask & YValue) {
					if (a->geometry_mask & YNegative)
						c->y = a->y + DisplayHeight(dpy, s->screen)-c->height-c->border;
					else
						c->y = a->y + c->border;
				}
				moveresize(c);
				if (a->is_dock) c->is_dock = 1;
#ifdef VWM
				if (a->vdesk != VDESK_NONE) c->vdesk = a->vdesk;
#endif
			}
			aiter = aiter->next;
		}
		XFree(class->res_name);
		XFree(class->res_class);
		XFree(class);
	}
	ewmh_init_client(c);
	ewmh_set_net_client_list(c->screen);
	ewmh_set_net_client_list_stacking(c->screen);

	/* Only map the window frame (and thus the window) if it's supposed
	 * to be visible on this virtual desktop. */
#ifdef VWM
	if (is_fixed(c) || c->vdesk == s->vdesk)
#endif
	{
		client_show(c);
		client_raise(c);
#ifndef MOUSE
		select_client(c);
#ifdef WARP_POINTER
		setmouse(c->window, c->width + c->border - 1,
				c->height + c->border - 1);
#endif
		discard_enter_events(c);
#endif
	}
#ifdef VWM
	else {
		set_wm_state(c, IconicState);
	}
	ewmh_set_net_wm_desktop(c);
#endif
	LOG_LEAVE();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0x7989(%rip), %rax      # 0xf980
movq (%rax), %rdi
callq 0x34d0
movq -0x8(%rbp), %rcx
leaq 0x794e(%rip), %rax      # 0xf958
movq %rcx, (%rax)
leaq 0x796c(%rip), %rax      # 0xf980
movq (%rax), %rdi
movq -0x8(%rbp), %rsi
leaq -0x20(%rbp), %rdx
callq 0x3300
leaq 0x7955(%rip), %rax      # 0xf980
movq (%rax), %rdi
xorl %esi, %esi
callq 0x34b0
leaq 0x791c(%rip), %rax      # 0xf958
movq (%rax), %rax
cmpq $0x0, %rax
jne 0x8059
leaq 0x7934(%rip), %rax      # 0xf980
movq (%rax), %rdi
callq 0x3410
jmp 0x84cd
leaq 0x78f8(%rip), %rax      # 0xf958
movq $0x0, (%rax)
cmpq $0x0, -0x20(%rbp)
je 0x8077
movq -0x20(%rbp), %rdi
callq 0x3220
movq -0x8(%rbp), %rdi
callq 0x6a20
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x80b5
leaq 0x78eb(%rip), %rax      # 0xf980
movq (%rax), %rdi
movq -0x8(%rbp), %rsi
callq 0x3610
leaq 0x78d8(%rip), %rax      # 0xf980
movq (%rax), %rdi
callq 0x3410
jmp 0x84cd
movl $0x80, %edi
callq 0x3450
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x80f6
movq 0x6f27(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x46b1(%rip), %rsi      # 0xc78c
movb $0x0, %al
callq 0x3350
leaq 0x7897(%rip), %rax      # 0xf980
movq (%rax), %rdi
callq 0x3410
jmp 0x84cd
leaq 0x783b(%rip), %rax      # 0xf938
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x6d30
movq %rax, %rcx
leaq 0x7825(%rip), %rax      # 0xf938
movq %rcx, (%rax)
leaq 0x7823(%rip), %rax      # 0xf940
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x6d60
movq %rax, %rcx
leaq 0x780d(%rip), %rax      # 0xf940
movq %rcx, (%rax)
leaq 0x780b(%rip), %rax      # 0xf948
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x6d60
movq %rax, %rcx
leaq 0x77f5(%rip), %rax      # 0xf948
movq %rcx, (%rax)
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x20(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x7c(%rax)
leaq 0x77f6(%rip), %rax      # 0xf980
movq (%rax), %rdi
callq 0x3410
leaq 0x724f(%rip), %rax      # 0xf3e8
movl (%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x18(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x84e0
movq -0x18(%rbp), %rdi
callq 0x8510
leaq 0x77c2(%rip), %rax      # 0xf980
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movl $0xc00010, %edx         # imm = 0xC00010
callq 0x34c0
movq -0x18(%rbp), %rdi
callq 0x89a0
leaq 0x77ce(%rip), %rax      # 0xf9b0
cmpl $0x0, (%rax)
je 0x820b
leaq 0x7792(%rip), %rax      # 0xf980
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movl $0x1, %edx
callq 0x36c0
movq -0x18(%rbp), %rdi
callq 0x41f0
callq 0x3030
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x8465
leaq 0x770a(%rip), %rax      # 0xf930
movq (%rax), %rax
movq %rax, -0x38(%rbp)
leaq 0x774c(%rip), %rax      # 0xf980
movq (%rax), %rdi
movq -0x8(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x35b0
cmpq $0x0, -0x38(%rbp)
je 0x8443
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq $0x0, (%rax)
je 0x828f
movq -0x28(%rbp), %rax
cmpq $0x0, (%rax)
je 0x8433
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x40(%rbp), %rax
movq (%rax), %rsi
callq 0x3330
cmpl $0x0, %eax
jne 0x8433
movq -0x40(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x82c7
movq -0x28(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x8433
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x3330
cmpl $0x0, %eax
jne 0x8433
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x82ec
movq -0x40(%rbp), %rax
movl 0x1c(%rax), %ecx
movq -0x18(%rbp), %rax
imull 0x58(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x2c(%rax)
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x8311
movq -0x40(%rbp), %rax
movl 0x20(%rax), %ecx
movq -0x18(%rbp), %rax
imull 0x5c(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x8386
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x836f
movq -0x40(%rbp), %rax
movl 0x14(%rax), %ecx
leaq 0x7643(%rip), %rax      # 0xf980
movq (%rax), %rax
movq 0xe8(%rax), %rax
movq -0x10(%rbp), %rdx
movslq (%rdx), %rdx
shlq $0x7, %rdx
addq %rdx, %rax
addl 0x18(%rax), %ecx
movq -0x18(%rbp), %rax
subl 0x2c(%rax), %ecx
movq -0x18(%rbp), %rax
subl 0x34(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x24(%rax)
jmp 0x8384
movq -0x40(%rbp), %rax
movl 0x14(%rax), %ecx
movq -0x18(%rbp), %rax
addl 0x34(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x24(%rax)
jmp 0x8386
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x83fb
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x83e4
movq -0x40(%rbp), %rax
movl 0x18(%rax), %ecx
leaq 0x75ce(%rip), %rax      # 0xf980
movq (%rax), %rax
movq 0xe8(%rax), %rax
movq -0x10(%rbp), %rdx
movslq (%rdx), %rdx
shlq $0x7, %rdx
addq %rdx, %rax
addl 0x1c(%rax), %ecx
movq -0x18(%rbp), %rax
subl 0x30(%rax), %ecx
movq -0x18(%rbp), %rax
subl 0x34(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x28(%rax)
jmp 0x83f9
movq -0x40(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x18(%rbp), %rax
addl 0x34(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x28(%rax)
jmp 0x83fb
movq -0x18(%rbp), %rdi
callq 0x95c0
movq -0x40(%rbp), %rax
cmpl $0x0, 0x24(%rax)
je 0x8419
movq -0x18(%rbp), %rax
movl $0x1, 0x78(%rax)
movq -0x40(%rbp), %rax
cmpl $-0x2, 0x28(%rax)
je 0x8431
movq -0x40(%rbp), %rax
movl 0x28(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x74(%rax)
jmp 0x8433
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x8244
movq -0x28(%rbp), %rax
movq (%rax), %rdi
callq 0x3220
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3220
movq -0x28(%rbp), %rdi
callq 0x3220
movq -0x18(%rbp), %rdi
callq 0x6500
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x66a0
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x67e0
movq -0x18(%rbp), %rax
cmpl $-0x1, 0x74(%rax)
je 0x84a2
movq -0x18(%rbp), %rax
movl 0x74(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x40(%rcx), %eax
jne 0x84b6
movq -0x18(%rbp), %rdi
callq 0x39b0
movq -0x18(%rbp), %rdi
callq 0x39f0
jmp 0x84c4
movq -0x18(%rbp), %rdi
movl $0x3, %esi
callq 0x3940
movq -0x18(%rbp), %rdi
callq 0x69c0
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)