// File: /workspace/github_c_makefile_star2_O1/baskerville[P]bspwm/src/events.c
// Function: configure_request
void configure_request(xcb_generic_event_t *evt)
{
	xcb_configure_request_event_t *e = (xcb_configure_request_event_t *) evt;

	coordinates_t loc;
	bool is_managed = locate_window(e->window, &loc);
	client_t *c = (is_managed ? loc.node->client : NULL);
	uint16_t width, height;

	if (!is_managed) {
		uint16_t mask = 0;
		uint32_t values[7];
		unsigned short i = 0;

		if (e->value_mask & XCB_CONFIG_WINDOW_X) {
			mask |= XCB_CONFIG_WINDOW_X;
			values[i++] = e->x;
		}

		if (e->value_mask & XCB_CONFIG_WINDOW_Y) {
			mask |= XCB_CONFIG_WINDOW_Y;
			values[i++] = e->y;
		}

		if (e->value_mask & XCB_CONFIG_WINDOW_WIDTH) {
			mask |= XCB_CONFIG_WINDOW_WIDTH;
			values[i++] = e->width;
		}

		if (e->value_mask & XCB_CONFIG_WINDOW_HEIGHT) {
			mask |= XCB_CONFIG_WINDOW_HEIGHT;
			values[i++] = e->height;
		}

		if (e->value_mask & XCB_CONFIG_WINDOW_BORDER_WIDTH) {
			mask |= XCB_CONFIG_WINDOW_BORDER_WIDTH;
			values[i++] = e->border_width;
		}

		if (e->value_mask & XCB_CONFIG_WINDOW_SIBLING) {
			mask |= XCB_CONFIG_WINDOW_SIBLING;
			values[i++] = e->sibling;
		}

		if (e->value_mask & XCB_CONFIG_WINDOW_STACK_MODE) {
			mask |= XCB_CONFIG_WINDOW_STACK_MODE;
			values[i++] = e->stack_mode;
		}

		xcb_configure_window(dpy, e->window, mask, values);

	} else if (IS_FLOATING(c)) {
		width = c->floating_rectangle.width;
		height = c->floating_rectangle.height;

		if (e->value_mask & XCB_CONFIG_WINDOW_X) {
			c->floating_rectangle.x = e->x;
		}

		if (e->value_mask & XCB_CONFIG_WINDOW_Y) {
			c->floating_rectangle.y = e->y;
		}

		if (e->value_mask & XCB_CONFIG_WINDOW_WIDTH) {
			width = e->width;
		}

		if (e->value_mask & XCB_CONFIG_WINDOW_HEIGHT) {
			height = e->height;
		}

		apply_size_hints(c, &width, &height);
		c->floating_rectangle.width = width;
		c->floating_rectangle.height = height;
		xcb_rectangle_t r = c->floating_rectangle;

		r.x -= c->border_width;
		r.y -= c->border_width;

		window_move_resize(e->window, r.x, r.y, r.width, r.height);

		put_status(SBSC_MASK_NODE_GEOMETRY, "node_geometry 0x%08X 0x%08X 0x%08X %ux%u+%i+%i\n", loc.monitor->id, loc.desktop->id, e->window, r.width, r.height, r.x, r.y);

		monitor_t *m = monitor_from_client(c);
		if (m != loc.monitor) {
			transfer_node(loc.monitor, loc.desktop, loc.node, m, m->desk, m->desk->focus, false);
		}
	} else {
		if (c->state == STATE_PSEUDO_TILED) {
			width = c->floating_rectangle.width;
			height = c->floating_rectangle.height;
			if (e->value_mask & XCB_CONFIG_WINDOW_WIDTH) {
				width = e->width;
			}
			if (e->value_mask & XCB_CONFIG_WINDOW_HEIGHT) {
				height = e->height;
			}
			apply_size_hints(c, &width, &height);
			if (width != c->floating_rectangle.width || height != c->floating_rectangle.height) {
				c->floating_rectangle.width = width;
				c->floating_rectangle.height = height;
				arrange(loc.monitor, loc.desktop);
			}
		}


		xcb_configure_notify_event_t evt;
		unsigned int bw = c->border_width;

		xcb_rectangle_t r = IS_FULLSCREEN(c) ? loc.monitor->rectangle : c->tiled_rectangle;

		evt.response_type = XCB_CONFIGURE_NOTIFY;
		evt.event = e->window;
		evt.window = e->window;
		evt.above_sibling = XCB_NONE;
		evt.x = r.x;
		evt.y = r.y;
		evt.width = r.width;
		evt.height = r.height;
		evt.border_width = bw;
		evt.override_redirect = false;

		xcb_send_event(dpy, false, e->window, XCB_EVENT_MASK_STRUCTURE_NOTIFY, (const char *) &evt);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movl 0x8(%rdi), %edi
leaq 0x8(%rsp), %rsi
callq 0x1b0a3
testb %al, %al
je 0xdeaf
movq 0x18(%rsp), %rcx
movq 0x48(%rcx), %r14
jmp 0xdeb2
xorl %r14d, %r14d
testb %al, %al
je 0xe008
movl 0x308(%r14), %eax
cmpl $0x1, %eax
je 0xe0cc
cmpl $0x2, %eax
jne 0xe15a
movzwl 0x31c(%r14), %eax
movw %ax, 0x6(%rsp)
movzwl 0x31e(%r14), %eax
movw %ax, 0x4(%rsp)
movzwl 0x1a(%rbx), %eax
testb $0x1, %al
je 0xdf01
movzwl 0x10(%rbx), %ecx
movw %cx, 0x318(%r14)
testb $0x2, %al
je 0xdf11
movzwl 0x12(%rbx), %ecx
movw %cx, 0x31a(%r14)
testb $0x4, %al
je 0xdf1e
movzwl 0x14(%rbx), %ecx
movw %cx, 0x6(%rsp)
testb $0x8, %al
je 0xdf2b
movzwl 0x16(%rbx), %eax
movw %ax, 0x4(%rsp)
leaq 0x6(%rsp), %r15
leaq 0x4(%rsp), %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x10e94
movzwl (%r15), %ebp
movw %bp, 0x31c(%r14)
movzwl (%r12), %r15d
movw %r15w, 0x31e(%r14)
movl 0x300(%r14), %eax
movl 0x318(%r14), %ecx
movzwl 0x31a(%r14), %edx
subl %eax, %ecx
subl %eax, %edx
movl 0x8(%rbx), %edi
movswl %dx, %r12d
movswl %cx, %r13d
movl %r13d, %esi
movl %r12d, %edx
movl %ebp, %ecx
movl %r15d, %r8d
callq 0x10349
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
movl 0x20(%rax), %edx
movl 0x20(%rcx), %ecx
movl 0x8(%rbx), %r8d
subq $0x8, %rsp
leaq 0x11670(%rip), %rsi     # 0x1f620
movl $0x800000, %edi         # imm = 0x800000
movl %ebp, %r9d
xorl %eax, %eax
pushq %r12
pushq %r13
pushq %r15
callq 0x1eb0b
addq $0x20, %rsp
movq %r14, %rdi
callq 0x7565
movq 0x8(%rsp), %rdi
cmpq %rdi, %rax
je 0xe1fb
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x58(%rax), %r8
movq 0x38(%r8), %r9
subq $0x8, %rsp
movq %rax, %rcx
pushq $0x0
callq 0x9e52
addq $0x10, %rsp
jmp 0xe1fb
movzwl 0x1a(%rbx), %eax
testb $0x1, %al
jne 0xe014
xorl %edx, %edx
jmp 0xe020
movswl 0x10(%rbx), %ecx
movl %ecx, 0x20(%rsp)
movw $0x1, %dx
testb $0x2, %al
jne 0xe028
movl %edx, %ecx
jmp 0xe039
movzwl %dx, %esi
leal 0x2(%rsi), %ecx
movswl 0x12(%rbx), %edi
leal 0x1(%rsi), %edx
movl %edi, 0x20(%rsp,%rsi,4)
testb $0x4, %al
je 0xe051
movzwl %cx, %ecx
orl $0x4, %ecx
movzwl 0x14(%rbx), %esi
movzwl %dx, %edi
leal 0x1(%rdi), %edx
movl %esi, 0x20(%rsp,%rdi,4)
testb $0x8, %al
je 0xe069
movzwl %cx, %ecx
orl $0x8, %ecx
movzwl 0x16(%rbx), %esi
movzwl %dx, %edi
leal 0x1(%rdi), %edx
movl %esi, 0x20(%rsp,%rdi,4)
testb $0x10, %al
je 0xe081
movzwl %cx, %ecx
orl $0x10, %ecx
movzwl 0x18(%rbx), %esi
movzwl %dx, %edi
leal 0x1(%rdi), %edx
movl %esi, 0x20(%rsp,%rdi,4)
testb $0x20, %al
je 0xe098
movzwl %cx, %ecx
orl $0x20, %ecx
movl 0xc(%rbx), %esi
movzwl %dx, %edi
leal 0x1(%rdi), %edx
movl %esi, 0x20(%rsp,%rdi,4)
testb $0x40, %al
je 0xe0ad
movzwl %cx, %ecx
orl $0x40, %ecx
movzbl 0x1(%rbx), %eax
movzwl %dx, %edx
movl %eax, 0x20(%rsp,%rdx,4)
leaq 0x1b614(%rip), %rax     # 0x296c8
movq (%rax), %rdi
movl 0x8(%rbx), %esi
movzwl %cx, %edx
leaq 0x20(%rsp), %rcx
callq 0x4310
jmp 0xe1fb
movzwl 0x31c(%r14), %eax
movw %ax, 0x6(%rsp)
movzwl 0x31e(%r14), %eax
movw %ax, 0x4(%rsp)
movzwl 0x1a(%rbx), %eax
testb $0x4, %al
je 0xe0f7
movzwl 0x14(%rbx), %ecx
movw %cx, 0x6(%rsp)
testb $0x8, %al
je 0xe104
movzwl 0x16(%rbx), %eax
movw %ax, 0x4(%rsp)
leaq 0x6(%rsp), %r15
leaq 0x4(%rsp), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x10e94
movzwl (%r15), %eax
cmpw 0x31c(%r14), %ax
jne 0xe136
movzwl 0x4(%rsp), %ecx
cmpw 0x31e(%r14), %cx
je 0xe15a
movw %ax, 0x31c(%r14)
movzwl 0x4(%rsp), %eax
movw %ax, 0x31e(%r14)
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x8a5c
movl 0x300(%r14), %eax
cmpl $0x3, 0x308(%r14)
jne 0xe182
movq 0x8(%rsp), %r14
leaq 0x4c(%r14), %rcx
leaq 0x4e(%r14), %rdx
leaq 0x50(%r14), %rsi
addq $0x52, %r14
jmp 0xe19e
leaq 0x320(%r14), %rcx
leaq 0x322(%r14), %rdx
leaq 0x324(%r14), %rsi
addq $0x326, %r14            # imm = 0x326
movzwl (%rcx), %ecx
movzwl (%rdx), %edi
movzwl (%rsi), %esi
movzwl (%r14), %r9d
leaq 0x20(%rsp), %r8
movb $0x16, (%r8)
movl 0x8(%rbx), %edx
movl %edx, 0x4(%r8)
movl %edx, 0x8(%r8)
movl $0x0, 0xc(%r8)
movw %cx, 0x10(%r8)
movw %di, 0x12(%r8)
movw %si, 0x14(%r8)
movw %r9w, 0x16(%r8)
movw %ax, 0x18(%r8)
movb $0x0, 0x1a(%r8)
leaq 0x1b4dc(%rip), %rax     # 0x296c8
movq (%rax), %rdi
xorl %esi, %esi
movl $0x20000, %ecx          # imm = 0x20000
callq 0x4600
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq