// File: /workspace/github_c_makefile_star2_O3/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 0x1b676(%rip), %rax     # 0x29e30
movq (%rax), %rax
cmpl %ecx, 0x128(%rax)
jne 0xe802
testl %r8d, %r8d
je 0xe8a3
cmpl $0x2, %r8d
je 0xe86d
cmpl $0x1, %r8d
jne 0xe996
leaq 0x1b617(%rip), %rax     # 0x29e00
testb $0x1, (%rax)
jne 0xe996
movq %r14, %rdi
movq %rbx, %rsi
movl $0x3, %ecx
jmp 0xe991
cmpl %ecx, 0x130(%rax)
jne 0xe834
testl %r8d, %r8d
je 0xe91c
cmpl $0x2, %r8d
je 0xe904
cmpl $0x1, %r8d
jne 0xebfe
movq %r14, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
jmp 0xe9c5
cmpl %ecx, 0x12c(%rax)
jne 0xe8cf
testl %r8d, %r8d
je 0xe9a8
cmpl $0x2, %r8d
je 0xe96b
cmpl $0x1, %r8d
jne 0xebfe
movq %r14, %rdi
movq %rbx, %rsi
movl $0x2, %ecx
jmp 0xe9c5
movq 0x48(%rdx), %rax
cmpl $0x3, 0x308(%rax)
jne 0xe889
movl 0x30c(%rax), %ecx
cmpl $0x3, %ecx
jne 0xe97f
leaq 0x1b570(%rip), %rax     # 0x29e00
movl $0x3, %ecx
testb $0x1, (%rax)
je 0xe98b
jmp 0xe996
leaq 0x1b556(%rip), %rax     # 0x29e00
testb $0x2, (%rax)
jne 0xe996
movq 0x48(%rdx), %rax
cmpl $0x3, 0x308(%rax)
jne 0xe996
movl 0x30c(%rax), %ecx
jmp 0xe98b
cmpl %ecx, 0x124(%rax)
jne 0xe932
testl %r8d, %r8d
je 0xea15
cmpl $0x2, %r8d
je 0xea06
cmpl $0x1, %r8d
jne 0xebfe
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %ecx
jmp 0xea1d
movq 0x48(%rdx), %rax
xorl %ecx, %ecx
cmpl $0x0, 0x310(%rax)
jne 0xe9bf
jmp 0xe9b9
movq 0x48(%rdx), %rax
cmpl $0x0, 0x310(%rax)
jne 0xebfe
jmp 0xe9b9
cmpl %ecx, 0x10c(%rax)
jne 0xe9d1
testl %r8d, %r8d
je 0xea6d
cmpl $0x2, %r8d
je 0xea5e
cmpl $0x1, %r8d
jne 0xebfe
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %ecx
jmp 0xea75
movq 0x48(%rdx), %rax
movl $0x2, %ecx
cmpl $0x2, 0x310(%rax)
je 0xe9b9
jmp 0xe9bf
leaq 0x1b47a(%rip), %rax     # 0x29e00
testb $0x2, (%rax)
jne 0xe996
movq %r14, %rdi
movq %rbx, %rsi
callq 0xc70b
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x8958
movq 0x48(%rdx), %rax
cmpl $0x2, 0x310(%rax)
jne 0xebfe
movl 0x314(%rax), %ecx
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xc620
cmpl %ecx, 0x134(%rax)
jne 0xea29
testl %r8d, %r8d
je 0xeacc
cmpl $0x2, %r8d
je 0xeab6
cmpl $0x1, %r8d
jne 0xebfe
movq %r14, %rdi
movq %rbx, %rsi
movl $0x1, %ecx
jmp 0xead4
movzbl 0x25(%rdx), %ecx
xorl $0x1, %ecx
movq %r14, %rdi
movq %rbx, %rsi
jmp 0xea1d
movq %r14, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xcab4
cmpl %ecx, 0x108(%rax)
jne 0xea81
testl %r8d, %r8d
je 0xeb25
cmpl $0x2, %r8d
je 0xeb15
cmpl $0x1, %r8d
jne 0xec52
movq 0x48(%rdx), %rax
orl $0x1, 0x378(%rax)
jmp 0xec52
movzbl 0x26(%rdx), %ecx
xorl $0x1, %ecx
movq %r14, %rdi
movq %rbx, %rsi
jmp 0xea75
movq %r14, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xccfe
cmpl %ecx, 0x110(%rax)
jne 0xeae0
testl %r8d, %r8d
je 0xeb7a
cmpl $0x2, %r8d
je 0xeb6a
cmpl $0x1, %r8d
jne 0xec52
movq 0x48(%rdx), %rax
orl $0x4, 0x378(%rax)
jmp 0xec52
movq 0x48(%rdx), %rax
movzbl 0x304(%rax), %ecx
xorl $0x1, %ecx
movq %r14, %rdi
movq %rbx, %rsi
jmp 0xead4
movq %r14, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xa6da
cmpl %ecx, 0x114(%rax)
jne 0xeb35
testl %r8d, %r8d
je 0xebcb
cmpl $0x2, %r8d
je 0xebbb
cmpl $0x1, %r8d
jne 0xec52
movq 0x48(%rdx), %rax
orl $0x8, 0x378(%rax)
jmp 0xec52
movq 0x48(%rdx), %rax
xorl $0x1, 0x378(%rax)
jmp 0xec52
movq 0x48(%rdx), %rax
andl $-0x2, 0x378(%rax)
jmp 0xec52
cmpl %ecx, 0x118(%rax)
jne 0xeb8a
testl %r8d, %r8d
je 0xec13
cmpl $0x2, %r8d
je 0xec06
cmpl $0x1, %r8d
jne 0xec52
movq 0x48(%rdx), %rax
orl $0x10, 0x378(%rax)
jmp 0xec52
movq 0x48(%rdx), %rax
xorl $0x4, 0x378(%rax)
jmp 0xec52
movq 0x48(%rdx), %rax
andl $-0x5, 0x378(%rax)
jmp 0xec52
cmpl %ecx, 0x11c(%rax)
jne 0xebd8
testl %r8d, %r8d
je 0xec2d
cmpl $0x2, %r8d
je 0xec20
cmpl $0x1, %r8d
jne 0xec52
movq 0x48(%rdx), %rax
orl $0x20, 0x378(%rax)
jmp 0xec52
movq 0x48(%rdx), %rax
xorl $0x8, 0x378(%rax)
jmp 0xec52
movq 0x48(%rdx), %rax
andl $-0x9, 0x378(%rax)
jmp 0xec52
cmpl %ecx, 0x120(%rax)
jne 0xebfe
testl %r8d, %r8d
je 0xec47
cmpl $0x2, %r8d
je 0xec3a
cmpl $0x1, %r8d
jne 0xec52
movq 0x48(%rdx), %rax
orl $0x40, 0x378(%rax)
jmp 0xec52
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x48(%rdx), %rax
xorl $0x10, 0x378(%rax)
jmp 0xec52
movq 0x48(%rdx), %rax
andl $-0x11, 0x378(%rax)
jmp 0xec52
movq 0x48(%rdx), %rax
xorl $0x20, 0x378(%rax)
jmp 0xec52
movq 0x48(%rdx), %rax
andl $-0x21, 0x378(%rax)
jmp 0xec52
movq 0x48(%rdx), %rax
xorl $0x40, 0x378(%rax)
jmp 0xec52
movq 0x48(%rdx), %rax
andl $-0x41, 0x378(%rax)
movq %rdx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1e1d3
nopl (%rax)