// File: /workspace/github_c_makefile_star2_O2/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 0x6736
testq %rax, %rax
je 0x465a
movq %rax, %r14
cmpl $0x0, 0xc0(%rax)
je 0x465a
cmpl $0x0, 0x18c(%r14)
jne 0x463c
cmpl $0x0, 0x190(%r14)
jne 0x463c
movzwl 0x1a(%rbx), %esi
xorl %eax, %eax
testb $0x1, %sil
je 0x45f0
movswl 0x10(%rbx), %eax
decl %eax
movl %eax, -0x30(%rbp)
pushq $0x1
popq %rax
testb $0x2, %sil
je 0x4605
movswl 0x12(%rbx), %ecx
addl $-0x20, %ecx
movl %eax, %edx
incl %eax
movl %ecx, -0x30(%rbp,%rdx,4)
testb $0x4, %sil
je 0x461a
movzwl 0x14(%rbx), %ecx
addl $-0x2, %ecx
movl %eax, %edx
incl %eax
movl %ecx, -0x30(%rbp,%rdx,4)
testb $0x8, %sil
je 0x462d
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 0x5243
testb $0x40, 0x1a(%rbx)
je 0x46d9
cmpb $0x0, 0x1(%rbx)
jne 0x46d9
movq %r14, %rdi
callq 0x4d61
jmp 0x46d9
movzwl 0x1a(%rbx), %eax
testb $0x1, %al
je 0x466d
movswl 0x10(%rbx), %ecx
movl %ecx, -0x30(%rbp)
pushq $0x1
popq %r15
testb $0x2, %al
je 0x467f
movswl 0x12(%rbx), %ecx
movl %r15d, %edx
incl %r15d
movl %ecx, -0x30(%rbp,%rdx,4)
testb $0x4, %al
je 0x4691
movzwl 0x14(%rbx), %ecx
movl %r15d, %edx
incl %r15d
movl %ecx, -0x30(%rbp,%rdx,4)
testb $0x8, %al
je 0x46a3
movzwl 0x16(%rbx), %ecx
movl %r15d, %edx
incl %r15d
movl %ecx, -0x30(%rbp,%rdx,4)
testb $0x20, %al
je 0x46b4
movl 0xc(%rbx), %ecx
movl %r15d, %edx
incl %r15d
movl %ecx, -0x30(%rbp,%rdx,4)
testb $0x40, %al
je 0x46c3
movzbl 0x1(%rbx), %ecx
movl %r15d, %edx
movl %ecx, -0x30(%rbp,%rdx,4)
movq 0x8d7e(%rip), %rdi      # 0xd448
movl 0x8(%rbx), %esi
movzwl %ax, %edx
leaq -0x30(%rbp), %rcx
callq 0x31d0
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq