// File: /workspace/github_c_makefile_star2_O0/baskerville[P]bspwm/src/window.c
// Function: manage_window
bool manage_window(xcb_window_t win, rule_consequence_t *csq, int fd)
{
	monitor_t *m = mon;
	desktop_t *d = mon->desk;
	node_t *f = mon->desk->focus;

	parse_rule_consequence(fd, csq);

	if (!ignore_ewmh_struts && ewmh_handle_struts(win)) {
		for (monitor_t *m = mon_head; m != NULL; m = m->next) {
			for (desktop_t *d = m->desk_head; d != NULL; d = d->next) {
				arrange(m, d);
			}
		}
	}

	if (!csq->manage) {
		free(csq->layer);
		free(csq->state);
		window_show(win);
		return false;
	}

	if (csq->node_desc[0] != '\0') {
		coordinates_t ref = {m, d, f};
		coordinates_t trg = {NULL, NULL, NULL};
		if (node_from_desc(csq->node_desc, &ref, &trg) == SELECTOR_OK) {
			m = trg.monitor;
			d = trg.desktop;
			f = trg.node;
		}
	} else if (csq->desktop_desc[0] != '\0') {
		coordinates_t ref = {m, d, NULL};
		coordinates_t trg = {NULL, NULL, NULL};
		if (desktop_from_desc(csq->desktop_desc, &ref, &trg) == SELECTOR_OK) {
			m = trg.monitor;
			d = trg.desktop;
			f = trg.desktop->focus;
		}
	} else if (csq->monitor_desc[0] != '\0') {
		coordinates_t ref = {m, NULL, NULL};
		coordinates_t trg = {NULL, NULL, NULL};
		if (monitor_from_desc(csq->monitor_desc, &ref, &trg) == SELECTOR_OK) {
			m = trg.monitor;
			d = trg.monitor->desk;
			f = trg.monitor->desk->focus;
		}
	}

	if (csq->sticky) {
		m = mon;
		d = mon->desk;
		f = mon->desk->focus;
	}

	if (csq->split_dir != NULL && f != NULL) {
		presel_dir(m, d, f, *csq->split_dir);
	}

	if (csq->split_ratio != 0 && f != NULL) {
		presel_ratio(m, d, f, csq->split_ratio);
	}

	node_t *n = make_node(win);
	client_t *c = make_client();
	c->border_width = csq->border ? d->border_width : 0;
	n->client = c;
	initialize_client(n);
	initialize_floating_rectangle(n);

	if (csq->rect != NULL) {
		c->floating_rectangle = *csq->rect;
		free(csq->rect);
	} else if (c->floating_rectangle.x == 0 && c->floating_rectangle.y == 0) {
		csq->center = true;
	}

	monitor_t *mm = monitor_from_client(c);
	embrace_client(mm, c);
	adapt_geometry(&mm->rectangle, &m->rectangle, n);

	if (csq->center) {
		window_center(m, c);
	}

	snprintf(c->class_name, sizeof(c->class_name), "%s", csq->class_name);
	snprintf(c->instance_name, sizeof(c->instance_name), "%s", csq->instance_name);

	if ((csq->state != NULL && (*(csq->state) == STATE_FLOATING || *(csq->state) == STATE_FULLSCREEN)) || csq->hidden) {
		n->vacant = true;
	}

	f = insert_node(m, d, n, f);
	clients_count++;
	if (single_monocle && d->layout == LAYOUT_MONOCLE && tiled_count(d->root, true) > 1) {
		set_layout(m, d, d->user_layout, false);
	}

	n->vacant = false;

	put_status(SBSC_MASK_NODE_ADD, "node_add 0x%08X 0x%08X 0x%08X 0x%08X\n", m->id, d->id, f!=NULL?f->id:0, win);

	if (f != NULL && f->client != NULL && csq->state != NULL && *(csq->state) == STATE_FLOATING) {
		c->layer = f->client->layer;
	}

	if (csq->layer != NULL) {
		c->layer = *(csq->layer);
	}

	if (csq->state != NULL) {
		set_state(m, d, n, *(csq->state));
	}

	if (csq->honor_size_hints != HONOR_SIZE_HINTS_DEFAULT) {
		c->honor_size_hints = csq->honor_size_hints;
	}

	set_hidden(m, d, n, csq->hidden);
	set_sticky(m, d, n, csq->sticky);
	set_private(m, d, n, csq->private);
	set_locked(m, d, n, csq->locked);
	set_marked(m, d, n, csq->marked);

	arrange(m, d);

	uint32_t values[] = {CLIENT_EVENT_MASK | (focus_follows_pointer ? XCB_EVENT_MASK_ENTER_WINDOW : 0)};
	xcb_change_window_attributes(dpy, win, XCB_CW_EVENT_MASK, values);
	set_window_state(win, XCB_ICCCM_WM_STATE_NORMAL);
	window_grab_buttons(win);

	if (d == m->desk) {
		show_node(d, n);
	} else {
		hide_node(d, n);
	}

	ewmh_update_client_list(false);
	ewmh_set_wm_desktop(n, d);

	if (!csq->hidden && csq->focus) {
		if (d == mon->desk || csq->follow) {
			focus_node(m, d, n);
		} else {
			activate_node(m, d, n);
		}
	} else {
		stack(d, n, false);
		draw_border(n, false, (m == mon));
	}

	free(csq->layer);
	free(csq->state);

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
leaq 0x1fa64(%rip), %rax     # 0x35700
movq (%rax), %rax
movq %rax, -0x20(%rbp)
leaq 0x1fa56(%rip), %rax     # 0x35700
movq (%rax), %rax
movq 0x58(%rax), %rax
movq %rax, -0x28(%rbp)
leaq 0x1fa44(%rip), %rax     # 0x35700
movq (%rax), %rax
movq 0x58(%rax), %rax
movq 0x38(%rax), %rax
movq %rax, -0x30(%rbp)
movl -0x14(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x2aaa0
leaq 0x20116(%rip), %rax     # 0x35df4
testb $0x1, (%rax)
jne 0x15d46
movl -0x8(%rbp), %edi
callq 0x2b300
testb $0x1, %al
jne 0x15cf1
jmp 0x15d46
leaq 0x1fa00(%rip), %rax     # 0x356f8
movq (%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x15d44
movq -0x38(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x15d34
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0xafd0
movq -0x40(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x15d12
jmp 0x15d36
movq -0x38(%rbp), %rax
movq 0x78(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x15cff
jmp 0x15d46
movq -0x10(%rbp), %rax
testb $0x1, 0x62b(%rax)
jne 0x15d84
movq -0x10(%rbp), %rax
movq 0x610(%rax), %rdi
callq 0x4450
movq -0x10(%rbp), %rax
movq 0x618(%rax), %rdi
callq 0x4450
movl -0x8(%rbp), %edi
callq 0x16590
movb $0x0, -0x1(%rbp)
jmp 0x1657a
movq -0x10(%rbp), %rax
movsbl 0x500(%rax), %eax
cmpl $0x0, %eax
je 0x15df6
movq -0x20(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x4100
movq -0x10(%rbp), %rdi
addq $0x500, %rdi            # imm = 0x500
leaq -0x58(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0x25770
cmpl $0x0, %eax
jne 0x15df1
movq -0x70(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x15f1f
movq -0x10(%rbp), %rax
movsbl 0x400(%rax), %eax
cmpl $0x0, %eax
je 0x15e81
movq -0x20(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x80(%rbp)
movq $0x0, -0x78(%rbp)
leaq -0xa0(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x4100
movq -0x10(%rbp), %rdi
addq $0x400, %rdi            # imm = 0x400
leaq -0x88(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
callq 0x25140
cmpl $0x0, %eax
jne 0x15e7c
movq -0xa0(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x98(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x15f1d
movq -0x10(%rbp), %rax
movsbl 0x300(%rax), %eax
cmpl $0x0, %eax
je 0x15f1b
movq -0x20(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq $0x0, -0xb0(%rbp)
movq $0x0, -0xa8(%rbp)
leaq -0xd0(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x4100
movq -0x10(%rbp), %rdi
addq $0x300, %rdi            # imm = 0x300
leaq -0xb8(%rbp), %rsi
leaq -0xd0(%rbp), %rdx
callq 0x24c20
cmpl $0x0, %eax
jne 0x15f19
movq -0xd0(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0xd0(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0xd0(%rbp), %rax
movq 0x58(%rax), %rax
movq 0x38(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x15f1b
jmp 0x15f1d
jmp 0x15f1f
movq -0x10(%rbp), %rax
testb $0x1, 0x625(%rax)
je 0x15f62
leaq 0x1f7cd(%rip), %rax     # 0x35700
movq (%rax), %rax
movq %rax, -0x20(%rbp)
leaq 0x1f7bf(%rip), %rax     # 0x35700
movq (%rax), %rax
movq 0x58(%rax), %rax
movq %rax, -0x28(%rbp)
leaq 0x1f7ad(%rip), %rax     # 0x35700
movq (%rax), %rax
movq 0x58(%rax), %rax
movq 0x38(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x600(%rax)
je 0x15f95
cmpq $0x0, -0x30(%rbp)
je 0x15f95
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x600(%rax), %rax
movl (%rax), %ecx
callq 0xbb10
movq -0x10(%rbp), %rax
movsd 0x608(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x15fae
jp 0x15fae
jmp 0x15fd2
cmpq $0x0, -0x30(%rbp)
je 0x15fd2
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x10(%rbp), %rax
movsd 0x608(%rax), %xmm0
callq 0xbbe0
movl -0x8(%rbp), %edi
callq 0xc700
movq %rax, -0xd8(%rbp)
callq 0xdef0
movq %rax, -0xe0(%rbp)
movq -0x10(%rbp), %rax
testb $0x1, 0x62d(%rax)
je 0x16009
movq -0x28(%rbp), %rax
movl 0x64(%rax), %eax
movl %eax, -0xf4(%rbp)
jmp 0x16013
xorl %eax, %eax
movl %eax, -0xf4(%rbp)
jmp 0x16013
movl -0xf4(%rbp), %ecx
movq -0xe0(%rbp), %rax
movl %ecx, 0x300(%rax)
movq -0xe0(%rbp), %rcx
movq -0xd8(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0xd8(%rbp), %rdi
callq 0xe010
movq -0xd8(%rbp), %rdi
callq 0x165b0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x630(%rax)
je 0x1608c
movq -0xe0(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x630(%rcx), %rcx
movq (%rcx), %rcx
movq %rcx, 0x318(%rax)
movq -0x10(%rbp), %rax
movq 0x630(%rax), %rdi
callq 0x4450
jmp 0x160bf
movq -0xe0(%rbp), %rax
movswl 0x318(%rax), %eax
cmpl $0x0, %eax
jne 0x160bd
movq -0xe0(%rbp), %rax
movswl 0x31a(%rax), %eax
cmpl $0x0, %eax
jne 0x160bd
movq -0x10(%rbp), %rax
movb $0x1, 0x629(%rax)
jmp 0x160bf
movq -0xe0(%rbp), %rdi
callq 0x90e0
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rdi
movq -0xe0(%rbp), %rsi
callq 0x8aa0
movq -0xe8(%rbp), %rdi
addq $0x4c, %rdi
movq -0x20(%rbp), %rsi
addq $0x4c, %rsi
movq -0xd8(%rbp), %rdx
callq 0x82c0
movq -0x10(%rbp), %rax
testb $0x1, 0x629(%rax)
je 0x16121
movq -0x20(%rbp), %rdi
movq -0xe0(%rbp), %rsi
callq 0x16660
movq -0xe0(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
leaq 0x16fb8(%rip), %rdx     # 0x2d0f0
movb $0x0, %al
callq 0x4120
movq -0xe0(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
movq -0x10(%rbp), %rcx
addq $0x100, %rcx            # imm = 0x100
movl $0x100, %esi            # imm = 0x100
leaq 0x16f8c(%rip), %rdx     # 0x2d0f0
movb $0x0, %al
callq 0x4120
movq -0x10(%rbp), %rax
cmpq $0x0, 0x618(%rax)
je 0x16199
movq -0x10(%rbp), %rax
movq 0x618(%rax), %rax
cmpl $0x2, (%rax)
je 0x161a6
movq -0x10(%rbp), %rax
movq 0x618(%rax), %rax
cmpl $0x3, (%rax)
je 0x161a6
movq -0x10(%rbp), %rax
testb $0x1, 0x624(%rax)
je 0x161b1
movq -0xd8(%rbp), %rax
movb $0x1, 0x24(%rax)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0xd8(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0xc020
movq %rax, -0x30(%rbp)
leaq 0x1f510(%rip), %rax     # 0x356e4
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x1f504(%rip), %rax     # 0x356e4
movl %ecx, (%rax)
leaq 0x1fbff(%rip), %rax     # 0x35de8
testb $0x1, (%rax)
je 0x16225
movq -0x28(%rbp), %rax
cmpl $0x1, 0x24(%rax)
jne 0x16225
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rdi
movl $0x1, %esi
callq 0xc8d0
cmpl $0x1, %eax
jle 0x16225
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x28(%rbp), %rax
movl 0x28(%rax), %edx
xorl %ecx, %ecx
callq 0x9e80
movq -0xd8(%rbp), %rax
movb $0x0, 0x24(%rax)
movq -0x20(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0xfc(%rbp)
movq -0x28(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0xf8(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x1625f
movq -0x30(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x100(%rbp)
jmp 0x16269
xorl %eax, %eax
movl %eax, -0x100(%rbp)
jmp 0x16269
movl -0xf8(%rbp), %ecx
movl -0xfc(%rbp), %edx
movl -0x100(%rbp), %r8d
movl -0x8(%rbp), %r9d
movl $0x8000, %edi           # imm = 0x8000
leaq 0x175eb(%rip), %rsi     # 0x2d877
movb $0x0, %al
callq 0x2c0b0
cmpq $0x0, -0x30(%rbp)
je 0x162de
movq -0x30(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x162de
movq -0x10(%rbp), %rax
cmpq $0x0, 0x618(%rax)
je 0x162de
movq -0x10(%rbp), %rax
movq 0x618(%rax), %rax
cmpl $0x2, (%rax)
jne 0x162de
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movl 0x310(%rax), %ecx
movq -0xe0(%rbp), %rax
movl %ecx, 0x310(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x610(%rax)
je 0x16306
movq -0x10(%rbp), %rax
movq 0x610(%rax), %rax
movl (%rax), %ecx
movq -0xe0(%rbp), %rax
movl %ecx, 0x310(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x618(%rax)
je 0x16335
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0xd8(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x618(%rax), %rax
movl (%rax), %ecx
callq 0x10e30
movq -0x10(%rbp), %rax
cmpl $0x4, 0x620(%rax)
je 0x16359
movq -0x10(%rbp), %rax
movl 0x620(%rax), %ecx
movq -0xe0(%rbp), %rax
movl %ecx, 0x328(%rax)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0xd8(%rbp), %rdx
movq -0x10(%rbp), %rax
movb 0x624(%rax), %al
andb $0x1, %al
movzbl %al, %ecx
callq 0x11460
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0xd8(%rbp), %rdx
movq -0x10(%rbp), %rax
movb 0x625(%rax), %al
andb $0x1, %al
movzbl %al, %ecx
callq 0x11760
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0xd8(%rbp), %rdx
movq -0x10(%rbp), %rax
movb 0x626(%rax), %al
andb $0x1, %al
movzbl %al, %ecx
callq 0x118c0
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0xd8(%rbp), %rdx
movq -0x10(%rbp), %rax
movb 0x627(%rax), %al
andb $0x1, %al
movzbl %al, %ecx
callq 0x11970
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0xd8(%rbp), %rdx
movq -0x10(%rbp), %rax
movb 0x628(%rax), %al
andb $0x1, %al
movzbl %al, %ecx
callq 0xc9d0
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xafd0
leaq 0x1f9ce(%rip), %rax     # 0x35dea
movb (%rax), %dl
xorl %eax, %eax
movl $0x10, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
orl $0x600000, %eax         # imm = 0x600000
movl %eax, -0xec(%rbp)
leaq 0x1f27b(%rip), %rax     # 0x356b8
movq (%rax), %rdi
movl -0x8(%rbp), %esi
leaq -0xec(%rbp), %rcx
movl $0x800, %edx            # imm = 0x800
callq 0x46e0
movl %eax, -0xf0(%rbp)
movl -0x8(%rbp), %edi
movl $0x1, %esi
callq 0x16750
movl -0x8(%rbp), %edi
callq 0x14ce0
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x58(%rcx), %rax
jne 0x1648f
movq -0x28(%rbp), %rdi
movq -0xd8(%rbp), %rsi
callq 0xde40
jmp 0x1649f
movq -0x28(%rbp), %rdi
movq -0xd8(%rbp), %rsi
callq 0xdd80
xorl %edi, %edi
callq 0x2b630
movq -0xd8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x2aeb0
movq -0x10(%rbp), %rax
testb $0x1, 0x624(%rax)
jne 0x1651d
movq -0x10(%rbp), %rax
testb $0x1, 0x62c(%rax)
je 0x1651d
movq -0x28(%rbp), %rax
leaq 0x1f225(%rip), %rcx     # 0x35700
movq (%rcx), %rcx
cmpq 0x58(%rcx), %rax
je 0x164f1
movq -0x10(%rbp), %rax
testb $0x1, 0x62a(%rax)
je 0x16507
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0xd8(%rbp), %rdx
callq 0xd720
jmp 0x1651b
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0xd8(%rbp), %rdx
callq 0xccb0
jmp 0x16556
movq -0x28(%rbp), %rdi
movq -0xd8(%rbp), %rsi
xorl %edx, %edx
callq 0x120e0
movq -0xd8(%rbp), %rdi
movq -0x20(%rbp), %rax
leaq 0x1f1bf(%rip), %rcx     # 0x35700
cmpq (%rcx), %rax
sete %al
xorl %ecx, %ecx
movzbl %al, %edx
andl $0x1, %edx
xorl %esi, %esi
callq 0x167c0
movq -0x10(%rbp), %rax
movq 0x610(%rax), %rdi
callq 0x4450
movq -0x10(%rbp), %rax
movq 0x618(%rax), %rdi
callq 0x4450
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopl (%rax,%rax)