// File: /workspace/github_c_makefile_star2_O1/baskerville[P]bspwm/src/events.c
// Function: handle_state
void handle_state(monitor_t *m, desktop_t *d, node_t *n, xcb_atom_t state, unsigned int action)
{
	if (state == ewmh->_NET_WM_STATE_FULLSCREEN) {
		if (action == XCB_EWMH_WM_STATE_ADD && (ignore_ewmh_fullscreen & STATE_TRANSITION_ENTER) == 0) {
			set_state(m, d, n, STATE_FULLSCREEN);
		} else if (action == XCB_EWMH_WM_STATE_REMOVE && (ignore_ewmh_fullscreen & STATE_TRANSITION_EXIT) == 0) {
			if (n->client->state == STATE_FULLSCREEN) {
				set_state(m, d, n, n->client->last_state);
			}
		} else if (action == XCB_EWMH_WM_STATE_TOGGLE) {
			client_state_t next_state = IS_FULLSCREEN(n->client) ? n->client->last_state : STATE_FULLSCREEN;
			if ((next_state == STATE_FULLSCREEN && (ignore_ewmh_fullscreen & STATE_TRANSITION_ENTER) == 0) ||
			    (next_state != STATE_FULLSCREEN && (ignore_ewmh_fullscreen & STATE_TRANSITION_EXIT) == 0)) {
				set_state(m, d, n, next_state);
			}
		}
		arrange(m, d);
	} else if (state == ewmh->_NET_WM_STATE_BELOW) {
		if (action == XCB_EWMH_WM_STATE_ADD) {
			set_layer(m, d, n, LAYER_BELOW);
		} else if (action == XCB_EWMH_WM_STATE_REMOVE) {
			if (n->client->layer == LAYER_BELOW) {
				set_layer(m, d, n, n->client->last_layer);
			}
		} else if (action == XCB_EWMH_WM_STATE_TOGGLE) {
			set_layer(m, d, n, n->client->layer == LAYER_BELOW ? n->client->last_layer : LAYER_BELOW);
		}
	} else if (state == ewmh->_NET_WM_STATE_ABOVE) {
		if (action == XCB_EWMH_WM_STATE_ADD) {
			set_layer(m, d, n, LAYER_ABOVE);
		} else if (action == XCB_EWMH_WM_STATE_REMOVE) {
			if (n->client->layer == LAYER_ABOVE) {
				set_layer(m, d, n, n->client->last_layer);
			}
		} else if (action == XCB_EWMH_WM_STATE_TOGGLE) {
			set_layer(m, d, n, n->client->layer == LAYER_ABOVE ? n->client->last_layer : LAYER_ABOVE);
		}
	} else if (state == ewmh->_NET_WM_STATE_HIDDEN) {
		if (action == XCB_EWMH_WM_STATE_ADD) {
			set_hidden(m, d, n, true);
		} else if (action == XCB_EWMH_WM_STATE_REMOVE) {
			set_hidden(m, d, n, false);
		} else if (action == XCB_EWMH_WM_STATE_TOGGLE) {
			set_hidden(m, d, n, !n->hidden);
		}
	} else if (state == ewmh->_NET_WM_STATE_STICKY) {
		if (action == XCB_EWMH_WM_STATE_ADD) {
			set_sticky(m, d, n, true);
		} else if (action == XCB_EWMH_WM_STATE_REMOVE) {
			set_sticky(m, d, n, false);
		} else if (action == XCB_EWMH_WM_STATE_TOGGLE) {
			set_sticky(m, d, n, !n->sticky);
		}
	} else if (state == ewmh->_NET_WM_STATE_DEMANDS_ATTENTION) {
		if (action == XCB_EWMH_WM_STATE_ADD) {
			set_urgent(m, d, n, true);
		} else if (action == XCB_EWMH_WM_STATE_REMOVE) {
			set_urgent(m, d, n, false);
		} else if (action == XCB_EWMH_WM_STATE_TOGGLE) {
			set_urgent(m, d, n, !n->client->urgent);
		}
#define HANDLE_WM_STATE(s)  \
	} else if (state == ewmh->_NET_WM_STATE_##s) { \
		if (action == XCB_EWMH_WM_STATE_ADD) { \
			n->client->wm_flags |= WM_FLAG_##s; \
		} else if (action == XCB_EWMH_WM_STATE_REMOVE) { \
			n->client->wm_flags &= ~WM_FLAG_##s; \
		} else if (action == XCB_EWMH_WM_STATE_TOGGLE) { \
			n->client->wm_flags ^= WM_FLAG_##s; \
		} \
		ewmh_wm_state_update(n);
	HANDLE_WM_STATE(MODAL)
	HANDLE_WM_STATE(MAXIMIZED_VERT)
	HANDLE_WM_STATE(MAXIMIZED_HORZ)
	HANDLE_WM_STATE(SHADED)
	HANDLE_WM_STATE(SKIP_TASKBAR)
	HANDLE_WM_STATE(SKIP_PAGER)
	}
#undef HANDLE_WM_STATE
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1b6c9(%rip), %rax     # 0x29e30
movq (%rax), %rax
cmpl %ecx, 0x128(%rax)
jne 0xe7df
testl %r8d, %r8d
je 0xe7b3
cmpl $0x2, %r8d
je 0xe885
cmpl $0x1, %r8d
jne 0xe8c0
leaq 0x1b66e(%rip), %rax     # 0x29e00
movl $0x3, %ecx
testb $0x1, (%rax)
je 0xe8b5
cmpl $0x2, %r8d
je 0xe885
testl %r8d, %r8d
jne 0xe8c0
leaq 0x1b646(%rip), %rax     # 0x29e00
testb $0x2, (%rax)
jne 0xe87f
movq 0x48(%rdx), %rax
cmpl $0x3, 0x308(%rax)
jne 0xe8c0
movl 0x30c(%rax), %ecx
jmp 0xe8b5
cmpl %ecx, 0x130(%rax)
jne 0xe811
testl %r8d, %r8d
je 0xe8e3
cmpl $0x2, %r8d
je 0xe8d2
cmpl $0x1, %r8d
jne 0xeb95
movq %r14, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
jmp 0xe95c
cmpl %ecx, 0x12c(%rax)
jne 0xe846
testl %r8d, %r8d
je 0xe93f
cmpl $0x2, %r8d
je 0xe92b
cmpl $0x1, %r8d
jne 0xeb95
movq %r14, %rdi
movq %rbx, %rsi
movl $0x2, %ecx
jmp 0xe95c
cmpl %ecx, 0x124(%rax)
jne 0xe8f6
testl %r8d, %r8d
je 0xe9ac
cmpl $0x2, %r8d
je 0xe99d
cmpl $0x1, %r8d
jne 0xeb95
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %ecx
jmp 0xe9b4
cmpl $0x2, %r8d
jne 0xe8c0
movq 0x48(%rdx), %rax
movl $0x3, %ecx
cmpl $0x3, 0x308(%rax)
jne 0xe89d
movl 0x30c(%rax), %ecx
leaq 0x1b55c(%rip), %rax     # 0x29e00
movl (%rax), %eax
cmpl $0x3, %ecx
jne 0xe8b1
testb $0x1, %al
je 0xe8b5
jmp 0xe8c0
testb $0x2, %al
jne 0xe8c0
movq %r14, %rdi
movq %rbx, %rsi
callq 0xc64b
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x8a5c
movq 0x48(%rdx), %rax
xorl %ecx, %ecx
cmpl $0x0, 0x310(%rax)
jne 0xe956
jmp 0xe950
movq 0x48(%rdx), %rax
cmpl $0x0, 0x310(%rax)
jne 0xeb95
jmp 0xe950
cmpl %ecx, 0x10c(%rax)
jne 0xe968
testl %r8d, %r8d
je 0xea04
cmpl $0x2, %r8d
je 0xe9f5
cmpl $0x1, %r8d
jne 0xeb95
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %ecx
jmp 0xea0c
movq 0x48(%rdx), %rax
movl $0x2, %ecx
cmpl $0x2, 0x310(%rax)
je 0xe950
jmp 0xe956
movq 0x48(%rdx), %rax
cmpl $0x2, 0x310(%rax)
jne 0xeb95
movl 0x314(%rax), %ecx
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xc566
cmpl %ecx, 0x134(%rax)
jne 0xe9c0
testl %r8d, %r8d
je 0xea63
cmpl $0x2, %r8d
je 0xea4d
cmpl $0x1, %r8d
jne 0xeb95
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %ecx
jmp 0xea6b
movzbl 0x25(%rdx), %ecx
xorl $0x1, %ecx
movq %r14, %rdi
movq %rbx, %rsi
jmp 0xe9b4
movq %r14, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xc9f0
cmpl %ecx, 0x108(%rax)
jne 0xea18
testl %r8d, %r8d
je 0xeabc
cmpl $0x2, %r8d
je 0xeaac
cmpl $0x1, %r8d
jne 0xebe9
movq 0x48(%rdx), %rax
orl $0x1, 0x378(%rax)
jmp 0xebe9
movzbl 0x26(%rdx), %ecx
xorl $0x1, %ecx
movq %r14, %rdi
movq %rbx, %rsi
jmp 0xea0c
movq %r14, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xcc51
cmpl %ecx, 0x110(%rax)
jne 0xea77
testl %r8d, %r8d
je 0xeb11
cmpl $0x2, %r8d
je 0xeb01
cmpl $0x1, %r8d
jne 0xebe9
movq 0x48(%rdx), %rax
orl $0x4, 0x378(%rax)
jmp 0xebe9
movq 0x48(%rdx), %rax
movzbl 0x304(%rax), %ecx
xorl $0x1, %ecx
movq %r14, %rdi
movq %rbx, %rsi
jmp 0xea6b
movq %r14, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xa678
cmpl %ecx, 0x114(%rax)
jne 0xeacc
testl %r8d, %r8d
je 0xeb62
cmpl $0x2, %r8d
je 0xeb52
cmpl $0x1, %r8d
jne 0xebe9
movq 0x48(%rdx), %rax
orl $0x8, 0x378(%rax)
jmp 0xebe9
movq 0x48(%rdx), %rax
xorl $0x1, 0x378(%rax)
jmp 0xebe9
movq 0x48(%rdx), %rax
andl $-0x2, 0x378(%rax)
jmp 0xebe9
cmpl %ecx, 0x118(%rax)
jne 0xeb21
testl %r8d, %r8d
je 0xebaa
cmpl $0x2, %r8d
je 0xeb9d
cmpl $0x1, %r8d
jne 0xebe9
movq 0x48(%rdx), %rax
orl $0x10, 0x378(%rax)
jmp 0xebe9
movq 0x48(%rdx), %rax
xorl $0x4, 0x378(%rax)
jmp 0xebe9
movq 0x48(%rdx), %rax
andl $-0x5, 0x378(%rax)
jmp 0xebe9
cmpl %ecx, 0x11c(%rax)
jne 0xeb6f
testl %r8d, %r8d
je 0xebc4
cmpl $0x2, %r8d
je 0xebb7
cmpl $0x1, %r8d
jne 0xebe9
movq 0x48(%rdx), %rax
orl $0x20, 0x378(%rax)
jmp 0xebe9
movq 0x48(%rdx), %rax
xorl $0x8, 0x378(%rax)
jmp 0xebe9
movq 0x48(%rdx), %rax
andl $-0x9, 0x378(%rax)
jmp 0xebe9
cmpl %ecx, 0x120(%rax)
jne 0xeb95
testl %r8d, %r8d
je 0xebde
cmpl $0x2, %r8d
je 0xebd1
cmpl $0x1, %r8d
jne 0xebe9
movq 0x48(%rdx), %rax
orl $0x40, 0x378(%rax)
jmp 0xebe9
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x48(%rdx), %rax
xorl $0x10, 0x378(%rax)
jmp 0xebe9
movq 0x48(%rdx), %rax
andl $-0x11, 0x378(%rax)
jmp 0xebe9
movq 0x48(%rdx), %rax
xorl $0x20, 0x378(%rax)
jmp 0xebe9
movq 0x48(%rdx), %rax
andl $-0x21, 0x378(%rax)
jmp 0xebe9
movq 0x48(%rdx), %rax
xorl $0x40, 0x378(%rax)
jmp 0xebe9
movq 0x48(%rdx), %rax
andl $-0x41, 0x378(%rax)
movq %rdx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1e5aa