// File: /workspace/github_c_makefile_star2_O1/tudurom[P]windowchef/wm.c
// Function: handle_wm_state
static void
handle_wm_state(struct client *client, xcb_atom_t state, unsigned int action)
{
	int16_t mon_x, mon_y;
	uint16_t mon_w, mon_h;

	get_monitor_size(client, &mon_x, &mon_y, &mon_w, &mon_h);

	if (state == ewmh->_NET_WM_STATE_FULLSCREEN) {
		if (action == XCB_EWMH_WM_STATE_ADD) {
			maximize_window(client, mon_x, mon_y, mon_w, mon_h);
		} else if (action == XCB_EWMH_WM_STATE_REMOVE && client->maxed) {
			reset_window(client);
			set_focused(client);
		} else if (action == XCB_EWMH_WM_STATE_TOGGLE) {
			if (client->maxed) {
				reset_window(client);
				set_focused(client);
			} else {
				maximize_window(client, mon_x, mon_y, mon_w, mon_h);
			}
		}
	} else if (state == ewmh->_NET_WM_STATE_MAXIMIZED_VERT) {
		if (action == XCB_EWMH_WM_STATE_ADD) {
			vmaximize_window(client, mon_y, mon_h);
		} else if (action == XCB_EWMH_WM_STATE_REMOVE) {
			if (client->vmaxed)
				reset_window(client);
		} else if (action == XCB_EWMH_WM_STATE_TOGGLE) {
			if (client->vmaxed)
				reset_window(client);
			else
				vmaximize_window(client, mon_y, mon_h);
		}
	} else if (state == ewmh->_NET_WM_STATE_MAXIMIZED_HORZ) {
		if (action == XCB_EWMH_WM_STATE_ADD) {
			hmaximize_window(client, mon_y, mon_h);
		} else if (action == XCB_EWMH_WM_STATE_REMOVE) {
			if (client->hmaxed)
				reset_window(client);
		} else if (action == XCB_EWMH_WM_STATE_TOGGLE) {
			if (client->hmaxed)
				reset_window(client);
			else
				hmaximize_window(client, mon_x, mon_w);
		}
	}
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
testq %rdi, %rdi
je 0x5e2f
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x5e2f
movzwl 0x10(%rdi), %ecx
movzwl 0x12(%rdi), %eax
jmp 0x5e3a
movq 0x69a2(%rip), %rdi      # 0xc7d8
xorl %ecx, %ecx
xorl %eax, %eax
movzwl 0x14(%rdi), %r8d
movzwl 0x16(%rdi), %edi
movq 0x6576(%rip), %r9       # 0xc3c0
cmpl %esi, 0x128(%r9)
jne 0x5e6e
testl %edx, %edx
je 0x5ebc
cmpl $0x2, %edx
je 0x5f05
cmpl $0x1, %edx
jne 0x5f39
jmp 0x5f3f
cmpl %esi, 0x110(%r9)
jne 0x5e8a
testl %edx, %edx
je 0x5ef8
cmpl $0x2, %edx
je 0x5edb
cmpl $0x1, %edx
je 0x5ee5
jmp 0x5f39
cmpl %esi, 0x114(%r9)
jne 0x5f39
testl %edx, %edx
je 0x5f74
cmpl $0x2, %edx
je 0x5f5a
cmpl $0x1, %edx
jne 0x5f39
movswl %ax, %esi
movzwl %di, %edx
jmp 0x5f67
cmpb $0x1, 0x24(%rbx)
jne 0x5f00
movq %rbx, %rdi
callq 0x4fab
movq %rbx, %rdi
callq 0x5045
movl (%rbx), %esi
leaq 0x8(%rsp), %rcx
jmp 0x5f22
cmpb $0x1, 0x26(%rbx)
je 0x5f7a
movswl %ax, %esi
movzwl %di, %edx
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
jmp 0x5f87
cmpb $0x1, 0x26(%rbx)
jne 0x5f39
jmp 0x5f7a
cmpl $0x2, %edx
jne 0x5f39
cmpb $0x1, 0x24(%rbx)
jne 0x5f3f
movq %rbx, %rdi
callq 0x4fab
movq %rbx, %rdi
callq 0x5045
movl (%rbx), %esi
leaq 0xc(%rsp), %rcx
movl $0x0, (%rcx)
movq 0x6489(%rip), %rdi      # 0xc3b8
movl $0x40, %edx
callq 0x3200
addq $0x10, %rsp
popq %rbx
retq
movswl %cx, %esi
movswl %ax, %edx
movzwl %r8w, %ecx
movzwl %di, %r8d
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
jmp 0x4ec8
cmpb $0x1, 0x25(%rbx)
je 0x5f7a
movswl %cx, %esi
movzwl %r8w, %edx
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
jmp 0x603a
cmpb $0x1, 0x25(%rbx)
jne 0x5f39
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
jmp 0x4fab