// File: /workspace/github_c_makefile_star2_O1/kaiserschmarrn0[P]mywm/mywm.c
// Function: configure_request
static void configure_request(xcb_generic_event_t *ev) {
	xcb_configure_request_event_t *e = (xcb_configure_request_event_t *)ev;
	window *found = search_all(NULL, TYPE_ALL, WIN_CHILD, e->window);
	
	uint32_t vals[6];
	unsigned int i = 0;

	if (!found || !found->normal) {
		int i = mask_to_geo(e, vals);

		CHECK_MASK(vals, i, e->sibling, e->value_mask, XCB_CONFIG_WINDOW_SIBLING)
		CHECK_MASK(vals, i, e->stack_mode, e->value_mask, XCB_CONFIG_WINDOW_STACK_MODE)

		xcb_configure_window(conn, e->window, e->value_mask, vals);

		return;
	}
	
	if (!found->is_i_full && !found->is_e_full) {
		uint32_t ignore = XCB_CONFIG_WINDOW_STACK_MODE | XCB_CONFIG_WINDOW_SIBLING;
		
		if (e->value_mask & XCB_CONFIG_WINDOW_X) {
			vals[i++] = e->x - PAD;
		}
		if (e->value_mask & XCB_CONFIG_WINDOW_Y) {
			vals[i++] = e->y - PAD_N;
		}
		if (e->value_mask & XCB_CONFIG_WINDOW_WIDTH) {
			vals[i++] = e->width - 2 * PAD;
		}
		if (e->value_mask & XCB_CONFIG_WINDOW_HEIGHT) {
			vals[i++] = e->height - PAD_N - PAD;
		}

		update_geometry(found, e->value_mask & ~ignore, vals);
	}
		
	if (e->value_mask & XCB_CONFIG_WINDOW_STACK_MODE) {
		switch (e->stack_mode) {
			case XCB_STACK_MODE_ABOVE: mywm_raise(found); break;
			case XCB_STACK_MODE_BELOW: /* dumbass */ break;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl 0x8(%rdi), %ecx
xorl %r15d, %r15d
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x6b71
testq %rax, %rax
je 0x4794
movq %rax, %r14
cmpl $0x0, 0xc0(%rax)
je 0x4794
cmpl $0x0, 0x18c(%r14)
jne 0x4773
cmpl $0x0, 0x190(%r14)
jne 0x4773
movzwl 0x1a(%rbx), %esi
xorl %eax, %eax
testb $0x1, %sil
je 0x4727
movswl 0x10(%rbx), %eax
decl %eax
movl %eax, -0x30(%rbp)
movl $0x1, %eax
testb $0x2, %sil
je 0x473c
movswl 0x12(%rbx), %ecx
addl $-0x20, %ecx
movl %eax, %edx
incl %eax
movl %ecx, -0x30(%rbp,%rdx,4)
testb $0x4, %sil
je 0x4751
movzwl 0x14(%rbx), %ecx
addl $-0x2, %ecx
movl %eax, %edx
incl %eax
movl %ecx, -0x30(%rbp,%rdx,4)
testb $0x8, %sil
je 0x4764
movzwl 0x16(%rbx), %ecx
addl $-0x21, %ecx
movl %eax, %eax
movl %ecx, -0x30(%rbp,%rax,4)
andl $-0x61, %esi
leaq -0x30(%rbp), %rdx
movq %r14, %rdi
callq 0x5464
testb $0x40, 0x1a(%rbx)
je 0x4815
cmpb $0x0, 0x1(%rbx)
jne 0x4815
movq %r14, %rdi
callq 0x4f46
jmp 0x4815
movzwl 0x1a(%rbx), %eax
testb $0x1, %al
je 0x47a9
movswl 0x10(%rbx), %ecx
movl %ecx, -0x30(%rbp)
movl $0x1, %r15d
testb $0x2, %al
je 0x47bb
movswl 0x12(%rbx), %ecx
movl %r15d, %edx
incl %r15d
movl %ecx, -0x30(%rbp,%rdx,4)
testb $0x4, %al
je 0x47cd
movzwl 0x14(%rbx), %ecx
movl %r15d, %edx
incl %r15d
movl %ecx, -0x30(%rbp,%rdx,4)
testb $0x8, %al
je 0x47df
movzwl 0x16(%rbx), %ecx
movl %r15d, %edx
incl %r15d
movl %ecx, -0x30(%rbp,%rdx,4)
testb $0x20, %al
je 0x47f0
movl 0xc(%rbx), %ecx
movl %r15d, %edx
incl %r15d
movl %ecx, -0x30(%rbp,%rdx,4)
testb $0x40, %al
je 0x47ff
movzbl 0x1(%rbx), %ecx
movl %r15d, %edx
movl %ecx, -0x30(%rbp,%rdx,4)
movq 0x8c42(%rip), %rdi      # 0xd448
movl 0x8(%rbx), %esi
movzwl %ax, %edx
leaq -0x30(%rbp), %rcx
callq 0x31e0
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq